Skip to content

Commit

Permalink
Adapt key-value checksum for timestamp-suffixed keys (#8914)
Browse files Browse the repository at this point in the history
Summary:
After #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: #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
  • Loading branch information
ajkr authored and facebook-github-bot committed Sep 14, 2021
1 parent e10e416 commit d648cb4
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 199 deletions.
Loading

0 comments on commit d648cb4

Please sign in to comment.