Verify write batch checksum before WAL (#10114)
Summary:
Context: WriteBatch can have key-value checksums when it was created `with protection_bytes_per_key > 0`.
This PR added checksum verification for write batches before they are written to WAL.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/10114
Test Plan:
- Added new unit tests to db_kv_checksum_test.cc: `make check -j32`
- benchmark on performance regression: `./db_bench --benchmarks=fillrandom[-X20] -db=/dev/shm/test_rocksdb -write_batch_protection_bytes_per_key=8`
- Pre-PR:
`
fillrandom [AVG 20 runs] : 198875 (± 3006) ops/sec; 22.0 (± 0.3) MB/sec
`
- Post-PR:
`
fillrandom [AVG 20 runs] : 196487 (± 2279) ops/sec; 21.7 (± 0.3) MB/sec
`
Mean regressed about 1% (198875 -> 196487 ops/sec).
Reviewed By: ajkr
Differential Revision:
D36917464
Pulled By: cbi42
fbshipit-source-id:
29beb74edf65f04b1a890b4f650d873dc7ed790d