Skip to content

Commit 33900bb

Browse files
committed
Add a dedicated option to control inclusion of the indexImplTable boundaries in the main table description
Should help minimizing the network traffic and IO CPU pool load.
1 parent 7055981 commit 33900bb

File tree

8 files changed

+26
-9
lines changed

8 files changed

+26
-9
lines changed

ydb/core/grpc_services/rpc_describe_table.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,13 @@ class TDescribeTableRPC : public TRpcSchemeRequestActor<TDescribeTableRPC, TEvDe
205205
SetDatabase(navigateRequest.get(), *Request_);
206206
NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
207207
record->SetPath(path);
208+
208209
if (req->include_shard_key_bounds()) {
209210
record->MutableOptions()->SetReturnBoundaries(true);
210211
}
211-
212+
if (req->include_index_table_shard_key_bounds()) {
213+
record->MutableOptions()->SetReturnIndexTableBoundaries(true);
214+
}
212215
if (req->include_partition_stats() && req->include_table_stats()) {
213216
record->MutableOptions()->SetReturnPartitionStats(true);
214217
}

ydb/core/protos/flat_scheme_op.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,7 @@ message TDescribeOptions {
18321832
optional bool ReturnChannelsBinding = 8 [default = false];
18331833
optional bool ReturnRangeKey = 9 [default = true];
18341834
optional bool ReturnSetVal = 10 [default = false];
1835+
optional bool ReturnIndexTableBoundaries = 11 [default = false];
18351836
}
18361837

18371838
// Request to read scheme for a specific path

ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, c
7676
opts.SetReturnPartitioningInfo(false);
7777
opts.SetReturnPartitionConfig(true);
7878
opts.SetReturnBoundaries(true);
79+
opts.SetReturnIndexTableBoundaries(true);
7980

8081
auto desc = DescribePath(ss, TlsActivationContext->AsActorContext(), pathId, opts);
8182
auto record = desc->GetRecord();

ydb/core/tx/schemeshard/schemeshard_path_describer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
375375
bool returnBoundaries = false;
376376
bool returnRangeKey = true;
377377
bool returnSetVal = Params.GetOptions().GetReturnSetVal();
378+
bool returnIndexTableBoundaries = Params.GetOptions().GetReturnIndexTableBoundaries();
378379
if (Params.HasOptions()) {
379380
returnConfig = Params.GetOptions().GetReturnPartitionConfig();
380381
returnPartitioning = Params.GetOptions().GetReturnPartitioningInfo();
@@ -499,7 +500,9 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
499500

500501
switch (childPath->PathType) {
501502
case NKikimrSchemeOp::EPathTypeTableIndex:
502-
Self->DescribeTableIndex(childPathId, childName, returnConfig, returnBoundaries, *entry->AddTableIndexes());
503+
Self->DescribeTableIndex(
504+
childPathId, childName, returnConfig, returnIndexTableBoundaries, *entry->AddTableIndexes()
505+
);
503506
break;
504507
case NKikimrSchemeOp::EPathTypeCdcStream:
505508
Self->DescribeCdcStream(childPathId, childName, *entry->AddCdcStreams());

ydb/library/backup/backup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,9 @@ NTable::TTableDescription DescribeTable(TDriver driver, const TString& fullTable
373373
NTable::TTableClient client(driver);
374374

375375
TStatus status = client.RetryOperationSync([fullTablePath, &desc](NTable::TSession session) {
376-
auto settings = NTable::TDescribeTableSettings().WithKeyShardBoundary(true);
376+
auto settings = NTable::TDescribeTableSettings()
377+
.WithKeyShardBoundary(true)
378+
.WithIndexTableKeyShardBoundary(true);
377379
auto result = session.DescribeTable(fullTablePath, settings).GetValueSync();
378380

379381
VerifyStatus(result);

ydb/public/api/protos/ydb_table.proto

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ message VectorIndexSettings {
7272
SIMILARITY_UNSPECIFIED = 0;
7373
SIMILARITY_COSINE = 1;
7474
SIMILARITY_INNER_PRODUCT = 2;
75-
}
75+
}
7676

7777
enum VectorType {
7878
VECTOR_TYPE_UNSPECIFIED = 0;
@@ -773,12 +773,16 @@ message DescribeTableRequest {
773773
// Full path
774774
string path = 2;
775775
Ydb.Operations.OperationParams operation_params = 4;
776-
// Includes shard key distribution info
776+
// Includes partition boundaries (the key values where the partitions are split)
777777
bool include_shard_key_bounds = 5;
778778
// Includes table statistics
779779
bool include_table_stats = 6;
780780
// Includes partition statistics (required include_table_statistics)
781781
bool include_partition_stats = 7;
782+
// Note: The following flag applies only if the described table has indices.
783+
// Includes partition boundaries (the key values where the partitions are split)
784+
// for tables that implement indices of the described table.
785+
bool include_index_table_shard_key_bounds = 8;
782786
}
783787

784788
message DescribeTableResponse {

ydb/public/sdk/cpp/client/ydb_table/impl/table_client.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,16 @@ TAsyncDescribeTableResult TTableClient::TImpl::DescribeTable(const TString& sess
513513
auto request = MakeOperationRequest<Ydb::Table::DescribeTableRequest>(settings);
514514
request.set_session_id(sessionId);
515515
request.set_path(path);
516+
516517
if (settings.WithKeyShardBoundary_) {
517518
request.set_include_shard_key_bounds(true);
518519
}
519-
520+
if (settings.WithIndexTableKeyShardBoundary_) {
521+
request.set_include_index_table_shard_key_bounds(true);
522+
}
520523
if (settings.WithTableStatistics_) {
521524
request.set_include_table_stats(true);
522525
}
523-
524526
if (settings.WithPartitionStatistics_) {
525527
request.set_include_partition_stats(true);
526528
}

ydb/public/sdk/cpp/client/ydb_table/table.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ struct TExplicitPartitions {
174174
using TSelf = TExplicitPartitions;
175175

176176
FLUENT_SETTING_VECTOR(TValue, SplitPoints);
177-
177+
178178
template <typename TProto>
179179
static TExplicitPartitions FromProto(const TProto& proto);
180-
180+
181181
void SerializeTo(Ydb::Table::ExplicitPartitions& proto) const;
182182
};
183183

@@ -1625,6 +1625,7 @@ struct TRenameTablesSettings : public TOperationRequestSettings<TRenameTablesSet
16251625

16261626
struct TDescribeTableSettings : public TOperationRequestSettings<TDescribeTableSettings> {
16271627
FLUENT_SETTING_DEFAULT(bool, WithKeyShardBoundary, false);
1628+
FLUENT_SETTING_DEFAULT(bool, WithIndexTableKeyShardBoundary, false);
16281629
FLUENT_SETTING_DEFAULT(bool, WithTableStatistics, false);
16291630
FLUENT_SETTING_DEFAULT(bool, WithPartitionStatistics, false);
16301631
};

0 commit comments

Comments
 (0)