This commit is contained in:
kssenii 2024-03-06 16:55:48 +08:00
parent 3f90c933f3
commit 6d4514c045
2 changed files with 15 additions and 7 deletions

View File

@ -25,6 +25,8 @@ StorageSystemDisks::StorageSystemDisks(const StorageID & table_id_)
{"unreserved_space", std::make_shared<DataTypeUInt64>()},
{"keep_free_space", std::make_shared<DataTypeUInt64>()},
{"type", std::make_shared<DataTypeString>()},
{"object_storage_type", std::make_shared<DataTypeString>()},
{"metadata_type", std::make_shared<DataTypeString>()},
{"is_encrypted", std::make_shared<DataTypeUInt8>()},
{"is_read_only", std::make_shared<DataTypeUInt8>()},
{"is_write_once", std::make_shared<DataTypeUInt8>()},
@ -53,6 +55,8 @@ Pipe StorageSystemDisks::read(
MutableColumnPtr col_unreserved = ColumnUInt64::create();
MutableColumnPtr col_keep = ColumnUInt64::create();
MutableColumnPtr col_type = ColumnString::create();
MutableColumnPtr col_object_storage_type = ColumnString::create();
MutableColumnPtr col_metadata_type = ColumnString::create();
MutableColumnPtr col_is_encrypted = ColumnUInt8::create();
MutableColumnPtr col_is_read_only = ColumnUInt8::create();
MutableColumnPtr col_is_write_once = ColumnUInt8::create();
@ -69,7 +73,9 @@ Pipe StorageSystemDisks::read(
col_unreserved->insert(disk_ptr->getUnreservedSpace().value_or(std::numeric_limits<UInt64>::max()));
col_keep->insert(disk_ptr->getKeepingFreeSpace());
auto data_source_description = disk_ptr->getDataSourceDescription();
col_type->insert(data_source_description.toString());
col_type->insert(data_source_description.type);
col_object_storage_type->insert(data_source_description.object_storage_type);
col_metadata_type->insert(data_source_description.metadata_type);
col_is_encrypted->insert(data_source_description.is_encrypted);
col_is_read_only->insert(disk_ptr->isReadOnly());
col_is_write_once->insert(disk_ptr->isWriteOnce());
@ -91,6 +97,8 @@ Pipe StorageSystemDisks::read(
res_columns.emplace_back(std::move(col_unreserved));
res_columns.emplace_back(std::move(col_keep));
res_columns.emplace_back(std::move(col_type));
res_columns.emplace_back(std::move(col_object_storage_type));
res_columns.emplace_back(std::move(col_metadata_type));
res_columns.emplace_back(std::move(col_is_encrypted));
res_columns.emplace_back(std::move(col_is_read_only));
res_columns.emplace_back(std::move(col_is_write_once));

View File

@ -124,15 +124,15 @@ def check_backup_and_restore(
def check_system_tables(backup_query_id=None):
disks = [
tuple(disk.split("\t"))
for disk in node.query("SELECT name, type FROM system.disks").split("\n")
for disk in node.query("SELECT name, type, object_storage_type, metadata_type FROM system.disks").split("\n")
if disk
]
expected_disks = (
("default", "local"),
("disk_s3", "s3"),
("disk_s3_cache", "s3"),
("disk_s3_other_bucket", "s3"),
("disk_s3_plain", "s3_plain"),
("default", "local", "", ""),
("disk_s3", "object_storage", "s3", "local"),
("disk_s3_cache", "object_storage", "s3", "local"),
("disk_s3_other_bucket", "object_storage", "s3", "local"),
("disk_s3_plain", "object_storage", "s3", "plain"),
)
assert len(expected_disks) == len(disks)
for expected_disk in expected_disks: