@@ -4557,7 +4557,8 @@ TEST_P(DurabilityPassiveStreamPersistentTest, BufferDcpAbort) {
45574557// during a replica->active state change provided that operations are buffered.
45584558// The fix was to put strong VBucket state checks in the PassiveStream commit
45594559// path.
4560- TEST_P (DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedCommit) {
4560+ void DurabilityPassiveStreamPersistentTest::replicaToActiveBufferedResolution (
4561+ bool resolutionIsCommit) {
45614562 // Begin by pushing a mutation. Only to get away from seqno:0
45624563 auto key = makeStoredDocKey (" key" );
45634564 EXPECT_EQ (cb::engine_errc::success,
@@ -4584,11 +4585,16 @@ TEST_P(DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedCommit) {
45844585
45854586 auto vb = engine->getVBucket (vbid);
45864587
4587- // Buffer the commit of the prepare
4588+ // Buffer the commit/abort of the prepare
45884589 EXPECT_EQ (cb::engine_errc::success,
45894590 snapshot (*consumer, stream->getOpaque (), 3 , 3 ));
4590- EXPECT_EQ (cb::engine_errc::success,
4591- commit (*consumer, stream->getOpaque (), durableKey, 2 , 3 ));
4591+ if (resolutionIsCommit) {
4592+ EXPECT_EQ (cb::engine_errc::success,
4593+ commit (*consumer, stream->getOpaque (), durableKey, 2 , 3 ));
4594+ } else {
4595+ EXPECT_EQ (cb::engine_errc::success,
4596+ abort (*consumer, stream->getOpaque (), durableKey, 2 , 3 ));
4597+ }
45924598 EXPECT_EQ (2 , vb->getHighSeqno ());
45934599
45944600 std::function<void ()> hook = [this ]() {
@@ -4601,16 +4607,16 @@ TEST_P(DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedCommit) {
46014607 };
46024608 stream->setProcessBufferedMessages_postFront_Hook (hook);
46034609
4604- // And process the buffered commit . This commit should be rejected. Prior
4605- // to the fix it would be processed against the active.
4610+ // And process the buffered resolution . This operation should be rejected.
4611+ // Prior to the fix it would be processed against the active.
46064612 stats.replicationThrottleThreshold = 99 ;
46074613 engine->setMaxDataSize (size);
46084614 ASSERT_EQ (ReplicationThrottle::Status::Process,
46094615 engine->getReplicationThrottle ().getStatus ());
46104616 EXPECT_EQ (more_to_process, consumer->processBufferedItems ());
46114617 EXPECT_EQ (all_processed, consumer->processBufferedItems ());
46124618
4613- // Before fixing high-seqno would be at 3 (commit)
4619+ // Before fixing high-seqno would be at 3 (commit/abort )
46144620 EXPECT_EQ (2 , vb->getHighSeqno ());
46154621
46164622 setVBucketState (
@@ -4628,6 +4634,7 @@ TEST_P(DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedCommit) {
46284634
46294635 // And fail. With MB-59518 an error is logged about a failure to find the
46304636 // prepare, this function would throw because the commit is not successful
4637+ // Note the abort case would fail here in the same way as commit
46314638 try {
46324639 vb->processResolvedSyncWrites ();
46334640 } catch (const std::exception& e) {
@@ -4637,6 +4644,14 @@ TEST_P(DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedCommit) {
46374644 flushVBucketToDiskIfPersistent (vbid);
46384645}
46394646
4647+ TEST_P (DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedCommit) {
4648+ replicaToActiveBufferedResolution (true );
4649+ }
4650+
4651+ TEST_P (DurabilityPassiveStreamPersistentTest, ReplicaToActiveBufferedAbort) {
4652+ replicaToActiveBufferedResolution (false );
4653+ }
4654+
46404655void DurabilityPromotionStreamTest::SetUp () {
46414656 // Set up as a replica
46424657 DurabilityPassiveStreamTest::SetUp ();
0 commit comments