aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-08-03 09:36:13 +0300
committerilnaz <ilnaz@ydb.tech>2023-08-03 09:36:13 +0300
commit9683f88a775b6f06d985d5c023e67015e61edfa2 (patch)
treefab05bb3244e55e3e32bd0cc0f20554e844b478e
parentc2d75710b43de2d3555c204330816767fa2c4d96 (diff)
downloadydb-9683f88a775b6f06d985d5c023e67015e61edfa2.tar.gz
Topic read partition ids KIKIMR-18159
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp7
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_topic.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp
index 3fd13ea68d..2e32aab774 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp
@@ -590,6 +590,9 @@ namespace {
config.Opts->AddLongOption("timestamp", "Timestamp from which messages will be read. If not specified, messages are read from the last commit point for the chosen consumer.")
.Optional()
.StoreResult(&Timestamp_);
+ config.Opts->AddLongOption("partition-ids", "Comma separated list of partition ids to read from. If not specified, messages are read from all partitions.")
+ .Optional()
+ .SplitHandler(&PartitionIds_, ',');
AddAllowedMetadataFields(config);
AddTransform(config);
@@ -650,6 +653,10 @@ namespace {
// TODO(shmel1k@): partition can be added here.
NTopic::TTopicReadSettings readSettings;
readSettings.Path(TopicName);
+ for (ui64 id : PartitionIds_) {
+ readSettings.AppendPartitionIds(id);
+ }
+
settings.AppendTopics(std::move(readSettings));
return settings;
}
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h
index 3dcf229ea0..6e887a064a 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h
@@ -151,6 +151,7 @@ namespace NYdb::NConsoleClient {
private:
TString Consumer_ = "";
+ TVector<ui64> PartitionIds_;
TMaybe<uint32_t> Offset_;
TMaybe<uint32_t> Partition_;
TMaybe<ui64> Timestamp_;