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

blob: allow to overwrite old or broken keys #152

Closed bioothod closed 8 years ago

bioothod commented 8 years ago

Allow to overwrite old or broken keys (without BLOB_DISK_CTL_EXTHDR flag) with contiguous blocks

shaitan commented 8 years ago

Can you describe the reason for continuity of writing blocks?

bioothod commented 8 years ago

Contiguous blocks overwrite file as a whole object in this case, i.e. going to replace it, not just overwrite some pieces of it (for example starting from some offset), thus it is safe to allow this. It would not be the case for common write, but plain write started from the beginning is a sign of replacement, otherwise we would use common write with offset.

bioothod commented 8 years ago

I would actually remove that check at all. If we call prepare then we are about to replace the whole file, then it is safe to overwrite old data which doesn't have external header

bioothod commented 8 years ago

Check removed, this commit allows plain write to overwrite old or broken records (without BLOB_DISK_CTL_EXTHDR flag), since prepare+plain_write is not used for partial update, prepare by itself a sign, that we are writing a new record and reserve space for it.

bioothod commented 8 years ago

Invalid approach, eblob_write_prepare() should fix flags instead