njaard / sonnerie

A simple timeseries database
Other
266 stars 19 forks source link

Add a better support for empty segment #19

Closed Kerollmops closed 2 years ago

Kerollmops commented 2 years ago

Could fix #18.

Please, review this in detail as I am absolutely not sure it is the right way to fix this. I would say that it is maybe more related to the segment writer that should not generate empty ones.

I have added a fix to the worker_thread function to be sure that it doesn't try to write a segment that has an empty current_segment_data. But I am not sure what the current_key_data, what it contains and why it is larger than SEGMENT_SIZE_GOAL, and why it is so big?

By using this fix you'll be able to output the entries in the tx file from #18 (all of them?).

njaard commented 2 years ago

I added a test and did the self.current_segment_data.is_empty test. Thanks!