diff options
author | alexnick <alexnick@ydb.tech> | 2023-10-16 12:07:43 +0300 |
---|---|---|
committer | alexnick <alexnick@ydb.tech> | 2023-10-16 12:53:37 +0300 |
commit | 51e254a4c50cdbbbd098b372428cd6e840c29241 (patch) | |
tree | 3def3459e73a941a30cb0e14ce019b9487d01eaa | |
parent | 0c5dd1a2fe6d964b0b7bac8bc2fe671fe1b4ac87 (diff) | |
download | ydb-51e254a4c50cdbbbd098b372428cd6e840c29241.tar.gz |
escape non-utf8 producerId in topic api read
escape non-utf8 producerId in topic api read
6 files changed, 14 insertions, 1 deletions
diff --git a/ydb/services/persqueue_v1/actors/CMakeLists.darwin-x86_64.txt b/ydb/services/persqueue_v1/actors/CMakeLists.darwin-x86_64.txt index 0a9aa85772..bc403f982c 100644 --- a/ydb/services/persqueue_v1/actors/CMakeLists.darwin-x86_64.txt +++ b/ydb/services/persqueue_v1/actors/CMakeLists.darwin-x86_64.txt @@ -13,6 +13,7 @@ target_link_libraries(services-persqueue_v1-actors PUBLIC yutil cpp-actors-core cpp-containers-disjoint_interval_tree + cpp-string_utils-base64 ydb-core-base ydb-core-grpc_services ydb-core-persqueue diff --git a/ydb/services/persqueue_v1/actors/CMakeLists.linux-aarch64.txt b/ydb/services/persqueue_v1/actors/CMakeLists.linux-aarch64.txt index 7c0aa49098..595cf29d92 100644 --- a/ydb/services/persqueue_v1/actors/CMakeLists.linux-aarch64.txt +++ b/ydb/services/persqueue_v1/actors/CMakeLists.linux-aarch64.txt @@ -14,6 +14,7 @@ target_link_libraries(services-persqueue_v1-actors PUBLIC yutil cpp-actors-core cpp-containers-disjoint_interval_tree + cpp-string_utils-base64 ydb-core-base ydb-core-grpc_services ydb-core-persqueue diff --git a/ydb/services/persqueue_v1/actors/CMakeLists.linux-x86_64.txt b/ydb/services/persqueue_v1/actors/CMakeLists.linux-x86_64.txt index 7c0aa49098..595cf29d92 100644 --- a/ydb/services/persqueue_v1/actors/CMakeLists.linux-x86_64.txt +++ b/ydb/services/persqueue_v1/actors/CMakeLists.linux-x86_64.txt @@ -14,6 +14,7 @@ target_link_libraries(services-persqueue_v1-actors PUBLIC yutil cpp-actors-core cpp-containers-disjoint_interval_tree + cpp-string_utils-base64 ydb-core-base ydb-core-grpc_services ydb-core-persqueue diff --git a/ydb/services/persqueue_v1/actors/CMakeLists.windows-x86_64.txt b/ydb/services/persqueue_v1/actors/CMakeLists.windows-x86_64.txt index 0a9aa85772..bc403f982c 100644 --- a/ydb/services/persqueue_v1/actors/CMakeLists.windows-x86_64.txt +++ b/ydb/services/persqueue_v1/actors/CMakeLists.windows-x86_64.txt @@ -13,6 +13,7 @@ target_link_libraries(services-persqueue_v1-actors PUBLIC yutil cpp-actors-core cpp-containers-disjoint_interval_tree + cpp-string_utils-base64 ydb-core-base ydb-core-grpc_services ydb-core-persqueue diff --git a/ydb/services/persqueue_v1/actors/partition_actor.cpp b/ydb/services/persqueue_v1/actors/partition_actor.cpp index 1e176fdaa6..7429bc626a 100644 --- a/ydb/services/persqueue_v1/actors/partition_actor.cpp +++ b/ydb/services/persqueue_v1/actors/partition_actor.cpp @@ -11,6 +11,7 @@ #include <google/protobuf/util/time_util.h> +#include <library/cpp/string_utils/base64/base64.h> #include <util/charset/utf8.h> namespace NKikimr::NGRpcProxy::V1 { @@ -292,7 +293,14 @@ void SetBatchSourceId(PersQueue::V1::MigrationStreamingReadServerMessage::DataBa void SetBatchSourceId(Topic::StreamReadMessage::ReadResponse::Batch* batch, TString value) { Y_ABORT_UNLESS(batch); - batch->set_producer_id(std::move(value)); + if (IsUtf(value)) { + batch->set_producer_id(std::move(value)); + } else { + TString res = Base64Encode(value); + batch->set_producer_id(res); + (*batch->mutable_write_session_meta())["_encoded_producer_id"] = res; + + } } void SetBatchExtraField(PersQueue::V1::MigrationStreamingReadServerMessage::DataBatch::Batch* batch, TString key, TString value) { diff --git a/ydb/services/persqueue_v1/actors/ya.make b/ydb/services/persqueue_v1/actors/ya.make index 8a72a9599a..1f694353f6 100644 --- a/ydb/services/persqueue_v1/actors/ya.make +++ b/ydb/services/persqueue_v1/actors/ya.make @@ -3,6 +3,7 @@ LIBRARY() PEERDIR( library/cpp/actors/core library/cpp/containers/disjoint_interval_tree + library/cpp/string_utils/base64 ydb/core/base ydb/core/grpc_services ydb/core/persqueue |