]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Adapt key-value checksum for timestamp-suffixed keys (#8914)
authorAndrew Kryczka <andrewkr@fb.com>
Tue, 14 Sep 2021 20:13:36 +0000 (13:13 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 14 Sep 2021 20:14:39 +0000 (13:14 -0700)
commitd648cb47b91091e68f7d28fe54d6eef481f00af2
tree7eeb88d4632b17d7825eb1f5e06447a4f2269062
parente10e4162c8c2426c844000150bc84a23e300a0c9
Adapt key-value checksum for timestamp-suffixed keys (#8914)

Summary:
After https://github.com/facebook/rocksdb/issues/8725, keys added to `WriteBatch` may be timestamp-suffixed, while `WriteBatch` has no awareness of the timestamp size. Therefore, `WriteBatch` can no longer calculate timestamp checksum separately from the rest of the key's checksum in all cases.

This PR changes the definition of key in KV checksum to include the timestamp suffix. That way we do not need to worry about where the timestamp begins within the key. I believe the only practical effect of this change is now `AssignTimestamp()` requires recomputing the whole key checksum (`UpdateK()`) rather than just the timestamp portion (`UpdateT()`).

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8914

Test Plan:
run stress command that used to fail

```
$ ./db_stress --batch_protection_bytes_per_key=8 -clear_column_family_one_in=0 -test_batches_snapshots=1
```

Reviewed By: riversand963

Differential Revision: D30925715

Pulled By: ajkr

fbshipit-source-id: c143f7ccb46c0efb390ad57ef415c250d754deff
db/kv_checksum.h
db/memtable.cc
db/memtable.h
db/write_batch.cc
db/write_batch_internal.h