aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuryalekseev <yuryalekseev@yandex-team.com>2023-03-06 14:00:15 +0300
committeryuryalekseev <yuryalekseev@yandex-team.com>2023-03-06 14:00:15 +0300
commitca44d2f11d133072b5d154d206ff3840dc2383ce (patch)
treee79fb5b355d99ce3ae5f0e8387d6f46f7e922b6a
parent49189329e118c0d747c9f5977496bc5003fb7b49 (diff)
downloadydb-ca44d2f11d133072b5d154d206ff3840dc2383ce.tar.gz
Add DrivesSerials table and use it instead of DriveSerial.
-rw-r--r--ydb/core/mind/bscontroller/impl.h2
-rw-r--r--ydb/core/mind/bscontroller/load_everything.cpp6
-rw-r--r--ydb/core/mind/bscontroller/scheme.h19
-rw-r--r--ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema98
4 files changed, 71 insertions, 54 deletions
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index 340f9ad725..25f67e4ab1 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -1273,7 +1273,7 @@ public:
};
struct TDriveSerialInfo {
- using Table = Schema::DriveSerial;
+ using Table = Schema::DrivesSerials;
Table::BoxId::Type BoxId;
TMaybe<Table::NodeId::Type> NodeId;
diff --git a/ydb/core/mind/bscontroller/load_everything.cpp b/ydb/core/mind/bscontroller/load_everything.cpp
index 32b47f4549..54d713e832 100644
--- a/ydb/core/mind/bscontroller/load_everything.cpp
+++ b/ydb/core/mind/bscontroller/load_everything.cpp
@@ -36,7 +36,7 @@ public:
auto groupStoragePool = db.Table<Schema::GroupStoragePool>().Range().Select();
auto groupLatencies = db.Table<Schema::GroupLatencies>().Select();
auto scrubState = db.Table<Schema::ScrubState>().Select();
- auto pdiskSerial = db.Table<Schema::DriveSerial>().Select();
+ auto drivesSerials = db.Table<Schema::DrivesSerials>().Select();
if (!state.IsReady()
|| !nodes.IsReady()
|| !disk.IsReady()
@@ -55,7 +55,7 @@ public:
|| !groupStoragePool.IsReady()
|| !groupLatencies.IsReady()
|| !scrubState.IsReady()
- || !pdiskSerial.IsReady()) {
+ || !drivesSerials.IsReady()) {
return false;
}
}
@@ -235,7 +235,7 @@ public:
if (!NTableAdapter::FetchTable<Schema::HostConfig>(db, Self, Self->HostConfigs)
|| !NTableAdapter::FetchTable<Schema::Box>(db, Self, Self->Boxes)
|| !NTableAdapter::FetchTable<Schema::BoxStoragePool>(db, Self, Self->StoragePools)
- || !NTableAdapter::FetchTable<Schema::DriveSerial>(db, Self, Self->DrivesSerials)) {
+ || !NTableAdapter::FetchTable<Schema::DrivesSerials>(db, Self, Self->DrivesSerials)) {
return false;
}
for (const auto& [storagePoolId, storagePool] : Self->StoragePools) {
diff --git a/ydb/core/mind/bscontroller/scheme.h b/ydb/core/mind/bscontroller/scheme.h
index 5436761eea..19e03cf036 100644
--- a/ydb/core/mind/bscontroller/scheme.h
+++ b/ydb/core/mind/bscontroller/scheme.h
@@ -372,6 +372,7 @@ struct Schema : NIceDb::Schema {
using TColumns = TableColumns<NodeId, PDiskId, VSlotId, State, ScrubCycleStartTime, ScrubCycleFinishTime, Success>;
};
+ // the following table is obsolete, use DrivesSerials instead
struct DriveSerial : Table<129> {
struct Serial : Column<1, NScheme::NTypeIds::String> {}; // PK
struct BoxId : Column<2, Box::BoxId::ColumnType> {};
@@ -388,6 +389,22 @@ struct Schema : NIceDb::Schema {
using TColumns = TableColumns<Serial, BoxId, NodeId, PDiskId, Guid, LifeStage, Kind, PDiskType, PDiskConfig, Path>;
};
+ struct DrivesSerials : Table<130> {
+ struct Serial : Column<1, NScheme::NTypeIds::String> {}; // PK
+ struct BoxId : Column<2, Box::BoxId::ColumnType> {};
+ struct NodeId : Column<3, Node::ID::ColumnType> {}; // FK PDisk.NodeID
+ struct PDiskId : Column<4, Node::NextPDiskID::ColumnType> {}; // FK PDisk.PDiskID
+ struct Guid : Column<5, PDisk::Guid::ColumnType> {}; // Check-only column for PDisk.Guid
+ struct LifeStage : Column<6, NScheme::NTypeIds::Uint32> { using Type = NKikimrBlobStorage::TDriveLifeStage::E; };
+ struct Kind : Column<7, HostConfigDrive::Kind::ColumnType> {};
+ struct PDiskType : Column<8, HostConfigDrive::TypeCol::ColumnType> { using Type = NKikimrBlobStorage::EPDiskType; };
+ struct PDiskConfig : Column<9, NScheme::NTypeIds::String> {};
+ struct Path : Column<10, NScheme::NTypeIds::String> {};
+
+ using TKey = TableKey<Serial>;
+ using TColumns = TableColumns<Serial, BoxId, NodeId, PDiskId, Guid, LifeStage, Kind, PDiskType, PDiskConfig, Path>;
+ };
+
using TTables = SchemaTables<
Node,
PDisk,
@@ -410,7 +427,7 @@ struct Schema : NIceDb::Schema {
MigrationPlan,
MigrationEntry,
ScrubState,
- DriveSerial
+ DrivesSerials
>;
using TSettings = SchemaSettings<
diff --git a/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema b/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema
index 00cd34dd26..584dcff095 100644
--- a/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema
+++ b/ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_bs_controller_/flat_bs_controller.schema
@@ -1365,8 +1365,55 @@
}
},
{
- "TableId": 129,
- "TableName": "DriveSerial",
+ "TableId": 100,
+ "TableName": "Box",
+ "TableKey": [
+ 1
+ ],
+ "ColumnsAdded": [
+ {
+ "ColumnId": 1,
+ "ColumnName": "BoxId",
+ "ColumnType": "Uint64"
+ },
+ {
+ "ColumnId": 2,
+ "ColumnName": "Name",
+ "ColumnType": "Utf8"
+ },
+ {
+ "ColumnId": 3,
+ "ColumnName": "Generation",
+ "ColumnType": "Uint64"
+ }
+ ],
+ "ColumnsDropped": [],
+ "ColumnFamilies": {
+ "0": {
+ "Columns": [
+ 1,
+ 2,
+ 3
+ ],
+ "RoomID": 0,
+ "Codec": 0,
+ "InMemory": false,
+ "Cache": 0,
+ "Small": 4294967295,
+ "Large": 4294967295
+ }
+ },
+ "Rooms": {
+ "0": {
+ "Main": 1,
+ "Outer": 1,
+ "Blobs": 1
+ }
+ }
+ },
+ {
+ "TableId": 130,
+ "TableName": "DrivesSerials",
"TableKey": [
1
],
@@ -1454,53 +1501,6 @@
}
},
{
- "TableId": 100,
- "TableName": "Box",
- "TableKey": [
- 1
- ],
- "ColumnsAdded": [
- {
- "ColumnId": 1,
- "ColumnName": "BoxId",
- "ColumnType": "Uint64"
- },
- {
- "ColumnId": 2,
- "ColumnName": "Name",
- "ColumnType": "Utf8"
- },
- {
- "ColumnId": 3,
- "ColumnName": "Generation",
- "ColumnType": "Uint64"
- }
- ],
- "ColumnsDropped": [],
- "ColumnFamilies": {
- "0": {
- "Columns": [
- 1,
- 2,
- 3
- ],
- "RoomID": 0,
- "Codec": 0,
- "InMemory": false,
- "Cache": 0,
- "Small": 4294967295,
- "Large": 4294967295
- }
- },
- "Rooms": {
- "0": {
- "Main": 1,
- "Outer": 1,
- "Blobs": 1
- }
- }
- },
- {
"TableId": 101,
"TableName": "BoxUser",
"TableKey": [