aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchertus <azuikov@ydb.tech>2022-10-20 11:33:04 +0300
committerchertus <azuikov@ydb.tech>2022-10-20 11:33:04 +0300
commitd37715ef865ba1c48ca505f8b96151ae6d417657 (patch)
tree6c4ca7775a16be020881cdf1fe4bcfce693e1722
parentc83b4d47b64a791a9f52d8959b15655934a6ad64 (diff)
downloadydb-d37715ef865ba1c48ca505f8b96151ae6d417657.tar.gz
pass owner path to columnshard
-rw-r--r--ydb/core/protos/tx_columnshard.proto2
-rw-r--r--ydb/core/tx/columnshard/columnshard__init.cpp2
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.cpp4
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.h1
-rw-r--r--ydb/core/tx/columnshard/columnshard_schema.h1
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp4
6 files changed, 14 insertions, 0 deletions
diff --git a/ydb/core/protos/tx_columnshard.proto b/ydb/core/protos/tx_columnshard.proto
index 942cf9bcff..92514e6a92 100644
--- a/ydb/core/protos/tx_columnshard.proto
+++ b/ydb/core/protos/tx_columnshard.proto
@@ -162,6 +162,8 @@ message TCommitTxBody {
message TInitShard {
optional uint32 DataChannelCount = 1;
optional uint64 StorePathId = 2;
+ optional uint64 TablePathId = 3;
+ optional string OwnerPath = 4; // tablestore or table path
}
message TSchemaPresetVersionInfo {
diff --git a/ydb/core/tx/columnshard/columnshard__init.cpp b/ydb/core/tx/columnshard/columnshard__init.cpp
index e06755ad67..6683260c14 100644
--- a/ydb/core/tx/columnshard/columnshard__init.cpp
+++ b/ydb/core/tx/columnshard/columnshard__init.cpp
@@ -35,6 +35,7 @@ void TTxInit::SetDefaults() {
Self->LastPlannedStep = 0;
Self->LastPlannedTxId = 0;
Self->StorePathId = 0;
+ Self->OwnerPath.clear();
Self->BasicTxInfo.clear();
Self->DeadlineQueue.clear();
Self->PlanQueue.clear();
@@ -79,6 +80,7 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx)
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::LastPlannedTxId, Self->LastPlannedTxId);
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::LastExportNumber, Self->LastExportNo);
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::StorePathId, Self->StorePathId);
+ ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPath, Self->OwnerPath);
if (!ready)
return false;
diff --git a/ydb/core/tx/columnshard/columnshard_impl.cpp b/ydb/core/tx/columnshard/columnshard_impl.cpp
index d31e9436ba..b4c7df7c7d 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.cpp
+++ b/ydb/core/tx/columnshard/columnshard_impl.cpp
@@ -427,6 +427,10 @@ void TColumnShard::RunInit(const NKikimrTxColumnShard::TInitShard& proto, const
StorePathId = proto.GetStorePathId();
Schema::SaveSpecialValue(db, Schema::EValueIds::StorePathId, StorePathId);
}
+ if (proto.HasOwnerPath()) {
+ OwnerPath = proto.GetOwnerPath();
+ Schema::SaveSpecialValue(db, Schema::EValueIds::OwnerPath, OwnerPath);
+ }
}
void TColumnShard::RunEnsureTable(const NKikimrTxColumnShard::TCreateTable& tableProto, const TRowVersion& version,
diff --git a/ydb/core/tx/columnshard/columnshard_impl.h b/ydb/core/tx/columnshard/columnshard_impl.h
index 1b3048f357..4faadbd09c 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.h
+++ b/ydb/core/tx/columnshard/columnshard_impl.h
@@ -350,6 +350,7 @@ private:
ui64 StatsReportRound = 0;
ui64 BackgroundActivation = 0;
ui32 SkippedIndexations = TSettings::MAX_INDEXATIONS_TO_SKIP; // Force indexation on tablet init
+ TString OwnerPath;
TIntrusivePtr<TMediatorTimecastEntry> MediatorTimeCastEntry;
bool MediatorTimeCastRegistered = false;
diff --git a/ydb/core/tx/columnshard/columnshard_schema.h b/ydb/core/tx/columnshard/columnshard_schema.h
index 5bff08f0c3..671e49cf48 100644
--- a/ydb/core/tx/columnshard/columnshard_schema.h
+++ b/ydb/core/tx/columnshard/columnshard_schema.h
@@ -48,6 +48,7 @@ struct Schema : NIceDb::Schema {
LastGcBarrierStep = 9,
LastExportNumber = 10,
StorePathId = 11,
+ OwnerPath = 12,
};
enum class EInsertTableIds : ui8 {
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp
index cd8469a69d..aeb53be7b8 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp
@@ -294,10 +294,14 @@ public:
NKikimrTxColumnShard::TSchemaTxBody tx;
context.SS->FillSeqNo(tx, seqNo);
+ NSchemeShard::TPath path = NSchemeShard::TPath::Init(txState->TargetPathId, context.SS);
+ Y_VERIFY(path.IsResolved());
+
// TODO: we may need to specify a more complex data channel mapping
auto* init = tx.MutableInitShard();
init->SetDataChannelCount(storeInfo->Description.GetStorageConfig().GetDataChannelCount());
init->SetStorePathId(txState->TargetPathId.LocalPathId);
+ init->SetOwnerPath(path.PathString());
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&columnShardTxBody);
}