aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshmel1k <shmel1k@ydb.tech>2022-08-29 19:58:31 +0300
committershmel1k <shmel1k@ydb.tech>2022-08-29 19:58:31 +0300
commit7be5b3145952235f46aaa6f8ee5e31a99deb1069 (patch)
tree0f085d234a9d7dea20ea09149f2ad69e61e8e8bc
parent232b64fb9999d4685043076e1fec5abb8b8e59b3 (diff)
downloadydb-7be5b3145952235f46aaa6f8ee5e31a99deb1069.tar.gz
[] add partitioning settings and description
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp4
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp18
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_topic.h2
3 files changed, 21 insertions, 3 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp b/ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp
index c7fb515a37..a452eb0705 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp
@@ -205,7 +205,11 @@ namespace {
int TCommandDescribe::PrintTopicResponsePretty(const NYdb::NTopic::TTopicDescription& description) {
Cout << Endl << "RetentionPeriod: " << description.GetRetentionPeriod().Hours() << " hours";
+ if (description.GetRetentionStorageMb().Defined()) {
+ Cout << Endl << "StorageRetention: " << *description.GetRetentionStorageMb() / 1_MB << " MB";
+ }
Cout << Endl << "PartitionsCount: " << description.GetTotalPartitionsCount();
+ Cout << Endl << "PartitionWriteSpeed: " << description.GetPartitionWriteSpeedBytesPerSecond() / 1_KB << " KB";
if (!description.GetSupportedCodecs().empty()) {
Cout << Endl << "SupportedCodecs: " << FormatCodecs(description.GetSupportedCodecs()) << Endl;
}
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 e70da39770..4a48db4764 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp
@@ -131,6 +131,10 @@ namespace NYdb::NConsoleClient {
.DefaultValue(18)
.Optional()
.StoreResult(&RetentionPeriodHours_);
+ config.Opts->AddLongOption("partition-write-speed-kbps", "Partition write speed in kilobytes per second")
+ .DefaultValue(1024)
+ .Optional()
+ .StoreResult(&PartitionWriteSpeedKbps_);
config.Opts->SetFreeArgsNum(1);
SetFreeArgTitle(0, "<topic-path>", "New topic path");
AddAllowedCodecs(config, AllowedCodecs);
@@ -148,8 +152,8 @@ namespace NYdb::NConsoleClient {
auto settings = NYdb::NTopic::TCreateTopicSettings();
settings.PartitioningSettings(PartitionsCount_, PartitionsCount_);
- settings.PartitionWriteBurstBytes(1024 * 1024);
- settings.PartitionWriteSpeedBytesPerSecond(1024 * 1024);
+ settings.PartitionWriteBurstBytes(PartitionWriteSpeedKbps_ * 1_KB);
+ settings.PartitionWriteSpeedBytesPerSecond(PartitionWriteSpeedKbps_ * 1_KB);
const auto codecs = GetCodecs();
if (!codecs.empty()) {
settings.SetSupportedCodecs(codecs);
@@ -174,6 +178,9 @@ namespace NYdb::NConsoleClient {
config.Opts->AddLongOption("retention-period-hours", "Duration for which data in topic is stored")
.Optional()
.StoreResult(&RetentionPeriodHours_);
+ config.Opts->AddLongOption("partition-write-speed-kbps", "Partition write speed in kilobytes per second")
+ .Optional()
+ .StoreResult(&PartitionWriteSpeedKbps_);
config.Opts->SetFreeArgsNum(1);
SetFreeArgTitle(0, "<topic-path>", "Topic to alter");
AddAllowedCodecs(config, AllowedCodecs);
@@ -202,11 +209,16 @@ namespace NYdb::NConsoleClient {
settings.SetRetentionPeriod(TDuration::Hours(*RetentionPeriodHours_));
}
+ if (PartitionWriteSpeedKbps_.Defined() && describeResult.GetTopicDescription().GetPartitionWriteSpeedBytesPerSecond() / 1_KB != *PartitionWriteSpeedKbps_) {
+ settings.SetPartitionWriteSpeedBytesPerSecond(*PartitionWriteSpeedKbps_ * 1_KB);
+ settings.SetPartitionWriteBurstBytes(*PartitionWriteSpeedKbps_ * 1_KB);
+ }
+
return settings;
}
int TCommandTopicAlter::Run(TConfig& config) {
- if (!PartitionsCount_.Defined() && GetCodecs().empty() && !RetentionPeriodHours_.Defined()) {
+ if (!PartitionsCount_.Defined() && GetCodecs().empty() && !RetentionPeriodHours_.Defined() && !PartitionWriteSpeedKbps_.Defined()) {
return EXIT_SUCCESS;
}
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 6e67ad5de2..18eb162e75 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h
@@ -40,6 +40,7 @@ namespace NYdb::NConsoleClient {
private:
ui64 RetentionPeriodHours_;
ui32 PartitionsCount_;
+ ui32 PartitionWriteSpeedKbps_;
};
class TCommandTopicAlter: public TYdbCommand, public TCommandWithTopicName, public TCommandWithSupportedCodecs {
@@ -52,6 +53,7 @@ namespace NYdb::NConsoleClient {
private:
TMaybe<ui64> RetentionPeriodHours_;
TMaybe<ui32> PartitionsCount_;
+ TMaybe<ui32> PartitionWriteSpeedKbps_;
NYdb::NTopic::TAlterTopicSettings PrepareAlterSettings(NYdb::NTopic::TDescribeTopicResult& describeResult);
};