diff options
| author | Bulat Gayazov <[email protected]> | 2023-07-13 13:37:52 +0000 | 
|---|---|---|
| committer | brgayazov <[email protected]> | 2023-07-13 16:37:52 +0300 | 
| commit | 0a47ca40422ba3f6d58deb4f11f9ed46b1d27e5d (patch) | |
| tree | 44a8ce0629c1b92f3f54bf9abad25aaca85abba4 | |
| parent | 7eb5a247ce7b3bc787d68274e49c37eda39cdf1c (diff) | |
Fixed default codecs in topics
Fixed default codecs in topics
Pull Request resolved: #306
| -rw-r--r-- | ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp | 12 | ||||
| -rw-r--r-- | ydb/public/lib/ydb_cli/commands/ydb_service_topic.h | 4 | 
2 files changed, 6 insertions, 10 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 6c323c54919..3fd13ea68da 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.cpp @@ -114,13 +114,14 @@ namespace {          TString description = PrepareAllowedCodecsDescription("Comma-separated list of supported codecs", supportedCodecs);          config.Opts->AddLongOption("supported-codecs", description)              .RequiredArgument("STRING") -            .StoreResult(&SupportedCodecsStr_); +            .StoreResult(&SupportedCodecsStr_) +            .DefaultValue((TStringBuilder() << NTopic::ECodec::RAW));          AllowedCodecs_ = supportedCodecs;      }      void TCommandWithSupportedCodecs::ParseCodecs() {          if (SupportedCodecsStr_.empty()) { -            return; +            throw TMisuseException() << "You can't specify empty set of codecs";          }          TVector<NTopic::ECodec> parsedCodecs; @@ -227,12 +228,7 @@ namespace {          settings.PartitioningSettings(PartitionsCount_, PartitionsCount_);          settings.PartitionWriteBurstBytes(PartitionWriteSpeedKbps_ * 1_KB);          settings.PartitionWriteSpeedBytesPerSecond(PartitionWriteSpeedKbps_ * 1_KB); -        const auto codecs = GetCodecs(); -        if (!codecs.empty()) { -            settings.SetSupportedCodecs(codecs); -        } else { -            settings.SetSupportedCodecs(AllowedCodecs); -        } +        settings.SetSupportedCodecs(GetCodecs());          if (GetMeteringMode() != NTopic::EMeteringMode::Unspecified) {              settings.MeteringMode(GetMeteringMode()); 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 ca8af79c62c..3dcf229ea0d 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h +++ b/ydb/public/lib/ydb_cli/commands/ydb_service_topic.h @@ -11,8 +11,8 @@  namespace NYdb::NConsoleClient {      TString PrepareAllowedCodecsDescription(const TString& descriptionPrefix, const TVector<NTopic::ECodec>& codecs); -    TVector<NYdb::NTopic::ECodec> InitAllowedCodecs(); -    const TVector<NYdb::NTopic::ECodec> AllowedCodecs = InitAllowedCodecs(); +    TVector<NTopic::ECodec> InitAllowedCodecs(); +    const TVector<NTopic::ECodec> AllowedCodecs = InitAllowedCodecs();      class TCommandWithSupportedCodecs {      protected: | 
