aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2020-03-23 13:26:26 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2020-03-24 08:21:38 +0000
commita607b174decc213f482e177627cfd6b35fa4aaaa (patch)
treefae68a6207a14724c200e6e966f21c6621f1fbe5 /storage/src/tests/distributor/twophaseupdateoperationtest.cpp
parent76a82eeed23094e0f2b70b1325115b8b1e521904 (diff)
Track metrics for new inconsistent update phases
Reuses the old update-get metric for the single full Get sent after the initial metadata-only phase. Adds new metric set for the initial metadata Gets.
Diffstat (limited to 'storage/src/tests/distributor/twophaseupdateoperationtest.cpp')
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index f3ce4d92263..962ce085cb0 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -1099,6 +1099,10 @@ TEST_F(ThreePhaseUpdateTest, full_document_get_sent_to_replica_with_highest_time
ASSERT_EQ("Get => 0,Get => 1", _sender.getCommands(true));
reply_to_metadata_get(*cb, _sender, 0, 1000U);
reply_to_metadata_get(*cb, _sender, 1, 2000U);
+
+ auto& metrics = getDistributor().getMetrics().update_metadata_gets[documentapi::LoadType::DEFAULT];
+ EXPECT_EQ(1, metrics.ok.getValue()); // Technically tracks an entire operation covering multiple Gets.
+
// Node 1 has newest document version at ts=2000
ASSERT_EQ("Get => 1", _sender.getCommands(true, false, 2));
{
@@ -1116,6 +1120,9 @@ TEST_F(ThreePhaseUpdateTest, puts_are_sent_after_receiving_full_document_get) {
ASSERT_EQ("Get => 0", _sender.getCommands(true, false, 2));
replyToGet(*cb, _sender, 2, 2000U);
ASSERT_EQ("Put => 1,Put => 0", _sender.getCommands(true, false, 3));
+
+ auto& metrics = getDistributor().getMetrics().update_gets[documentapi::LoadType::DEFAULT];
+ EXPECT_EQ(1, metrics.ok.getValue());
}
TEST_F(ThreePhaseUpdateTest, consistent_meta_get_timestamps_can_restart_in_fast_path) {
@@ -1294,6 +1301,22 @@ TEST_F(ThreePhaseUpdateTest, single_get_mbus_trace_is_propagated_to_reply) {
ASSERT_THAT(trace, HasSubstr("it is me, Leclerc! *lifts glasses*"));
}
+TEST_F(ThreePhaseUpdateTest, single_full_get_reply_received_after_close_is_no_op) {
+ auto cb = set_up_2_inconsistent_replicas_and_start_update();
+ ASSERT_EQ("Get => 0,Get => 1", _sender.getCommands(true));
+ reply_to_metadata_get(*cb, _sender, 0, 0U);
+ reply_to_metadata_get(*cb, _sender, 1, 1000U);
+ ASSERT_EQ("Get => 1", _sender.getCommands(true, false, 2));
+ cb->onClose(_sender);
+ ASSERT_EQ("Update Reply", _sender.getLastReply(false));
+ // Operation closed prior to receiving Get. Note that we should not really get
+ // into this situation since the owner of the operation itself should clear
+ // any mappings associating the reply with the operation, but ensure we handle
+ // it gracefully anyway.
+ replyToGet(*cb, _sender, 2, 2000U);
+ ASSERT_EQ("", _sender.getCommands(true, false, 3)); // Nothing new sent.
+}
+
// XXX currently differs in behavior from content nodes in that updates for
// document IDs without explicit doctypes will _not_ be auto-failed on the
// distributor.