Assert valid linked list for write group (#7375)
Summary: We've seen some segfaults in db_write_test, with at least one suggesting corruption of a write group linked list. Adding an assertion to have this fail in a more specific way if that is the broken invariant. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7375 Test Plan: make check Reviewed By: jay-zhuang Differential Revision: D23638477 Pulled By: pdillinger fbshipit-source-id: a76fd677cad60a3a516bd363947bfd9ce418edc1
This commit is contained in:
parent
c4e2066dbd
commit
be8445eea8
@ -438,6 +438,7 @@ size_t WriteThread::EnterAsBatchGroupLeader(Writer* leader,
|
||||
// (newest_writer) is inclusive. Iteration goes from old to new.
|
||||
Writer* w = leader;
|
||||
while (w != newest_writer) {
|
||||
assert(w->link_newer);
|
||||
w = w->link_newer;
|
||||
|
||||
if (w->sync && !leader->sync) {
|
||||
@ -512,6 +513,7 @@ void WriteThread::EnterAsMemTableWriter(Writer* leader,
|
||||
|
||||
Writer* w = leader;
|
||||
while (w != newest_writer) {
|
||||
assert(w->link_newer);
|
||||
w = w->link_newer;
|
||||
|
||||
if (w->batch == nullptr) {
|
||||
@ -568,6 +570,7 @@ void WriteThread::ExitAsMemTableWriter(Writer* /*self*/,
|
||||
if (w == last_writer) {
|
||||
break;
|
||||
}
|
||||
assert(next);
|
||||
w = next;
|
||||
}
|
||||
// Note that leader has to exit last, since it owns the write group.
|
||||
@ -721,6 +724,7 @@ void WriteThread::ExitAsBatchGroupLeader(WriteGroup& write_group,
|
||||
// leader now
|
||||
|
||||
while (last_writer != leader) {
|
||||
assert(last_writer);
|
||||
last_writer->status = status;
|
||||
// we need to read link_older before calling SetState, because as soon
|
||||
// as it is marked committed the other thread's Await may return and
|
||||
|
Loading…
Reference in New Issue
Block a user