Skip to content

Commit 4d03e6e

Browse files
jameseh96daverigby
authored andcommitted
MB-35061: Make addTakeoverStats tolerate missing stream
Calling DcpProducer::addTakeoverStats for a vb for which there is not a stream should return does_not_exist. This is the case if the StreamContainer is not present in the StreamMap, but if the StreamContainer is present but empty an exception is thrown. This was first seen causing rebalance to fail after an earlier patch for MB-35061 ensured ConnHandlers are removed when intended. Change-Id: I98f17e150543a493b51964f4d9f947b796fb9431 Reviewed-on: http://review.couchbase.org/112672 Reviewed-by: Dave Rigby <[email protected]> Tested-by: Dave Rigby <[email protected]>
1 parent 8c055ee commit 4d03e6e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

engines/ep/src/dcp/producer.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,11 +1348,18 @@ void DcpProducer::addTakeoverStats(const AddStatFn& add_stat,
13481348
"the expected Active",
13491349
vb.getId(),
13501350
stream->getStreamTypeName());
1351-
} else {
1351+
} else if (handle.size() > 1) {
13521352
throw std::logic_error(
13531353
"DcpProducer::addTakeoverStats unexpected size streams:(" +
13541354
std::to_string(handle.size()) + ") found " +
13551355
vb.getId().to_string());
1356+
} else {
1357+
// Logically, finding a StreamContainer with no stream is similar to
1358+
// not finding a StreamContainer at all, both should return does_not_exist
1359+
logger->info(
1360+
"({}) "
1361+
"DcpProducer::addTakeoverStats empty streams list found",
1362+
vb.getId());
13561363
}
13571364
} else {
13581365
logger->info(

0 commit comments

Comments
 (0)