aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Borzenkov <snaury@gmail.com>2022-07-05 21:00:43 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2022-07-05 21:00:43 +0300
commit04748982190fa2dec3f2d942e003f24f47c3115e (patch)
tree30a1076b2bb0ba243f22fc4491fb827d9d7fe6d0
parent4e3d96f9fb84fe7703a0c2107a3c8f44f9ccf748 (diff)
downloadydb-04748982190fa2dec3f2d942e003f24f47c3115e.tar.gz
22-2: Reply ALREADY to TEvBlock races, don't hide errors by retrying blocking, KIKIMR-15235
Merge from trunk: r9662422 REVIEW: 2695485 x-ydb-stable-ref: 8bd7b98b3b008990ac0cd4adb76f30a51bbc2014
-rw-r--r--ydb/core/blobstorage/dsproxy/dsproxy_block.cpp4
-rw-r--r--ydb/core/blobstorage/dsproxy/mock/model.h2
-rw-r--r--ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp4
-rw-r--r--ydb/core/blobstorage/testload/test_load_write.cpp4
-rw-r--r--ydb/core/mind/hive/tx__block_storage_result.cpp1
-rw-r--r--ydb/core/tablet/tablet_req_blockbs.cpp11
6 files changed, 10 insertions, 16 deletions
diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_block.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_block.cpp
index dba0a2fd43..fdfd95b37a 100644
--- a/ydb/core/blobstorage/dsproxy/dsproxy_block.cpp
+++ b/ydb/core/blobstorage/dsproxy/dsproxy_block.cpp
@@ -59,7 +59,7 @@ class TBlobStorageGroupBlockRequest : public TBlobStorageGroupRequestActor<TBlob
std::vector<TVDiskID> queryStatus, resend;
if (status == NKikimrProto::ALREADY) {
// ALREADY means that newly arrived Block is the same or older than existing one; we treat it as ERROR here
- // and reply with RACE only when no quorum could be obtained during the whole operation
+ // and reply with ALREADY only when no quorum could be obtained during the whole operation
SeenAlready = true;
status = NKikimrProto::ERROR;
}
@@ -74,7 +74,7 @@ class TBlobStorageGroupBlockRequest : public TBlobStorageGroupRequestActor<TBlob
case NKikimrProto::ERROR: {
TStringStream err;
- newStatus = SeenAlready ? NKikimrProto::RACE : NKikimrProto::ERROR;
+ newStatus = SeenAlready ? NKikimrProto::ALREADY : NKikimrProto::ERROR;
err << "Status# " << NKikimrProto::EReplyStatus_Name(newStatus)
<< " From# " << vdisk.ToString()
<< " NodeId# " << Info->GetActorId(vdisk).NodeId()
diff --git a/ydb/core/blobstorage/dsproxy/mock/model.h b/ydb/core/blobstorage/dsproxy/mock/model.h
index 6161a6b857..f8a7f78d4a 100644
--- a/ydb/core/blobstorage/dsproxy/mock/model.h
+++ b/ydb/core/blobstorage/dsproxy/mock/model.h
@@ -137,7 +137,7 @@ namespace NFake {
if (it == Blocks.end()) {
Blocks.emplace(msg->TabletId, msg->Generation);
} else if (msg->Generation <= it->second) {
- status = NKikimrProto::RACE;
+ status = NKikimrProto::ALREADY;
} else {
it->second = msg->Generation;
}
diff --git a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
index e3c74cce7b..aa9ab4027e 100644
--- a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
+++ b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
@@ -461,8 +461,8 @@ Y_UNIT_TEST_SUITE(TBlobStorageWardenTest) {
ui64 tabletId = 1234;
ui32 generation = 1;
BlockGroup(runtime, sender0, tabletId, groupId, generation, true);
- BlockGroup(runtime, sender0, tabletId, groupId, generation, true, NKikimrProto::EReplyStatus::RACE);
- BlockGroup(runtime, sender0, tabletId, groupId, generation-1, true, NKikimrProto::EReplyStatus::RACE);
+ BlockGroup(runtime, sender0, tabletId, groupId, generation, true, NKikimrProto::EReplyStatus::ALREADY);
+ BlockGroup(runtime, sender0, tabletId, groupId, generation-1, true, NKikimrProto::EReplyStatus::ALREADY);
auto describePool = DescribeStoragePool(runtime, DOMAIN_ID, "test_storage");
{
diff --git a/ydb/core/blobstorage/testload/test_load_write.cpp b/ydb/core/blobstorage/testload/test_load_write.cpp
index d30f9d4a31..a7ac7823e8 100644
--- a/ydb/core/blobstorage/testload/test_load_write.cpp
+++ b/ydb/core/blobstorage/testload/test_load_write.cpp
@@ -271,9 +271,9 @@ class TLogWriterTestLoadActor : public TActorBootstrapped<TLogWriterTestLoadActo
auto callback = [this] (IEventBase *event, const TActorContext& ctx) {
auto *res = dynamic_cast<TEvBlobStorage::TEvBlockResult *>(event);
Y_VERIFY(res);
- if (!CheckStatus(ctx, res, {NKikimrProto::EReplyStatus::OK, NKikimrProto::EReplyStatus::RACE})) {
+ if (!CheckStatus(ctx, res, {NKikimrProto::EReplyStatus::OK, NKikimrProto::EReplyStatus::ALREADY})) {
return;
- } else if (res->Status == NKikimrProto::EReplyStatus::RACE && GroupBlockRetries-- > 0) {
+ } else if (res->Status == NKikimrProto::EReplyStatus::ALREADY && GroupBlockRetries-- > 0) {
LOG_INFO_S(ctx, NKikimrServices::BS_LOAD_TEST, PrintMe() << " recieved " << res->ToString());
IssueTEvBlock(ctx);
return;
diff --git a/ydb/core/mind/hive/tx__block_storage_result.cpp b/ydb/core/mind/hive/tx__block_storage_result.cpp
index 28315ec93b..ee2cfe8763 100644
--- a/ydb/core/mind/hive/tx__block_storage_result.cpp
+++ b/ydb/core/mind/hive/tx__block_storage_result.cpp
@@ -41,6 +41,7 @@ public:
TLeaderTabletInfo* tablet = Self->FindTabletEvenInDeleting(TabletId);
if (tablet != nullptr) {
if (msg->Status == NKikimrProto::OK
+ || msg->Status == NKikimrProto::ALREADY
|| msg->Status == NKikimrProto::RACE
|| msg->Status == NKikimrProto::BLOCKED
|| msg->Status == NKikimrProto::NO_GROUP) {
diff --git a/ydb/core/tablet/tablet_req_blockbs.cpp b/ydb/core/tablet/tablet_req_blockbs.cpp
index 7e2e94ec95..481ca9fc6c 100644
--- a/ydb/core/tablet/tablet_req_blockbs.cpp
+++ b/ydb/core/tablet/tablet_req_blockbs.cpp
@@ -5,14 +5,11 @@
namespace NKikimr {
-constexpr ui32 MAX_ATTEMPTS = 3;
-
class TTabletReqBlockBlobStorageGroup : public TActorBootstrapped<TTabletReqBlockBlobStorageGroup> {
const TActorId Owner;
const ui64 TabletId;
const ui32 GroupId;
const ui32 Generation;
- ui32 ErrorCount;
void ReplyAndDie(NKikimrProto::EReplyStatus status, const TString &reason = { }) {
Send(Owner, new TEvTabletBase::TEvBlockBlobStorageResult(status, TabletId, reason));
@@ -36,17 +33,14 @@ class TTabletReqBlockBlobStorageGroup : public TActorBootstrapped<TTabletReqBloc
switch (msg->Status) {
case NKikimrProto::OK:
return ReplyAndDie(NKikimrProto::OK);
+ case NKikimrProto::ALREADY:
case NKikimrProto::BLOCKED:
case NKikimrProto::RACE:
case NKikimrProto::NO_GROUP:
// The request will never succeed
return ReplyAndDie(msg->Status, msg->ErrorReason);
default:
- ++ErrorCount;
- if (ErrorCount >= MAX_ATTEMPTS) {
- return ReplyAndDie(NKikimrProto::ERROR, msg->ErrorReason);
- }
- return SendRequest();
+ return ReplyAndDie(NKikimrProto::ERROR, msg->ErrorReason);
}
}
@@ -74,7 +68,6 @@ public:
, TabletId(tabletId)
, GroupId(groupId)
, Generation(gen)
- , ErrorCount(0)
{}
};