Skip to content

Commit d3bbdcc

Browse files
jimwwalkerpaolococchi
authored andcommitted
MB-71134: Close DCP consumer stream after test
Suspect intermitent failure is due to a race with previous test state. Noted in logs when test fails a WARNING "Failing to add passive stream, as one already exists for the vbucket" Then a disconnect is sent and test fails. Change-Id: I73102d9410d6838f57a8faff96818ce3c554caed Reviewed-on: https://review.couchbase.org/c/kv_engine/+/244899 Reviewed-by: Paolo Cocchi <paolo.cocchi@couchbase.com> Reviewed-by: Trond Norbye <trond.norbye@couchbase.com> Tested-by: Build Bot <build@couchbase.com>
1 parent fc075e1 commit d3bbdcc

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

protocol/connection/client_connection.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,12 @@ void MemcachedConnection::dcpAddStream(Vbid vbid,
21672167
sendCommand(BinprotDcpAddStreamCommand{flags, vbid});
21682168
}
21692169

2170+
void MemcachedConnection::dcpCloseStream(Vbid vbid) {
2171+
BinprotGenericCommand cmd{cb::mcbp::ClientOpcode::DcpCloseStream};
2172+
cmd.setVBucket(vbid);
2173+
sendCommand(cmd);
2174+
}
2175+
21702176
void MemcachedConnection::dcpStreamRequestResponse(
21712177
uint32_t opaque,
21722178
const std::vector<std::pair<uint64_t, uint64_t>>& failovers) {

protocol/connection/client_connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,9 @@ class MemcachedConnection {
11261126
uint64_t snapEnd,
11271127
const nlohmann::json& value);
11281128

1129+
/// Send a DcpCloseStream command for the given vbucket on this connection.
1130+
void dcpCloseStream(Vbid vbid);
1131+
11291132
/* following dcp functions are for working with a consumer */
11301133
void dcpAddStream(Vbid vbid, cb::mcbp::DcpAddStreamFlag flags = {});
11311134

tests/testapp/testapp_dcp_consumer.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ class DcpConsumerAckTest
8686
fullEviction = evictionPolicy == "full_eviction";
8787
}
8888

89+
void TearDown() override {
90+
conn->dcpCloseStream(Vbid(0));
91+
TestappTest::TearDown();
92+
}
93+
8994
void setupConsumer(
9095
std::string_view name,
9196
const std::vector<std::pair<std::string, std::string>>& controls) {

0 commit comments

Comments
 (0)