mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-19 16:15:07 +00:00
commitlog: fix flushing an entry marked as "sync" in periodic mode
After546556b71bwe can have mixed writes into commitlog, some do flush immediately some do not. If non flushing write races with flushing one and becomes responsible for writing back its buffer into a file flush will be skipped which will cause assert in batch_cycle() to trigger since flush position will not be advanced. Fix that by checking that flush was skipped and in this case flush explicitly our file position. Fixes #5670 Message-Id: <20200128145103.GI26048@scylladb.com> (cherry picked from commitc654ffe34b)
This commit is contained in:
@@ -807,7 +807,12 @@ public:
|
||||
// (Note: wait_for_pending(pos) waits for operation _at_ pos (and before),
|
||||
replay_position rp(me->_desc.id, position_type(fp));
|
||||
return me->_pending_ops.wait_for_pending(rp, timeout).then([me, fp] {
|
||||
assert(me->_flush_pos > fp);
|
||||
assert(me->_segment_manager->cfg.mode != sync_mode::BATCH || me->_flush_pos > fp);
|
||||
if (me->_flush_pos <= fp) {
|
||||
// previous op we were waiting for was not sync one, so it did not flush
|
||||
// force flush here
|
||||
return me->do_flush(fp);
|
||||
}
|
||||
return make_ready_future<sseg_ptr>(me);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user