Skip to content

Commit

Permalink
Fix RocksDB 4838: (bytedance#208)
Browse files Browse the repository at this point in the history
- Fix with pipelined write, write leaders's callback failure lead to the whole write group fail
- facebook/rocksdb@8c79f79
  • Loading branch information
jyizheng authored and yapple committed Sep 21, 2022
1 parent 662ee4e commit c54b3b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions db/db_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,

PERF_TIMER_STOP(write_pre_and_post_process_time);

if (w.ShouldWriteToWAL()) {
if (w.status.ok() && !write_options.disableWAL) {
PERF_TIMER_GUARD(write_wal_time);
stats->AddDBStats(InternalStats::WRITE_DONE_BY_SELF, 1);
RecordTick(stats_, WRITE_DONE_BY_SELF, 1);
Expand Down Expand Up @@ -511,7 +511,7 @@ Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,
WriteThread::WriteGroup memtable_write_group;
if (w.state == WriteThread::STATE_MEMTABLE_WRITER_LEADER) {
PERF_TIMER_GUARD(write_memtable_time);
assert(w.status.ok());
assert(w.ShouldWriteToMemtable());
write_thread_.EnterAsMemTableWriter(&w, &memtable_write_group);
if (memtable_write_group.size > 1 &&
immutable_db_options_.allow_concurrent_memtable_write) {
Expand Down
2 changes: 1 addition & 1 deletion db/write_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class WriteThread {
std::atomic<uint8_t> state; // write under StateMutex() or pre-link
WriteGroup* write_group;
SequenceNumber sequence; // the sequence number to use for the first key
Status status; // status of memtable inserter
Status status;
Status callback_status; // status returned by callback->Callback()

std::aligned_storage<sizeof(std::mutex)>::type state_mutex_bytes;
Expand Down

0 comments on commit c54b3b1

Please sign in to comment.