Skip to content

Commit 1aab418

Browse files
authored
Do not retry CLIENT_UNAUTHENTICATED & CLIENT_CALL_UNIMPLEMENTED (#10465)
1 parent 3ab7dd7 commit 1aab418

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

ydb/core/tx/replication/controller/target_discoverer_ut.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <ydb/core/tx/replication/ut_helpers/test_env.h>
55
#include <ydb/core/tx/replication/ut_helpers/test_table.h>
6+
#include <ydb/core/tx/replication/ydb_proxy/ydb_proxy.h>
67

78
#include <library/cpp/testing/unittest/registar.h>
89

@@ -130,6 +131,33 @@ Y_UNIT_TEST_SUITE(TargetDiscoverer) {
130131
UNIT_ASSERT_VALUES_EQUAL(toAdd.size(), 1);
131132
UNIT_ASSERT_VALUES_EQUAL(toAdd.at(0).SrcPath, "/Root/Table");
132133
}
134+
135+
Y_UNIT_TEST(InvalidCredentials) {
136+
TEnv env;
137+
env.GetRuntime().SetLogPriority(NKikimrServices::REPLICATION_CONTROLLER, NLog::PRI_TRACE);
138+
139+
env.CreateTable("/Root", *MakeTableDescription(DummyTable()));
140+
141+
// create aux proxy
142+
NKikimrReplication::TStaticCredentials staticCreds;
143+
staticCreds.SetUser("user");
144+
staticCreds.SetPassword("password");
145+
const auto ydbProxy = env.GetRuntime().Register(CreateYdbProxy(
146+
env.GetEndpoint(), env.GetDatabase(), false /* ssl */, staticCreds));
147+
148+
env.GetRuntime().Register(CreateTargetDiscoverer(env.GetSender(), 1, ydbProxy,
149+
TVector<std::pair<TString, TString>>{
150+
{"/Root", "/Root/Replicated"},
151+
}
152+
));
153+
154+
auto ev = env.GetRuntime().GrabEdgeEvent<TEvPrivate::TEvDiscoveryTargetsResult>(env.GetSender());
155+
UNIT_ASSERT(!ev->Get()->IsSuccess());
156+
157+
const auto& failed = ev->Get()->Failed;
158+
UNIT_ASSERT_VALUES_EQUAL(failed.size(), 1);
159+
UNIT_ASSERT_VALUES_EQUAL(failed.at(0).Error.GetStatus(), NYdb::EStatus::CLIENT_UNAUTHENTICATED);
160+
}
133161
}
134162

135163
}

ydb/core/tx/replication/controller/util.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ inline auto DefaultRetryableErrors() {
3737
}
3838

3939
inline bool IsRetryableError(const NYdb::TStatus status, const TVector<NYdb::EStatus>& retryable) {
40-
return status.IsTransportError() || Find(retryable, status.GetStatus()) != retryable.end();
40+
switch (status.GetStatus()) {
41+
case NYdb::EStatus::CLIENT_UNAUTHENTICATED:
42+
case NYdb::EStatus::CLIENT_CALL_UNIMPLEMENTED:
43+
return false;
44+
default:
45+
return status.IsTransportError() || Find(retryable, status.GetStatus()) != retryable.end();
46+
}
4147
}
4248

4349
inline bool IsRetryableError(const NYdb::TStatus status) {

0 commit comments

Comments
 (0)