mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #45737 from chhetripradeep/pchhetri/fix-45690
Set compression method and level for backup writer
This commit is contained in:
commit
40b00432d2
@ -1043,7 +1043,7 @@ std::shared_ptr<IArchiveWriter> BackupImpl::getArchiveWriter(const String & suff
|
||||
String archive_name_with_suffix = getArchiveNameWithSuffix(suffix);
|
||||
auto new_archive_writer = createArchiveWriter(archive_params.archive_name, writer->writeFile(archive_name_with_suffix));
|
||||
new_archive_writer->setPassword(archive_params.password);
|
||||
|
||||
new_archive_writer->setCompression(archive_params.compression_method, archive_params.compression_level);
|
||||
size_t pos = suffix.empty() ? 0 : 1;
|
||||
archive_writers[pos] = {suffix, new_archive_writer};
|
||||
|
||||
|
@ -525,6 +525,24 @@ def test_zip_archive_with_settings():
|
||||
assert instance.query("SELECT count(), sum(x) FROM test.table") == "100\t4950\n"
|
||||
|
||||
|
||||
def test_zip_archive_with_bad_compression_method():
|
||||
backup_name = f"Disk('backups', 'archive_with_bad_compression_method.zip')"
|
||||
create_and_fill_table()
|
||||
|
||||
assert instance.query("SELECT count(), sum(x) FROM test.table") == "100\t4950\n"
|
||||
|
||||
expected_error = "Unknown compression method specified for a zip archive"
|
||||
assert expected_error in instance.query_and_get_error(
|
||||
f"BACKUP TABLE test.table TO {backup_name} SETTINGS id='archive_with_bad_compression_method', compression_method='foobar'"
|
||||
)
|
||||
assert (
|
||||
instance.query(
|
||||
"SELECT status FROM system.backups WHERE id='archive_with_bad_compression_method'"
|
||||
)
|
||||
== "BACKUP_FAILED\n"
|
||||
)
|
||||
|
||||
|
||||
def test_async():
|
||||
create_and_fill_table()
|
||||
assert instance.query("SELECT count(), sum(x) FROM test.table") == "100\t4950\n"
|
||||
|
Loading…
Reference in New Issue
Block a user