]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix a data race related to memtable trimming (#6187)
authorLevi Tamasi <ltamasi@fb.com>
Mon, 16 Dec 2019 21:13:42 +0000 (13:13 -0800)
committerLevi Tamasi <ltamasi@fb.com>
Fri, 10 Jan 2020 17:54:56 +0000 (09:54 -0800)
commitc0a5673aa7a58487f059ba2f233b13785eb70b2e
treecbb3b45d0dacd292d99f59b38dc0c10ce798ddde
parent8f121d86a4b8613b979156ad7ee9f02781dee055
Fix a data race related to memtable trimming (#6187)

Summary:
https://github.com/facebook/rocksdb/pull/6177 introduced a data race
involving `MemTableList::InstallNewVersion` and `MemTableList::NumFlushed`.
The patch fixes this by caching whether the current version has any
memtable history (i.e. flushed memtables that are kept around for
transaction conflict checking) in an `std::atomic<bool>` member called
`current_has_history_`, similarly to how `current_memory_usage_excluding_last_`
is handled.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6187

Test Plan:
```
make clean
COMPILE_WITH_TSAN=1 make db_test -j24
./db_test
```

Differential Revision: D19084059

Pulled By: ltamasi

fbshipit-source-id: 327a5af9700fb7102baea2cc8903c085f69543b9
db/memtable_list.cc
db/memtable_list.h
db/write_batch.cc