@@ -1248,6 +1248,23 @@ TEST_P(StreamTest, backfillGetsNoItems) {
12481248 }
12491249}
12501250
1251+ TEST_P (StreamTest, bufferedMemoryBackfillPurgeGreaterThanStart) {
1252+ if (engine->getConfiguration ().getBucketType () == " ephemeral" ) {
1253+ setup_dcp_stream (0 , IncludeValue::No, IncludeXattrs::No);
1254+ auto evb = std::shared_ptr<EphemeralVBucket>(
1255+ std::dynamic_pointer_cast<EphemeralVBucket>(vb0));
1256+
1257+ // Force the purgeSeqno because it's easier than creating and
1258+ // deleting items
1259+ evb->setPurgeSeqno (3 );
1260+
1261+ // Backfill with start != 1 and start != end and start < purge
1262+ DCPBackfillMemoryBuffered dcpbfm (evb, stream, 2 , 4 );
1263+ dcpbfm.run ();
1264+ EXPECT_TRUE (stream->isDead ());
1265+ }
1266+ }
1267+
12511268/* Regression test for MB-17766 - ensure that when an ActiveStream is preparing
12521269 * queued items to be sent out via a DCP consumer, that nextCheckpointItem()
12531270 * doesn't incorrectly return false (meaning that there are no more checkpoint
@@ -3086,28 +3103,25 @@ TEST_P(ConnectionTest, test_mb24424_deleteResponse) {
30863103 ASSERT_TRUE (stream->isActive ());
30873104
30883105 std::string key = " key" ;
3089- std::string data = R"( {"json":"yes"})" ;
30903106 const DocKey docKey{reinterpret_cast <const uint8_t *>(key.data ()),
30913107 key.size (),
30923108 DocKeyEncodesCollectionId::No};
3093- cb::const_byte_buffer value{reinterpret_cast <const uint8_t *>(data.data ()),
3094- data.size ()};
30953109 uint8_t extMeta[1 ] = {uint8_t (PROTOCOL_BINARY_DATATYPE_JSON)};
30963110 cb::const_byte_buffer meta{extMeta, sizeof (uint8_t )};
30973111
3098- consumer->deletion (/* opaque*/ 1 ,
3099- /* key*/ docKey,
3100- /* values */ value ,
3101- /* priv_bytes*/ 0 ,
3102- /* datatype*/ PROTOCOL_BINARY_DATATYPE_JSON ,
3103- /* cas*/ 0 ,
3104- /* vbucket*/ vbid,
3105- /* bySeqno*/ 1 ,
3106- /* revSeqno*/ 0 ,
3107- /* meta*/ meta);
3108-
3109- auto messageSize = MutationResponse::deletionBaseMsgBytes +
3110- key. size () + data. size () + sizeof (extMeta);
3112+ consumer->deletion (/* opaque*/ 1 ,
3113+ /* key*/ docKey,
3114+ /* value */ {} ,
3115+ /* priv_bytes*/ 0 ,
3116+ /* datatype*/ PROTOCOL_BINARY_RAW_BYTES ,
3117+ /* cas*/ 0 ,
3118+ /* vbucket*/ vbid,
3119+ /* bySeqno*/ 1 ,
3120+ /* revSeqno*/ 0 ,
3121+ /* meta*/ meta);
3122+
3123+ auto messageSize = MutationResponse::deletionBaseMsgBytes + key. size () +
3124+ sizeof (extMeta);
31113125
31123126 EXPECT_EQ (messageSize, stream->responseMessageSize );
31133127
0 commit comments