aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsofya <nsofya@ydb.tech>2023-10-24 17:01:57 +0300
committernsofya <nsofya@ydb.tech>2023-10-24 17:27:36 +0300
commitd13894762d6e88288177d8b49c9b0bf852d7c6af (patch)
treeecccf3b950d99e822b970817c7b8e78ceafa0012
parent6b1378c8c968c4c468bf2494e0ec6d6958dcd100 (diff)
downloadydb-d13894762d6e88288177d8b49c9b0bf852d7c6af.tar.gz
Revert part of rXXXXXX (granuleId field/ do not change Key)
-rw-r--r--ydb/core/tx/columnshard/columnshard_schema.cpp4
-rw-r--r--ydb/core/tx/columnshard/columnshard_schema.h13
-rw-r--r--ydb/core/tx/columnshard/engines/portions/portion_info.h9
3 files changed, 19 insertions, 7 deletions
diff --git a/ydb/core/tx/columnshard/columnshard_schema.cpp b/ydb/core/tx/columnshard/columnshard_schema.cpp
index 34ffa4062a7..b1c173063be 100644
--- a/ydb/core/tx/columnshard/columnshard_schema.cpp
+++ b/ydb/core/tx/columnshard/columnshard_schema.cpp
@@ -4,14 +4,16 @@ namespace NKikimr::NColumnShard {
bool Schema::IndexColumns_Load(NIceDb::TNiceDb& db, const IBlobGroupSelector* dsGroupSelector, ui32 index, const std::function<void(const NOlap::TPortionInfo&, const NOlap::TColumnChunkLoadContext&)>& callback) {
auto rowset = db.Table<IndexColumns>().Prefix(index).Select();
- if (!rowset.IsReady())
+ if (!rowset.IsReady()) {
return false;
+ }
while (!rowset.EndOfSet()) {
NOlap::TPortionInfo portion = NOlap::TPortionInfo::BuildEmpty();
portion.SetPathId(rowset.GetValue<IndexColumns::PathId>());
portion.SetMinSnapshot(rowset.GetValue<IndexColumns::PlanStep>(), rowset.GetValue<IndexColumns::TxId>());
portion.SetPortion(rowset.GetValue<IndexColumns::Portion>());
+ portion.SetDeprecatedGranuleId(rowset.GetValue<IndexColumns::Granule>());
NOlap::TColumnChunkLoadContext chunkLoadContext(rowset, dsGroupSelector);
diff --git a/ydb/core/tx/columnshard/columnshard_schema.h b/ydb/core/tx/columnshard/columnshard_schema.h
index e7819a413db..b9116a0df77 100644
--- a/ydb/core/tx/columnshard/columnshard_schema.h
+++ b/ydb/core/tx/columnshard/columnshard_schema.h
@@ -245,7 +245,7 @@ struct Schema : NIceDb::Schema {
struct Size : Column<13, NScheme::NTypeIds::Uint32> {};
struct PathId : Column<14, NScheme::NTypeIds::Uint64> {};
- using TKey = TableKey<Index, Granule, ColumnIdx, PlanStep, TxId, Portion, Chunk, PathId>;
+ using TKey = TableKey<Index, Granule, ColumnIdx, PlanStep, TxId, Portion, Chunk>;
using TColumns = TableColumns<Index, Granule, ColumnIdx, PlanStep, TxId, Portion, Chunk,
XPlanStep, XTxId, Blob, Metadata, Offset, Size, PathId>;
};
@@ -511,20 +511,21 @@ struct Schema : NIceDb::Schema {
if (proto) {
*rowProto.MutablePortionMeta() = std::move(*proto);
}
- db.Table<IndexColumns>().Key(index, 0, row.ColumnId,
- portion.GetMinSnapshot().GetPlanStep(), portion.GetMinSnapshot().GetTxId(), portion.GetPortion(), row.Chunk, portion.GetPathId()).Update(
+ db.Table<IndexColumns>().Key(index, portion.GetDeprecatedGranuleId(), row.ColumnId,
+ portion.GetMinSnapshot().GetPlanStep(), portion.GetMinSnapshot().GetTxId(), portion.GetPortion(), row.Chunk).Update(
NIceDb::TUpdate<IndexColumns::XPlanStep>(portion.GetRemoveSnapshot().GetPlanStep()),
NIceDb::TUpdate<IndexColumns::XTxId>(portion.GetRemoveSnapshot().GetTxId()),
NIceDb::TUpdate<IndexColumns::Blob>(row.SerializedBlobId()),
NIceDb::TUpdate<IndexColumns::Metadata>(rowProto.SerializeAsString()),
NIceDb::TUpdate<IndexColumns::Offset>(row.BlobRange.Offset),
- NIceDb::TUpdate<IndexColumns::Size>(row.BlobRange.Size)
+ NIceDb::TUpdate<IndexColumns::Size>(row.BlobRange.Size),
+ NIceDb::TUpdate<IndexColumns::PathId>(portion.GetPathId())
);
}
static void IndexColumns_Erase(NIceDb::TNiceDb& db, ui32 index, const NOlap::TPortionInfo& portion, const TColumnRecord& row) {
- db.Table<IndexColumns>().Key(index, 0, row.ColumnId,
- portion.GetMinSnapshot().GetPlanStep(), portion.GetMinSnapshot().GetTxId(), portion.GetPortion(), row.Chunk, portion.GetPathId()).Delete();
+ db.Table<IndexColumns>().Key(index, portion.GetDeprecatedGranuleId(), row.ColumnId,
+ portion.GetMinSnapshot().GetPlanStep(), portion.GetMinSnapshot().GetTxId(), portion.GetPortion(), row.Chunk).Delete();
}
static bool IndexColumns_Load(NIceDb::TNiceDb& db, const IBlobGroupSelector* dsGroupSelector, ui32 index,
diff --git a/ydb/core/tx/columnshard/engines/portions/portion_info.h b/ydb/core/tx/columnshard/engines/portions/portion_info.h
index 2ccb150da46..8962475e347 100644
--- a/ydb/core/tx/columnshard/engines/portions/portion_info.h
+++ b/ydb/core/tx/columnshard/engines/portions/portion_info.h
@@ -23,6 +23,7 @@ private:
bool HasPkMinMax() const;
TPortionMeta Meta;
std::shared_ptr<NOlap::IBlobsStorageOperator> BlobsOperator;
+ ui64 DeprecatedGranuleId = 0;
public:
ui64 GetPathId() const {
return PathId;
@@ -179,6 +180,10 @@ public:
return Portion;
}
+ ui64 GetDeprecatedGranuleId() const {
+ return DeprecatedGranuleId;
+ }
+
TPortionAddress GetAddress() const {
return TPortionAddress(PathId, Portion);
}
@@ -191,6 +196,10 @@ public:
Portion = portion;
}
+ void SetDeprecatedGranuleId(const ui64 granuleId) {
+ DeprecatedGranuleId = granuleId;
+ }
+
const TSnapshot& GetMinSnapshot() const {
return MinSnapshot;
}