Skip to content

Commit 4a6f92d

Browse files
committed
Stopping transfer and async replication if connection_string is bad (#18943)
1 parent d6d0e6b commit 4a6f92d

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed

ydb/core/transfer/transfer_writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ class TTransferWriter
781781
}
782782

783783
void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev) {
784-
LOG_E("Handle TEvTxUserProxy::TEvUploadRowsResponse"
784+
LOG_D("Handle TEvTxUserProxy::TEvUploadRowsResponse"
785785
<< ": worker# " << Worker
786786
<< " status# " << ev->Get()->Status
787787
<< " issues# " << ev->Get()->Issues.ToOneLineString());

ydb/core/transfer/ut/functional/transfer_ut.cpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,83 @@ Y_UNIT_TEST_SUITE(Transfer)
2222
testCase.DropTopic();
2323
}
2424

25+
Y_UNIT_TEST(ConnectionString_BadChar)
26+
{
27+
MainTestCase testCase;
28+
29+
testCase.CreateTable(R"(
30+
CREATE TABLE `%s` (
31+
Key Uint64 NOT NULL,
32+
Message Utf8,
33+
PRIMARY KEY (Key)
34+
) WITH (
35+
STORE = COLUMN
36+
);
37+
)");
38+
testCase.CreateTopic(1);
39+
testCase.ExecuteDDL(Sprintf(R"(
40+
$l = ($x) -> {
41+
return [
42+
<|
43+
Key: 1,
44+
Message:CAST("Message-1" AS Utf8)
45+
|>
46+
];
47+
};
48+
49+
CREATE TRANSFER %s
50+
FROM %s TO %s USING $l
51+
WITH (
52+
CONNECTION_STRING = "grp§c://localhost:2135"
53+
)
54+
)", testCase.TransferName.data(), testCase.TopicName.data(), testCase.TableName.data()));
55+
56+
testCase.CheckTransferStateError("DNS resolution failed for grp§c://localhost:2135");
57+
58+
testCase.DropTransfer();
59+
testCase.DropTable();
60+
testCase.DropTopic();
61+
}
62+
63+
Y_UNIT_TEST(ConnectionString_BadDNSName)
64+
{
65+
MainTestCase testCase;
66+
67+
testCase.CreateTable(R"(
68+
CREATE TABLE `%s` (
69+
Key Uint64 NOT NULL,
70+
Message Utf8,
71+
PRIMARY KEY (Key)
72+
) WITH (
73+
STORE = COLUMN
74+
);
75+
)");
76+
testCase.CreateTopic(1);
77+
testCase.ExecuteDDL(Sprintf(R"(
78+
$l = ($x) -> {
79+
return [
80+
<|
81+
Key: 1,
82+
Message:CAST("Message-1" AS Utf8)
83+
|>
84+
];
85+
};
86+
87+
CREATE TRANSFER %s
88+
FROM %s TO %s USING $l
89+
WITH (
90+
CONNECTION_STRING = "grpc://domain-not-exists-localhost.com.moc:2135"
91+
)
92+
)", testCase.TransferName.data(), testCase.TopicName.data(), testCase.TableName.data()));
93+
94+
testCase.CheckTransferStateError("Grpc error response on endpoint domain-not-exists-localhost.com.moc:2135");
95+
96+
testCase.DropTransfer();
97+
testCase.DropTable();
98+
testCase.DropTopic();
99+
}
100+
101+
25102
Y_UNIT_TEST(Create_WithPermission)
26103
{
27104
auto id = RandomNumber<ui16>();

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ inline bool IsRetryableError(const NYdb::TStatus status, const TVector<NYdb::ESt
4141
case NYdb::EStatus::CLIENT_UNAUTHENTICATED:
4242
case NYdb::EStatus::CLIENT_CALL_UNIMPLEMENTED:
4343
return false;
44+
case NYdb::EStatus::TRANSPORT_UNAVAILABLE:
45+
for (const auto& issue : status.GetIssues()) {
46+
if (issue.GetMessage().contains("Misformatted domain name") || issue.GetMessage().contains("Domain name not found")) {
47+
return false;
48+
}
49+
}
50+
return true;
4451
default:
4552
return status.IsTransportError() || Find(retryable, status.GetStatus()) != retryable.end();
4653
}

0 commit comments

Comments
 (0)