summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--yt/yt/client/api/rpc_proxy/table_mount_cache.cpp6
-rw-r--r--yt/yt/client/driver/driver.cpp1
-rw-r--r--yt/yt/client/driver/internal_commands.cpp2
-rw-r--r--yt/yt/client/driver/table_commands.cpp31
-rw-r--r--yt/yt/client/driver/table_commands.h19
-rw-r--r--yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto1
6 files changed, 59 insertions, 1 deletions
diff --git a/yt/yt/client/api/rpc_proxy/table_mount_cache.cpp b/yt/yt/client/api/rpc_proxy/table_mount_cache.cpp
index 6e7987052b1..025dc42cfa9 100644
--- a/yt/yt/client/api/rpc_proxy/table_mount_cache.cpp
+++ b/yt/yt/client/api/rpc_proxy/table_mount_cache.cpp
@@ -117,7 +117,11 @@ private:
tableInfo->UpperCapBound = MaxKey();
} else {
tableInfo->LowerCapBound = MakeUnversionedOwningRow(static_cast<int>(0));
- tableInfo->UpperCapBound = MakeUnversionedOwningRow(static_cast<int>(tableInfo->Tablets.size()));
+
+ auto tabletCount = tableInfo->IsChaosReplicated()
+ ? rsp->tablet_count()
+ : static_cast<int>(tableInfo->Tablets.size());
+ tableInfo->UpperCapBound = MakeUnversionedOwningRow(tabletCount);
}
YT_LOG_DEBUG("Table mount info received (Path: %v, TableId: %v, TabletCount: %v, Dynamic: %v)",
diff --git a/yt/yt/client/driver/driver.cpp b/yt/yt/client/driver/driver.cpp
index 6532b4d3e10..48d6f7d62b3 100644
--- a/yt/yt/client/driver/driver.cpp
+++ b/yt/yt/client/driver/driver.cpp
@@ -230,6 +230,7 @@ public:
REGISTER (TGetTablePivotKeysCommand, "get_table_pivot_keys", Null, Structured, false, false, ApiVersion4);
REGISTER (TGetTabletInfosCommand, "get_tablet_infos", Null, Structured, true, false, ApiVersion4);
REGISTER (TGetTabletErrorsCommand, "get_tablet_errors", Null, Structured, true, false, ApiVersion4);
+ REGISTER (TGetTableMountInfoCommand, "get_table_mount_info", Null, Structured, false, false, ApiVersion4);
REGISTER (TCreateTableBackupCommand, "create_table_backup", Null, Null, true, false, ApiVersion3);
REGISTER (TRestoreTableBackupCommand, "restore_table_backup", Null, Null, true, false, ApiVersion3);
diff --git a/yt/yt/client/driver/internal_commands.cpp b/yt/yt/client/driver/internal_commands.cpp
index a69011714ee..40ca7a6680f 100644
--- a/yt/yt/client/driver/internal_commands.cpp
+++ b/yt/yt/client/driver/internal_commands.cpp
@@ -4,6 +4,8 @@
#include <yt/yt/client/chunk_client/config.h>
+#include <yt/yt/client/tablet_client/table_mount_cache.h>
+
#include <yt/yt/core/ytree/fluent.h>
namespace NYT::NDriver {
diff --git a/yt/yt/client/driver/table_commands.cpp b/yt/yt/client/driver/table_commands.cpp
index 03175a611f9..77be05014cf 100644
--- a/yt/yt/client/driver/table_commands.cpp
+++ b/yt/yt/client/driver/table_commands.cpp
@@ -1814,4 +1814,35 @@ void TGetTabletErrorsCommand::DoExecute(ICommandContextPtr context)
////////////////////////////////////////////////////////////////////////////////
+void TGetTableMountInfoCommand::Register(TRegistrar registrar)
+{
+ registrar.Parameter("path", &TThis::Path_);
+}
+
+void TGetTableMountInfoCommand::DoExecute(ICommandContextPtr context)
+{
+ auto tableMountCache = context->GetClient()->GetTableMountCache();
+ auto tableInfo = WaitFor(tableMountCache->GetTableInfo(Path_))
+ .ValueOrThrow();
+
+ // Rudimentary, for tests only
+ context->ProduceOutputValue(BuildYsonStringFluently()
+ .BeginMap()
+ .Item("lower_cap_bound").Value(tableInfo->LowerCapBound)
+ .Item("upper_cap_bound").Value(tableInfo->UpperCapBound)
+ .Item("primary_revision").Value(tableInfo->PrimaryRevision)
+ .Item("secondary_revision").Value(tableInfo->SecondaryRevision)
+ .Item("schemas")
+ .DoMap([&tableInfo] (auto fluent) {
+ for (auto kind : TEnumTraits<ETableSchemaKind>::GetDomainValues()) {
+ if (auto schemaPtr = tableInfo->Schemas[kind]) {
+ fluent.Item(ToString(kind)).Value(schemaPtr);
+ }
+ }
+ })
+ .EndMap());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
} // namespace NYT::NDriver
diff --git a/yt/yt/client/driver/table_commands.h b/yt/yt/client/driver/table_commands.h
index fde7e0b66a0..224bcd9c0c9 100644
--- a/yt/yt/client/driver/table_commands.h
+++ b/yt/yt/client/driver/table_commands.h
@@ -606,4 +606,23 @@ private:
////////////////////////////////////////////////////////////////////////////////
+struct TGetTableMountInfoCommandOptions
+{ };
+
+class TGetTableMountInfoCommand
+ : public TTypedCommand<TGetTableMountInfoCommandOptions>
+{
+public:
+ REGISTER_YSON_STRUCT_LITE(TGetTableMountInfoCommand);
+
+ static void Register(TRegistrar registrar);
+
+private:
+ NYTree::TYPath Path_;
+
+ void DoExecute(ICommandContextPtr context) override;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
} // namespace NYT::NDriver
diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
index f1e824e410a..00d0104d4a2 100644
--- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
+++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
@@ -1465,6 +1465,7 @@ message TRspGetTableMountInfo
repeated TReplicaInfo replicas = 6;
optional string physical_path = 7;
repeated TIndexInfo indices = 8;
+ optional int32 tablet_count = 9;
}
////////////////////////////////////////////////////////////////////////////////