From 73502ab0ce83a5e08acb1e49f171555307031e1f Mon Sep 17 00:00:00 2001 From: Sergei Politov Date: Thu, 5 Apr 2018 21:56:54 +0300 Subject: [PATCH] ENG-3130: Remove RaftConsensusITest.TestEarlyCommitDespiteMemoryPressure Summary: Remove RaftConsensusITest.TestEarlyCommitDespiteMemoryPressure as discussed with @mikhail. This test currently is not suitable for us. It tests that previously added entry could be committed on ConsensusUpdate. But we have a lot of caches etc. that does not support garbage collection and would not release memory. So it is very tight bound when one could add entries initially, but could not add them later. Usually both calls fails or succeeds for us. Test Plan: Jenkins Reviewers: mikhail, bharat Reviewed By: bharat Subscribers: mikhail, ybase, bharat Differential Revision: https://phabricator.dev.yugabyte.com/D4554 --- .../integration-tests/raft_consensus-itest.cc | 83 ------------------- 1 file changed, 83 deletions(-) diff --git a/src/yb/integration-tests/raft_consensus-itest.cc b/src/yb/integration-tests/raft_consensus-itest.cc index 33d017b5edfd..bbb3afc2b268 100644 --- a/src/yb/integration-tests/raft_consensus-itest.cc +++ b/src/yb/integration-tests/raft_consensus-itest.cc @@ -2295,89 +2295,6 @@ TEST_F(RaftConsensusITest, TestMasterNotifiedOnConfigChange) { LOG(INFO) << "Tablet locations:\n" << tablet_locations.DebugString(); } -// Test that even with memory pressure, a replica will still commit pending -// operations that the leader has committed. -TEST_F(RaftConsensusITest, TestEarlyCommitDespiteMemoryPressure) { - // Enough operations to put us over our memory limit (defined below). - const int kNumOps = 10000; - - // Set up a 3-node configuration with only one live follower so that we can - // manipulate it directly via RPC. - vector ts_flags, master_flags; - - // If failure detection were on, a follower could be elected as leader after - // we kill the leader below. - ts_flags.push_back("--enable_leader_failure_detection=false"); - master_flags.push_back("--catalog_manager_wait_for_new_tablets_to_elect_leader=false"); - - // Very low memory limit to ease testing. - ts_flags.push_back(Format("--inbound_rpc_block_size=$0", 64_KB)); - ts_flags.push_back(Format("--outbound_rpc_block_size=$0", 64_KB)); - ts_flags.push_back(Format("--memory_limit_hard_bytes=$0", 25_MB)); - - // Don't let transaction memory tracking get in the way. - ts_flags.push_back("--tablet_operation_memory_limit_mb=-1"); - - ASSERT_NO_FATALS(BuildAndStart(ts_flags, master_flags)); - - // Elect server 2 as leader, then kill it and server 1, leaving behind - // server 0 as the sole follower. - vector tservers = TServerDetailsVector(tablet_servers_); - ASSERT_EQ(3, tservers.size()); - ASSERT_OK(StartElection(tservers[2], tablet_id_, MonoDelta::FromSeconds(10))); - ASSERT_OK(WaitForServersToAgree(MonoDelta::FromSeconds(10), tablet_servers_, tablet_id_, 1)); - TServerDetails *replica_ts = tservers[0]; - cluster_->tablet_server_by_uuid(tservers[1]->uuid())->Shutdown(); - cluster_->tablet_server_by_uuid(tservers[2]->uuid())->Shutdown(); - - // Pretend to be the leader and send a request to replicate some operations. - ConsensusRequestPB req; - ConsensusResponsePB resp; - RpcController rpc; - req.set_dest_uuid(replica_ts->uuid()); - req.set_tablet_id(tablet_id_); - req.set_caller_uuid(tservers[2]->instance_id.permanent_uuid()); - req.set_caller_term(1); - req.mutable_committed_index()->CopyFrom(MakeOpId(1, 1)); - req.mutable_preceding_id()->CopyFrom(MakeOpId(1, 1)); - for (int i = 0; i < kNumOps; i++) { - AddOp(MakeOpId(1, 2 + i), &req); - } - OpId last_opid = MakeOpId(1, 2 + kNumOps - 1); - ASSERT_OK(replica_ts->consensus_proxy->UpdateConsensus(req, &resp, &rpc)); - - // At the time that the follower received our request it was still under the - // tiny memory limit defined above, so the request should have succeeded. - ASSERT_FALSE(resp.has_error()) << resp.DebugString(); - ASSERT_TRUE(resp.has_status()); - ASSERT_TRUE(resp.status().has_last_committed_idx()); - ASSERT_EQ(last_opid.index(), resp.status().last_received().index()); - ASSERT_EQ(1, resp.status().last_committed_idx()); - - // But no operations have been applied yet; there should be no data. - vector rows; - WaitForRowCount(replica_ts->tserver_proxy.get(), 0, &rows); - - // Try again, but this time: - // 1. Replicate just one new operation. - // 2. Tell the follower that the previous set of operations were committed. - req.mutable_preceding_id()->CopyFrom(last_opid); - req.mutable_committed_index()->CopyFrom(last_opid); - req.mutable_ops()->Clear(); - AddOp(MakeOpId(1, last_opid.index() + 1), &req); - rpc.Reset(); - Status s = replica_ts->consensus_proxy->UpdateConsensus(req, &resp, &rpc); - - // Our memory limit was truly tiny, so we should be over it by now... - LOG(INFO) << "UpdateConsensus status: " << s; - ASSERT_TRUE(s.IsRemoteError()); - ASSERT_STR_CONTAINS(s.ToString(), "Soft memory limit exceeded"); - - // ...but despite rejecting the request, we should have committed the - // previous set of operations. That is, we should be able to see those rows. - WaitForRowCount(replica_ts->tserver_proxy.get(), kNumOps, &rows); -} - // Test that we can create (vivify) a new tablet via remote bootstrap. TEST_F(RaftConsensusITest, TestAutoCreateReplica) { FLAGS_num_tablet_servers = 3;