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

fixed writing of wc with flags==0 in plain_write() during defrag afte… #137

Closed abudnik closed 8 years ago

abudnik commented 8 years ago

…r blob close

Error description: [server logs: https://gist.github.com/abudnik/9f6f6d91236d3775ce58] eblob_write_commit_prepare() & eblob_plain_writev_prepare() calls eblob_write_prepare_disk_ll() with zeroed flags when binlog enabled to ignore BLOB_DISK_CTL_APPEND, so eblob_write_prepare_disk_ll() calls eblob_commit_disk() and writes wc with zeroed flags to the last index & blob files. Next plain write with the same key causes lookup of wc (using eblob_fill_write_control_from_ram()) and check of BLOB_DISK_CTL_EXTHDR bit for new and old wc in eblob_plain_writev_prepare(), thereby returning ENOTSUP (-95).

So eblob should always commit to blob & index wc with original flags.

bioothod commented 8 years ago

If it is prepare, we do not care about append - there is nothing to append to, prepare is useful for first-time-inserted keys (although it is not forbidden to call prepare for existing keys and thus APPEND is also allowed, it would be great to add such a test!).

What if we will not zero-out flags before calling eblob_write_prepare_disk_ll()?

abudnik commented 8 years ago

fixed