summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2021-01-19 16:26:10 +0000
committerGeir Storli <geirst@verizonmedia.com>2021-01-19 16:26:10 +0000
commit6b1fd48638a6ca62df76b10e5ec7672d57e5954a (patch)
treea2bf645a367756d92bfa889965b005008188910a /storage/src/tests/distributor/twophaseupdateoperationtest.cpp
parent4e6d9b184867553f740a65124fdb2d9c380caf22 (diff)
Reject two phase update operation in safe path if feed in cluster is blocked.
Diffstat (limited to 'storage/src/tests/distributor/twophaseupdateoperationtest.cpp')
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index 1518c8594aa..924678a6cd0 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -151,6 +151,12 @@ struct TwoPhaseUpdateOperationTest : Test, DistributorTestUtil {
return cb;
}
+ void set_up_distributor_with_feed_blocked_state() {
+ setup_distributor(2, 2,
+ lib::ClusterStateBundle(lib::ClusterState("distributor:1 storage:2"),
+ {}, {true, "full disk"}, false));
+ }
+
};
TwoPhaseUpdateOperationTest::TwoPhaseUpdateOperationTest() = default;
@@ -1091,6 +1097,17 @@ TEST_F(TwoPhaseUpdateOperationTest, update_gets_are_sent_with_strong_consistency
EXPECT_EQ(get_cmd.internal_read_consistency(), api::InternalReadConsistency::Strong);
}
+TEST_F(TwoPhaseUpdateOperationTest, operation_is_rejected_in_safe_path_if_feed_is_blocked) {
+ set_up_distributor_with_feed_blocked_state();
+ auto cb = sendUpdate("0=1/2/3,1=2/3/4"); // Inconsistent replicas to trigger safe path
+ cb->start(_sender, framework::MilliSecTime(0));
+
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
+ "timestamp 0, timestamp of updated doc: 0) "
+ "ReturnCode(NO_SPACE, External feed is blocked due to resource exhaustion: full disk)",
+ _sender.getLastReply(true));
+}
+
struct ThreePhaseUpdateTest : TwoPhaseUpdateOperationTest {};
TEST_F(ThreePhaseUpdateTest, metadata_only_gets_are_sent_if_3phase_update_enabled) {