reverbrain / eblob

Eblob is an append-only low-level IO library, which saves data in blob files. Created as low-level backend for elliptics
GNU Lesser General Public License v3.0
104 stars 29 forks source link

Defrag: fixed comparing index_size and removed_size before removing blob. #81

Closed shaitan closed 10 years ago

shaitan commented 10 years ago

Fixed faulty comparison index_offset with removed_size by comparison index_size with removed_size. Faulty check led to the situation that the blobs without alive records would never have been removed.

SaveTheRbtz commented 10 years ago

Interesting, index_offset should always be equal to index_size, no? UPD: Though, in mobjects.c we do not set index_offset because we sort index on open - maybe it's worth fixing it there.

shaitan commented 10 years ago

Why do we need both of them if they are always equal to each other? Maybe it is better to get rid of one of them?

SaveTheRbtz commented 10 years ago

We don't - there should be only one of them. But historically size is used for sorted indexes (because it's immutable) and offset is used for non-sorted.

PS. ideally there should be two different data structures with common APIs for sorted and unsorted indexes because otherwise it'll lead to all sorts of misunderstandings.