diff options
author | alexnick <alexnick@ydb.tech> | 2022-07-26 13:37:26 +0300 |
---|---|---|
committer | alexnick <alexnick@ydb.tech> | 2022-07-26 13:37:26 +0300 |
commit | c0bf07f7422220a6a1dea02f3146aafa7afd1e65 (patch) | |
tree | d910547f3e55ee2c2ff72baec0e40360c2195157 | |
parent | eecc67f61b0315ade38ffc278169a2155e89544d (diff) | |
download | ydb-c0bf07f7422220a6a1dea02f3146aafa7afd1e65.tar.gz |
fix for parsing path with account==dir
-rw-r--r-- | ydb/library/persqueue/topic_parser/topic_parser.cpp | 2 | ||||
-rw-r--r-- | ydb/library/persqueue/topic_parser/ut/topic_names_converter_ut.cpp | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ydb/library/persqueue/topic_parser/topic_parser.cpp b/ydb/library/persqueue/topic_parser/topic_parser.cpp index 0bcc7a591ad..f0f80e93469 100644 --- a/ydb/library/persqueue/topic_parser/topic_parser.cpp +++ b/ydb/library/persqueue/topic_parser/topic_parser.cpp @@ -458,7 +458,7 @@ void TDiscoveryConverter::BuildFromLegacyName(const TString& rootPrefix, bool fo if (res) { if (!Account_.Defined()) { Account_ = fst; - } else if (*Account_ != fst){ + } else { modernName << fst << "/"; fullModernName << fst << "/"; } diff --git a/ydb/library/persqueue/topic_parser/ut/topic_names_converter_ut.cpp b/ydb/library/persqueue/topic_parser/ut/topic_names_converter_ut.cpp index 0439c634d4b..5762e03cd53 100644 --- a/ydb/library/persqueue/topic_parser/ut/topic_names_converter_ut.cpp +++ b/ydb/library/persqueue/topic_parser/ut/topic_names_converter_ut.cpp @@ -179,6 +179,30 @@ Y_UNIT_TEST_SUITE(TopicNameConverterTest) { UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetInternalName(), "rt3.dc1--account--topic"); } + Y_UNIT_TEST(LegacyStyleDoubleName) { + TConverterTestWrapper wrapper(false, "/Root/PQ", "dc1"); + + NKikimrPQ::TPQTabletConfig pqConfig; + pqConfig.SetTopicName("rt3.dc1--account@account--account"); + pqConfig.SetTopicPath("/Root/PQ/rt3.dc1--account@account--account"); + pqConfig.SetFederationAccount("account"); + pqConfig.SetLocalDC(true); + pqConfig.SetYdbDatabasePath(""); + wrapper.SetConverter(pqConfig); + + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetFederationPath(), "account/account/account"); + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetCluster(), "dc1"); + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetTopicForSrcId(), "rt3.dc1--account@account--account"); + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetTopicForSrcIdHash(), "account@account--account"); + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetClientsideName(), "rt3.dc1--account@account--account"); + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetModernName(), "account/account"); + + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetPrimaryPath(), "/Root/PQ/rt3.dc1--account@account--account"); + UNIT_ASSERT_VALUES_EQUAL(wrapper.TopicConverter->GetInternalName(), "rt3.dc1--account@account--account"); + } + + + Y_UNIT_TEST(Paths) { TConverterTestWrapper wrapper(false, "/Root/PQ", "dc1"); { |