diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2021-12-16 14:03:50 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2021-12-16 14:24:56 +0000 |
commit | 70f9a917e245a85da0059aabecbc1a012c30852b (patch) | |
tree | da724893c647607e6145471b115d5efce723c9cb /storage/src/tests | |
parent | 1eefb9854bcd7ca264889239b32e7fc8c8830672 (diff) |
Cover additional update failure edge cases with metrics
This change adds previously missing metric increments for test-and-set
condition failures when this happens in the context of a write-repair,
as well as adding missing wiring for the "notfound" failure metric.
The latter is incremented when an update is returned from the content
nodes having found no existing document, or when the read-phase of a
write-repair finds no document to update (and neither `create: true`
nor a TaS condition is set on the update).
Also remove some internal reply type erasure to make it more obvious
what the reply type must be.
Diffstat (limited to 'storage/src/tests')
-rw-r--r-- | storage/src/tests/distributor/twophaseupdateoperationtest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp index 5aa2a3e5662..876aa4a258c 100644 --- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp +++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp @@ -351,6 +351,9 @@ TEST_F(TwoPhaseUpdateOperationTest, simple) { EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), " "timestamp 0, timestamp of updated doc: 90) ReturnCode(NONE)", _sender.getLastReply(true)); + + EXPECT_EQ(metrics().updates.failures.notfound.getValue(), 0); + EXPECT_EQ(metrics().updates.failures.test_and_set_failed.getValue(), 0); } TEST_F(TwoPhaseUpdateOperationTest, non_existing) { @@ -361,6 +364,8 @@ TEST_F(TwoPhaseUpdateOperationTest, non_existing) { EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), " "timestamp 0, timestamp of updated doc: 0) ReturnCode(NONE)", _sender.getLastReply(true)); + + EXPECT_EQ(metrics().updates.failures.notfound.getValue(), 1); } TEST_F(TwoPhaseUpdateOperationTest, update_failed) { @@ -741,6 +746,9 @@ TEST_F(TwoPhaseUpdateOperationTest, non_existing_with_auto_create) { "timestamp 0, timestamp of updated doc: 200000000) " "ReturnCode(NONE)", _sender.getLastReply(true)); + + // "Not found" failure not counted when create: true is set, since the update itself isn't failed. + EXPECT_EQ(metrics().updates.failures.notfound.getValue(), 0); } TEST_F(TwoPhaseUpdateOperationTest, safe_path_fails_update_when_mismatching_timestamp_constraint) { @@ -863,6 +871,9 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_mismatch_fails_with_tas_ "ReturnCode(TEST_AND_SET_CONDITION_FAILED, " "Condition did not match document)", _sender.getLastReply(true)); + + EXPECT_EQ(metrics().updates.failures.notfound.getValue(), 0); + EXPECT_EQ(metrics().updates.failures.test_and_set_failed.getValue(), 1); } TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_match_sends_puts_with_updated_doc) { @@ -928,6 +939,9 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_with_missing_doc_and_no_ "ReturnCode(TEST_AND_SET_CONDITION_FAILED, " "Document did not exist)", _sender.getLastReply(true)); + + EXPECT_EQ(metrics().updates.failures.notfound.getValue(), 0); // Not counted as "not found" failure when TaS is present + EXPECT_EQ(metrics().updates.failures.test_and_set_failed.getValue(), 1); } TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_with_missing_doc_and_auto_create_sends_puts) { @@ -940,6 +954,9 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_with_missing_doc_and_aut replyToGet(*cb, _sender, 0, 100, false); replyToGet(*cb, _sender, 1, 110, false); ASSERT_EQ("Put => 1,Put => 0", _sender.getCommands(true, false, 2)); + + EXPECT_EQ(metrics().updates.failures.notfound.getValue(), 0); // Not counted as "not found" failure when we auto create + EXPECT_EQ(metrics().updates.failures.test_and_set_failed.getValue(), 0); } void |