Skip to content

Commit e39b54f

Browse files
committed
MB-35629: Revert "MB-35458 [SR]: Move SyncWrite completion to bg DurabilityCompletionTask"
The introduction of the background commit has introduced a (severe) performance regression - SyncWrites are getting stuck and timing out. Suspect an issue with the wakeup / notificaiotn of the DurabilityCompletionTask; reverting change to restore performance while investigating. This reverts commit 7fdb98a. Change-Id: I8d08044d3f6ad3084f7724ead961b8d7530006f1 Reviewed-on: http://review.couchbase.org/113637 Reviewed-by: Ben Huddleston <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 8ba5a89 commit e39b54f

35 files changed

+75
-455
lines changed

engines/ep/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ ADD_LIBRARY(ep_objs OBJECT
227227
src/defragmenter_visitor.cc
228228
src/diskdockey.cc
229229
src/durability/active_durability_monitor.cc
230-
src/durability/durability_completion_task.cc
231230
src/durability/durability_monitor.cc
232231
src/durability/durability_monitor_impl.cc
233232
src/durability/passive_durability_monitor.cc

engines/ep/benchmarks/defragmenter_bench.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class DefragmentBench : public benchmark::Fixture {
5656
/*table*/ nullptr,
5757
std::make_shared<DummyCB>(),
5858
/*newSeqnoCb*/ nullptr,
59-
[](Vbid) { return; },
6059
NoopSyncWriteCompleteCb,
6160
NoopSeqnoAckCb,
6261
config,

engines/ep/benchmarks/item_compressor_bench.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class ItemCompressorBench : public benchmark::Fixture {
5555
/*table*/ nullptr,
5656
std::make_shared<DummyCB>(),
5757
/*newSeqnoCb*/ nullptr,
58-
[](Vbid) { return; },
5958
NoopSyncWriteCompleteCb,
6059
NoopSeqnoAckCb,
6160
config,

engines/ep/src/durability/active_durability_monitor.cc

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ void ActiveDurabilityMonitor::setReplicationTopology(
544544
s->setReplicationTopology(topology, *resolvedQueue);
545545
}
546546

547-
checkForResolvedSyncWrites();
547+
processCompletedSyncWriteQueue();
548548
}
549549

550550
int64_t ActiveDurabilityMonitor::getHighPreparedSeqno() const {
@@ -619,9 +619,8 @@ ENGINE_ERROR_CODE ActiveDurabilityMonitor::seqnoAckReceived(
619619
seqnoAckReceivedPostProcessHook();
620620
}
621621

622-
// Check if any there's now any resolved SyncWrites which should be
623-
// completed.
624-
checkForResolvedSyncWrites();
622+
// Process the Completed Queue, committing all items and removing them.
623+
processCompletedSyncWriteQueue();
625624

626625
return ENGINE_SUCCESS;
627626
}
@@ -640,7 +639,7 @@ void ActiveDurabilityMonitor::processTimeout(
640639
// the correct locks).
641640
state.wlock()->removeExpired(asOf, *resolvedQueue);
642641

643-
checkForResolvedSyncWrites();
642+
processCompletedSyncWriteQueue();
644643
}
645644

646645
void ActiveDurabilityMonitor::notifyLocalPersistence() {
@@ -729,13 +728,6 @@ void ActiveDurabilityMonitor::addStatsForChain(
729728
}
730729
}
731730

732-
void ActiveDurabilityMonitor::checkForResolvedSyncWrites() {
733-
if (resolvedQueue->empty()) {
734-
return;
735-
}
736-
vb.notifySyncWritesPendingCompletion();
737-
}
738-
739731
void ActiveDurabilityMonitor::processCompletedSyncWriteQueue() {
740732
std::lock_guard<ResolvedQueue::ConsumerLock> lock(
741733
resolvedQueue->getConsumerLock());
@@ -1680,7 +1672,11 @@ void ActiveDurabilityMonitor::checkForCommit() {
16801672
// the resolvedQueue (under the correct locks).
16811673
state.wlock()->updateHighPreparedSeqno(*resolvedQueue);
16821674

1683-
checkForResolvedSyncWrites();
1675+
// @todo: Consider to commit in a dedicated function for minimizing
1676+
// contention on front-end threads, as this function is supposed to
1677+
// execute under VBucket-level lock.
1678+
1679+
processCompletedSyncWriteQueue();
16841680
}
16851681

16861682
template <class exception>

engines/ep/src/durability/active_durability_monitor.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,6 @@ class ActiveDurabilityMonitor : public DurabilityMonitor {
282282
*/
283283
void removedQueuedAck(const std::string& node);
284284

285-
/**
286-
* For all items in the completedSWQueue, call VBucket::commit /
287-
* VBucket::abort as appropriate, then remove the item from the queue.
288-
*/
289-
void processCompletedSyncWriteQueue();
290-
291285
/**
292286
* @return all of the currently tracked writes
293287
*/
@@ -369,10 +363,10 @@ class ActiveDurabilityMonitor : public DurabilityMonitor {
369363
const ReplicationChain& chain) const;
370364

371365
/**
372-
* Checks if the resolvedQueue contains any SyncWrites awaiting completion,
373-
* and if so notifies the VBucket.
366+
* For all items in the completedSWQueue, call VBucket::commit /
367+
* VBucket::abort as appropriate, then remove the item from the queue.
374368
*/
375-
void checkForResolvedSyncWrites();
369+
void processCompletedSyncWriteQueue();
376370

377371
// The stats object for the owning Bucket
378372
EPStats& stats;

engines/ep/src/durability/durability_completion_task.cc

Lines changed: 0 additions & 92 deletions
This file was deleted.

engines/ep/src/durability/durability_completion_task.h

Lines changed: 0 additions & 85 deletions
This file was deleted.

engines/ep/src/ep_bucket.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,6 @@ VBucketPtr EPBucket::makeVBucket(
11381138
std::move(table),
11391139
flusherCb,
11401140
std::move(newSeqnoCb),
1141-
makeSyncWriteResolvedCB(),
11421141
makeSyncWriteCompleteCB(),
11431142
makeSeqnoAckCB(),
11441143
engine.getConfiguration(),

engines/ep/src/ep_vb.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ EPVBucket::EPVBucket(Vbid i,
4747
std::unique_ptr<FailoverTable> table,
4848
std::shared_ptr<Callback<Vbid>> flusherCb,
4949
NewSeqnoCallback newSeqnoCb,
50-
SyncWriteResolvedCallback syncWriteResolvedCb,
5150
SyncWriteCompleteCallback syncWriteCb,
5251
SeqnoAckCallback seqnoAckCb,
5352
Configuration& config,
@@ -70,7 +69,6 @@ EPVBucket::EPVBucket(Vbid i,
7069
flusherCb,
7170
std::make_unique<StoredValueFactory>(st),
7271
std::move(newSeqnoCb),
73-
syncWriteResolvedCb,
7472
syncWriteCb,
7573
seqnoAckCb,
7674
config,

engines/ep/src/ep_vb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class EPVBucket : public VBucket {
3939
std::unique_ptr<FailoverTable> table,
4040
std::shared_ptr<Callback<Vbid>> flusherCb,
4141
NewSeqnoCallback newSeqnoCb,
42-
SyncWriteResolvedCallback syncWriteResolvedCb,
4342
SyncWriteCompleteCallback syncWriteCb,
4443
SeqnoAckCallback seqnoAckCb,
4544
Configuration& config,

0 commit comments

Comments
 (0)