diff options
author | Tor Brede Vekterli <vekterli@oath.com> | 2018-01-30 12:37:39 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@oath.com> | 2018-01-30 12:37:39 +0000 |
commit | 23d1c81595df4335dbd2c6732780c671663894f1 (patch) | |
tree | 872e47f7f80757c57e2f58374821e2b1d25c3103 /storage/src | |
parent | 3c0eb51abccc00f6710d35c7768db8b23c8b5840 (diff) |
Use a non-transient error code for clock skew rejections
Using REJECTED instead of ABORTED fails the message all the way out to the
caller immediately instead of hiding the (likely not automatically fixed)
problems behind retries and timeouts.
Diffstat (limited to 'storage/src')
-rw-r--r-- | storage/src/tests/storageserver/bouncertest.cpp | 2 | ||||
-rw-r--r-- | storage/src/vespa/storage/storageserver/bouncer.cpp | 8 | ||||
-rw-r--r-- | storage/src/vespa/storage/storageserver/bouncer.h | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index a4f7ed915d8..43683132bc9 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -131,7 +131,7 @@ BouncerTest::testFutureTimestamp() CPPUNIT_ASSERT_EQUAL(1, (int)_upper->getNumReplies()); CPPUNIT_ASSERT_EQUAL(0, (int)_upper->getNumCommands()); - CPPUNIT_ASSERT_EQUAL(api::ReturnCode::ABORTED, + CPPUNIT_ASSERT_EQUAL(api::ReturnCode::REJECTED, static_cast<api::RemoveReply&>(*_upper->getReply(0)). getResult().getResult()); _upper->reset(); diff --git a/storage/src/vespa/storage/storageserver/bouncer.cpp b/storage/src/vespa/storage/storageserver/bouncer.cpp index 3d068ec5f81..7648c07d7da 100644 --- a/storage/src/vespa/storage/storageserver/bouncer.cpp +++ b/storage/src/vespa/storage/storageserver/bouncer.cpp @@ -113,19 +113,19 @@ Bouncer::abortCommandForUnavailableNode(api::StorageMessage& msg, } void -Bouncer::abortCommandWithTooHighClockSkew(api::StorageMessage& msg, +Bouncer::rejectCommandWithTooHighClockSkew(api::StorageMessage& msg, int maxClockSkewInSeconds) { auto& as_cmd = dynamic_cast<api::StorageCommand&>(msg); std::ostringstream ost; ost << "Message " << msg.getType() << " is more than " << maxClockSkewInSeconds << " seconds in the future."; - LOGBP(warning, "Aborting operation from distributor %u: %s", + LOGBP(warning, "Rejecting operation from distributor %u: %s", as_cmd.getSourceIndex(), ost.str().c_str()); _metrics->clock_skew_aborts.inc(); std::shared_ptr<api::StorageReply> reply(as_cmd.makeReply().release()); - reply->setResult(api::ReturnCode(api::ReturnCode::ABORTED, ost.str())); + reply->setResult(api::ReturnCode(api::ReturnCode::REJECTED, ost.str())); sendUp(reply); } @@ -271,7 +271,7 @@ Bouncer::onDown(const std::shared_ptr<api::StorageMessage>& msg) timestamp /= 1000000; uint64_t currentTime = _component.getClock().getTimeInSeconds().getTime(); if (timestamp > currentTime + maxClockSkewInSeconds) { - abortCommandWithTooHighClockSkew(*msg, maxClockSkewInSeconds); + rejectCommandWithTooHighClockSkew(*msg, maxClockSkewInSeconds); return true; } } diff --git a/storage/src/vespa/storage/storageserver/bouncer.h b/storage/src/vespa/storage/storageserver/bouncer.h index 6c81cb1b47a..b46bf3fedc6 100644 --- a/storage/src/vespa/storage/storageserver/bouncer.h +++ b/storage/src/vespa/storage/storageserver/bouncer.h @@ -57,8 +57,8 @@ private: void abortCommandForUnavailableNode(api::StorageMessage&, const lib::State&); - void abortCommandWithTooHighClockSkew(api::StorageMessage& msg, - int maxClockSkewInSeconds); + void rejectCommandWithTooHighClockSkew(api::StorageMessage& msg, + int maxClockSkewInSeconds); void abortCommandDueToClusterDown(api::StorageMessage&); |