rocksdb/db/db_impl
Kevin Mingtarja 44fd914128 Fix double counting of BYTES_WRITTEN ticker (#12111)
Summary:
Fixes https://github.com/facebook/rocksdb/issues/12061.

We were double counting the `BYTES_WRITTEN` ticker when doing writes with transactions. During transactions, after writing, a client can call `Prepare()`, which writes the values to WAL but not to the Memtable. After that, they can call `Commit()`, which writes a commit marker to the WAL and the values to Memtable.

The cause of this bug is previously during writes, we didn't take into account `writer->ShouldWriteToMemtable()` before adding to `total_byte_size`, so it is still added to during the `Prepare()` phase even though we're not writing to the Memtable, which was why we saw the value to be double of what's written to WAL.

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

Test Plan: Added a test in `db/db_statistics_test.cc` that tests writes with and without transactions, by comparing the values of `BYTES_WRITTEN` and `WAL_FILE_BYTES` after doing writes.

Reviewed By: jaykorean

Differential Revision: D51954327

Pulled By: jowlyzhang

fbshipit-source-id: 57a0986a14e5b94eb5188715d819212529110d2c
2023-12-08 17:12:11 -08:00
..
compacted_db_impl.cc
compacted_db_impl.h
db_impl.cc ColumnFamilyHandle Nullcheck in GetEntity and MultiGetEntity (#12057) 2023-11-13 14:30:04 -08:00
db_impl.h ColumnFamilyHandle Nullcheck in GetEntity and MultiGetEntity (#12057) 2023-11-13 14:30:04 -08:00
db_impl_compaction_flush.cc Flush buffered logs when FlushRequest is rescheduled (#12105) 2023-11-29 11:35:59 -08:00
db_impl_debug.cc
db_impl_experimental.cc
db_impl_files.cc
db_impl_open.cc
db_impl_readonly.cc
db_impl_readonly.h
db_impl_secondary.cc
db_impl_secondary.h
db_impl_write.cc Fix double counting of BYTES_WRITTEN ticker (#12111) 2023-12-08 17:12:11 -08:00