@@ -1340,35 +1340,6 @@ TEST_P(ConnectionTest, test_mb17042_duplicate_name_consumer_connections) {
13401340 << " Dead connections still remain" ;
13411341}
13421342
1343- TEST_P (ConnectionTest, test_mb17042_duplicate_cookie_producer_connections) {
1344- MockDcpConnMap connMap (*engine);
1345- connMap.initialize ();
1346- auto * cookie = create_mock_cookie (engine);
1347- // Create a new Dcp producer
1348- DcpProducer* producer = connMap.newProducer (cookie,
1349- " test_producer1" ,
1350- /* flags*/ 0 );
1351-
1352- // Create a duplicate Dcp producer
1353- DcpProducer* duplicateproducer = connMap.newProducer (cookie,
1354- " test_producer2" ,
1355- /* flags*/ 0 );
1356-
1357- EXPECT_TRUE (producer->doDisconnect ()) << " producer doDisconnect == false" ;
1358- EXPECT_EQ (nullptr , duplicateproducer) << " duplicateproducer is not null" ;
1359-
1360- // Disconnect the producer connection
1361- connMap.disconnect (cookie);
1362- // Cleanup the deadConnections
1363- connMap.manageConnections ();
1364- // Should be zero deadConnections
1365- EXPECT_EQ (0 , connMap.getNumberOfDeadConnections ())
1366- << " Dead connections still remain" ;
1367- }
1368-
1369-
1370-
1371-
13721343TEST_P (ConnectionTest, test_producer_unknown_ctrl_msg) {
13731344 auto * cookie = create_mock_cookie (engine);
13741345 /* Create a new Dcp producer */
@@ -1386,28 +1357,6 @@ TEST_P(ConnectionTest, test_producer_unknown_ctrl_msg) {
13861357 destroy_mock_cookie (cookie);
13871358}
13881359
1389- TEST_P (ConnectionTest, test_mb17042_duplicate_cookie_consumer_connections) {
1390- MockDcpConnMap connMap (*engine);
1391- connMap.initialize ();
1392- auto * cookie = create_mock_cookie (engine);
1393- // Create a new Dcp consumer
1394- DcpConsumer* consumer = connMap.newConsumer (cookie, " test_consumer1" );
1395-
1396- // Create a duplicate Dcp consumer
1397- DcpConsumer* duplicateconsumer =
1398- connMap.newConsumer (cookie, " test_consumer2" );
1399- EXPECT_TRUE (consumer->doDisconnect ()) << " consumer doDisconnect == false" ;
1400- EXPECT_EQ (nullptr , duplicateconsumer) << " duplicateconsumer is not null" ;
1401-
1402- // Disconnect the consumer connection
1403- connMap.disconnect (cookie);
1404- // Cleanup the deadConnections
1405- connMap.manageConnections ();
1406- // Should be zero deadConnections
1407- EXPECT_EQ (0 , connMap.getNumberOfDeadConnections ())
1408- << " Dead connections still remain" ;
1409- }
1410-
14111360TEST_P (ConnectionTest, test_update_of_last_message_time_in_consumer) {
14121361 auto * cookie = create_mock_cookie (engine);
14131362 Vbid vbid (0 );
@@ -1774,12 +1723,12 @@ class DcpConnMapTest : public ::testing::Test {
17741723 * MB-36915: With a recent change, we unconditionally acquire an exclusive
17751724 * lock to vbstate in KVBucket::setVBucketState. But, the new lock
17761725 * introduces a potential deadlock by lock-inversion on connLock and
1777- * vbstateLock in EPE::dcpOpen if a connection with the same cookie or name
1726+ * vbstateLock in EPE::dcpOpen if a connection with the same name
17781727 * already exists in conn-map. TSAN easily spots the issue as soon as we
17791728 * have an execution where two threads run in parallel and execute the code
17801729 * responsible for the potential deadlock, which is what this test achieves.
17811730 */
1782- void testLockInversionInSetVBucketStateAndNewProducer (ConnExistsBy by );
1731+ void testLockInversionInSetVBucketStateAndNewProducer ();
17831732
17841733 SynchronousEPEngineUniquePtr engine;
17851734 const Vbid vbid = Vbid(0 );
@@ -2227,8 +2176,7 @@ TEST_F(DcpConnMapTest, ConnAggStats) {
22272176 destroy_mock_cookie (statsCookie);
22282177}
22292178
2230- void DcpConnMapTest::testLockInversionInSetVBucketStateAndNewProducer (
2231- ConnExistsBy by) {
2179+ void DcpConnMapTest::testLockInversionInSetVBucketStateAndNewProducer () {
22322180 auto & connMap = dynamic_cast <MockDcpConnMap&>(engine->getDcpConnMap ());
22332181 auto * cookie = create_mock_cookie (engine.get ());
22342182 const std::string connName = " producer" ;
@@ -2277,28 +2225,15 @@ void DcpConnMapTest::testLockInversionInSetVBucketStateAndNewProducer(
22772225 // Note: ActiveStream::setDead executed only if re-creating the same
22782226 // connection (ie, same cookie or connection name).
22792227 auto * cookie2 = create_mock_cookie (engine.get ());
2280- switch (by) {
2281- case ConnExistsBy::Cookie: {
2282- const std::string newConnName = " newName" ;
2283- EXPECT_FALSE (connMap.newProducer (cookie, newConnName, flags));
2284- // Note: Connection flagged as disconnected but not yet removed
2285- // from conn-map. See comments in ConnMap::newProducer.
2286- EXPECT_TRUE (connMap.doesVbConnExist (vbid, " eq_dcpq:" + connName));
2287- break ;
2288- }
2289- case ConnExistsBy ::Name: {
2290- producer = connMap.newProducer (cookie2, connName, flags);
2291- ASSERT_TRUE (producer);
2292- // Check that the connection has been re-created with the same name
2293- // and exists in vbConns at stream-req
2294- {
2295- SCOPED_TRACE (" " );
2296- streamRequest (*producer);
2297- }
2298- EXPECT_TRUE (connMap.doesVbConnExist (vbid, " eq_dcpq:" + connName));
2299- break ;
2300- }
2228+ producer = connMap.newProducer (cookie2, connName, flags);
2229+ ASSERT_TRUE (producer);
2230+ // Check that the connection has been re-created with the same name
2231+ // and exists in vbConns at stream-req
2232+ {
2233+ SCOPED_TRACE (" " );
2234+ streamRequest (*producer);
23012235 }
2236+ EXPECT_TRUE (connMap.doesVbConnExist (vbid, " eq_dcpq:" + connName));
23022237
23032238 t1.join ();
23042239
@@ -2308,14 +2243,9 @@ void DcpConnMapTest::testLockInversionInSetVBucketStateAndNewProducer(
23082243 destroy_mock_cookie (cookie2);
23092244}
23102245
2311- TEST_F (DcpConnMapTest,
2312- AvoidLockInversionInSetVBucketStateAndNewProducerExistingCookie) {
2313- testLockInversionInSetVBucketStateAndNewProducer (ConnExistsBy::Cookie);
2314- }
2315-
23162246TEST_F (DcpConnMapTest,
23172247 AvoidLockInversionInSetVBucketStateAndNewProducerExistingName) {
2318- testLockInversionInSetVBucketStateAndNewProducer (ConnExistsBy::Name );
2248+ testLockInversionInSetVBucketStateAndNewProducer ();
23192249}
23202250
23212251class NotifyTest : public DCPTest {
0 commit comments