mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Prohibit send_metadata for s3_plain disks
send_metadata changes the filenames (includes revision), while s3_plain do not care about this, and expect that the file name will not be changed. So during initialization s3_plain will do some basic checks and will write file clickhouse_access_check_e0f72fcc-d6f8-44fe-8997-96cb87767515, but instead r0000000000000000000000000000000000000000000000000000000000000001-file-clickhouse_access_check_e0f72fcc-d6f8-44fe-8997-96cb87767515 will be written, later read will not find the file and it will fail: Application: Code: 33. DB::Exception: Cannot read all data. Bytes read: 0. Bytes expected: 4.: While checking access for disk s3_plain: Cannot attach table `system`.`crash_log` ... And besides, send_metadata does not make sense for s3_plain. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
49c1beb870
commit
326d51c3fb
@ -122,6 +122,14 @@ void registerDiskS3(DiskFactory & factory, bool global_skip_access_check)
|
||||
auto client = getClient(config, config_prefix, context, *settings);
|
||||
if (type == "s3_plain")
|
||||
{
|
||||
/// send_metadata changes the filenames (includes revision), while
|
||||
/// s3_plain do not care about this, and expect that the file name
|
||||
/// will not be changed.
|
||||
///
|
||||
/// And besides, send_metadata does not make sense for s3_plain.
|
||||
if (config.getBool(config_prefix + ".send_metadata", false))
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "s3_plain does not supports send_metadata");
|
||||
|
||||
s3_storage = std::make_shared<S3PlainObjectStorage>(std::move(client), std::move(settings), uri.version_id, s3_capabilities, uri.bucket, uri.endpoint);
|
||||
metadata_storage = std::make_shared<MetadataStorageFromPlainObjectStorage>(s3_storage, uri.key);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user