Skip to content

Commit

Permalink
Enable keep_free_space_bytes for metadata storage
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailBurdukov committed May 20, 2024
1 parent 6f74beb commit 04f78b5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Disks/ObjectStorages/MetadataStorageFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ void registerMetadataStorageFromDisk(MetadataStorageFactory & factory)
{
auto metadata_path = config.getString(config_prefix + ".metadata_path",
fs::path(Context::getGlobalContextInstance()->getPath()) / "disks" / name / "");
auto metadata_keep_free_space_bytes = config.getUInt64(config_prefix + ".metadata_keep_free_space_bytes", 0);

fs::create_directories(metadata_path);
auto metadata_disk = std::make_shared<DiskLocal>(name + "-metadata", metadata_path, 0, config, config_prefix);
auto metadata_disk = std::make_shared<DiskLocal>(name + "-metadata", metadata_path, metadata_keep_free_space_bytes, config, config_prefix);
auto key_compatibility_prefix = getObjectKeyCompatiblePrefix(*object_storage, config, config_prefix);
return std::make_shared<MetadataStorageFromDisk>(metadata_disk, key_compatibility_prefix);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ settings disk=disk(name='test2',
drop table test;
create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test3',
type = object_storage,
object_storage_type = s3,
metadata_storage_type = local,
metadata_keep_free_space_bytes = 1024,
endpoint = 'http://localhost:11111/test/common/',
access_key_id = clickhouse,
secret_access_key = clickhouse);
drop table test;

create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test4',
type = object_storage,
object_storage_type = s3,
metadata_storage_type = local,
metadata_keep_free_space_bytes = 0,
endpoint = 'http://localhost:11111/test/common/',
access_key_id = clickhouse,
secret_access_key = clickhouse);
drop table test;

create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test5',
type = object_storage,
object_storage_type = s3,
metadata_type = lll,
Expand All @@ -38,7 +60,7 @@ settings disk=disk(name='test3',
secret_access_key = clickhouse); -- { serverError UNKNOWN_ELEMENT_IN_CONFIG }

create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test4',
settings disk=disk(name='test6',
type = object_storage,
object_storage_type = kkk,
metadata_type = local,
Expand All @@ -47,7 +69,7 @@ settings disk=disk(name='test4',
secret_access_key = clickhouse); -- { serverError UNKNOWN_ELEMENT_IN_CONFIG }

create table test (a Int32) engine = MergeTree() order by tuple()
settings disk=disk(name='test5',
settings disk=disk(name='test7',
type = kkk,
object_storage_type = s3,
metadata_type = local,
Expand Down

0 comments on commit 04f78b5

Please sign in to comment.