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 Track full_history_ts_low per SuperVersion (#11784) 2023-09-13 16:34:18 -07:00
compacted_db_impl.h Group rocksdb.sst.read.micros stat by different user read IOActivity + misc (#11444) 2023-08-08 17:26:50 -07:00
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 Quarantine files in a limbo state after a manifest error (#12030) 2023-11-11 08:11:11 -08:00
db_impl_experimental.cc Record the persist_user_defined_timestamps flag in manifest (#11515) 2023-06-21 21:49:01 -07:00
db_impl_files.cc Quarantine files in a limbo state after a manifest error (#12030) 2023-11-11 08:11:11 -08:00
db_impl_open.cc Drop wal record when sequence is illegal (#11985) 2023-11-09 10:43:16 -08:00
db_impl_readonly.cc GetEntity Support for ReadOnlyDB and SecondaryDB (#11799) 2023-09-15 08:30:44 -07:00
db_impl_readonly.h AttributeGroups - PutEntity Implementation (#11977) 2023-11-06 16:52:51 -08:00
db_impl_secondary.cc Expose more info about input files in CompactionFilter::Context (#11857) 2023-09-20 13:34:39 -07:00
db_impl_secondary.h AttributeGroups - PutEntity Implementation (#11977) 2023-11-06 16:52:51 -08:00
db_impl_write.cc Fix double counting of BYTES_WRITTEN ticker (#12111) 2023-12-08 17:12:11 -08:00