Commit Graph

521 Commits

Author SHA1 Message Date
Maksim Kita
2a327107b6 Updated implementation 2024-01-25 14:31:49 +03:00
Vitaly Baranov
01aafda27b
Merge pull request #58804 from vitlibar/allow-kill-query-for-backups
Allow KILL QUERY for backups
2024-01-20 23:48:18 +01:00
Vitaly Baranov
1a1b0894eb Rename function checkQueryNotCancelled() and add check for thread_group. 2024-01-19 18:05:30 +01:00
kssenii
2f34ef6ff8 Follow up 2024-01-19 11:19:59 +01:00
Vitaly Baranov
4c6d3e7efa Add server settings "shutdown_wait_backups_and_restores" (default=true)
to set whether shutdown should wait for running backups to finish or just cancel them.
2024-01-18 13:27:14 +01:00
Vitaly Baranov
c15edebadf Use the same row in system.processes and the same query_id for both a BACKUP/RESTORE query started by user and its asynchronous execution in a separate thread. 2024-01-16 18:49:37 +01:00
Vitaly Baranov
085833aaae Use special statuses BACKUP_CANCELLED and RESTORE_CANCELLED in system.backups 2024-01-16 15:07:24 +01:00
Vitaly Baranov
185f6cc37c Add tests for cancelling backup/restore queries. 2024-01-16 15:07:20 +01:00
Vitaly Baranov
3d7a17af08 Allow KILL QUERY to cancel backups/restores. 2024-01-15 02:22:35 +01:00
Dani Pozo
a012377102 Hide credentials in system.backup_log base_backup_name column 2024-01-05 15:39:36 +01:00
Jihyuk Bok
491df7bf6e enable ordinary databases while restoration 2024-01-04 18:46:55 +01:00
Alexey Milovidov
aa6ecd2d59
Merge pull request #58343 from azat/s3/optional-gcs-compose
Avoid sending ComposeObject requests after upload to GCS
2023-12-30 12:40:04 +01:00
Alexander Tokmakov
790ededf80
Update BackupCoordinationStageSync.cpp 2023-12-29 17:58:24 +01:00
Alexander Tokmakov
302ddeb6d0
Update BackupCoordinationStageSync.cpp 2023-12-29 17:08:13 +01:00
Alexander Tokmakov
72a0797b88 keep exception format string in retries ctl 2023-12-29 15:21:46 +01:00
Azat Khuzhin
8c54380d80 Avoid sending ComposeObject requests after upload to GCS
This should not be required anymore, but leave it as an option, since
likely this is required for old files.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-12-29 11:53:49 +01:00
Azat Khuzhin
f4a7789cd4 Convert various S3::Client settings into separate ClientSettings struct
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-12-29 11:53:49 +01:00
Sema Checherinda
cc8a35293b
Merge pull request #58163 from danipozo/remove-overwritten-assignment
Remove retryStrategy assignments overwritten in ClientFactory::create()
2023-12-27 20:29:55 +01:00
Raúl Marín
e87b9751bd Cleanup some known short messages 2023-12-26 12:58:50 +01:00
Azat Khuzhin
3be3b0a280 Fix incorrect Exceptions
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-12-24 21:26:32 +01:00
Alexey Milovidov
00fa9085b1
Merge pull request #58178 from chhetripradeep/add-base-backup-name-to-system-tables
Add base backup name to system.backups and system.backup_log tables
2023-12-24 03:38:20 +01:00
Alexey Milovidov
817d0c6553
Merge pull request #58202 from vitlibar/explicit-finalize-in-zip-archive-writer
Explicit finalize in ZipArchiveWriter
2023-12-24 03:30:21 +01:00
Vitaly Baranov
e1a136b791 Explicit finalize() function in ZipArchiveWriter.
Simplify too complicated code in ZipArchiveWriter.
2023-12-24 00:33:59 +01:00
Pradeep Chhetri
b5c8c4050b Add base backup name to system.backups and system.backup_log tables 2023-12-23 11:08:50 +08:00
Dani Pozo
2be2486e94 Remove retryStrategy assignments overwritten in ClientFactory::create() 2023-12-22 17:28:43 +01:00
Raúl Marín
24f952b2b8
Merge pull request #57986 from Algunenano/zk_retries_quorum
Support keeper failures in quorum check
2023-12-22 11:10:04 +01:00
Raúl Marín
6d9da8edd5 Merge remote-tracking branch 'blessed/master' into zk_retries_quorum 2023-12-21 17:03:29 +01:00
Raúl Marín
77efdf3a9e Merge remote-tracking branch 'blessed/master' into log_and_exception_verbose 2023-12-21 16:07:47 +01:00
Raúl Marín
a0a1189302 More improvements 2023-12-21 13:50:53 +01:00
Raúl Marín
ced9407cef Improve error messages 2023-12-21 10:29:05 +01:00
Raúl Marín
a581450567 Cosmetic 2023-12-20 18:44:09 +01:00
Raúl Marín
46067adce8 Improve ZooKeeperRetriesControl so it's easier to reuse 2023-12-18 17:43:10 +01:00
Raúl Marín
5b88c4ef05 BackupEntriesCollector format log 2023-12-15 16:09:46 +01:00
Vitaly Baranov
96bbff3af0
Merge pull request #57764 from vitlibar/fix-retries-for-disconnected-nodes-for-backup-on-cluster
Fix retries for disconnected nodes for BACKUP/RESTORE ON CLUSTER
2023-12-13 13:06:32 +01:00
Vitaly Baranov
028763def5 Simplify logic in BackupCoordinationStageSync::readCurrentState() and return earlier from the cycly on a connection problem. 2023-12-12 18:53:52 +01:00
Vitaly Baranov
7196103be5 Always recreate ephemeral "alive" node on reconnection. 2023-12-12 17:45:27 +01:00
Vitaly Baranov
16afd81322 Fix retries for disconnected nodes for BACKUP/RESTORE ON CLUSTER. 2023-12-12 00:35:05 +01:00
Alexey Milovidov
10d65a1ade
Merge pull request #55559 from azat/s3-fix-excessive-reads
Add ability to disable checksums for S3 to avoid excessive input file read
2023-12-05 06:34:21 +01:00
robot-ch-test-poll1
d63b652dae
Merge pull request #57385 from vitlibar/fix-inconsistent-metadata-for-backup-2
Stop using INCONSISTENT_METADATA_FOR_BACKUP that much
2023-12-04 10:29:57 +01:00
Vitaly Baranov
1bc1563e0e Stop using INCONSISTENT_METADATA_FOR_BACKUP that much. If possible prefer to continue scanning instead of stopping and starting the scanning for backup again. 2023-11-30 21:37:42 +01:00
Antonio Andelic
550513d90e Finalize ZK client on fault injection 2023-11-29 12:30:21 +00:00
Azat Khuzhin
4a02de4674 Add ability to disable checksums for S3 to avoid excessive input file read
AWS S3 client can read file multiple times, this is required for:
- calculate checksums
- calculate signature (done only for HTTP, since ClickHouse uses
  PayloadSigningPolicy::Never)

So this means that for HTTP, to send file to S3 it will be read 3x
times, and for HTTPS 2x times.

By overriding GetChecksumAlgorithmName() to return empty string,
checksums can be disabled, and the input file will be read only once.

And even though additional https layer adds extra integrity layer,
someone still may find this too risky I guess, even though ClickHouse
internal format (for MergeTree) has checksums, and more.

Here is an example stacktrace of this excessive read:

<details>

<summary>stacktrace</summary>

    (lldb) bt
    * thread 383, name = 'BackupWorker', stop reason = breakpoint 1.1
      * frame 0: 0x00000000103c5fc0 clickhouse`DB::StdStreamBufFromReadBuffer::seekpos() + 32 at StdStreamBufFromReadBuffer.cpp:67
        frame 1: 0x000000001777f7f8 clickhouse`std::__1::basic_istream<char, std::__1::char_traits<char>>::tellg() [inlined] std::__1::basic_streambuf<char, std::__1::char_traits<char>>::pubseekoff[abi:v15000](this=<unavailable>, __off=0, __way=cur, __which=8) + 120 at streambuf:162
        frame 2: 0x000000001777f7e3 clickhouse`std::__1::basic_istream<char, std::__1::char_traits<char>>::tellg() + 99 at istream:1249
        frame 3: 0x00000000152e4979 clickhouse`Aws::Utils::Crypto::MD5OpenSSLImpl::Calculate() + 57 at CryptoImpl.cpp:223
        frame 4: 0x00000000152dedee clickhouse`Aws::Utils::Crypto::MD5::Calculate() + 14 at MD5.cpp:30
        frame 5: 0x00000000152db5ac clickhouse`Aws::Utils::HashingUtils::CalculateMD5() + 44 at HashingUtils.cpp:235
        frame 6: 0x000000001528b97b clickhouse`Aws::Client::AWSClient::AddChecksumToRequest() const + 507 at AWSClient.cpp:772
        frame 7: 0x000000001528ded2 clickhouse`Aws::Client::AWSClient::BuildHttpRequest() const + 1682 at AWSClient.cpp:930
        frame 8: 0x00000000100b864f clickhouse`DB::S3::Client::BuildHttpRequest() const + 15 at Client.cpp:622
        frame 9: 0x0000000015286a41 clickhouse`Aws::Client::AWSClient::AttemptOneRequest(this=0x00007ffde2f8f000, httpRequest=<unavailable>, request=<unavailable>, signerName=<unavailable>, signerRegionOverride=<unavailable>, signerServiceNameOverride="s3") const + 65 at AWSClient.cpp:491
        frame 10: 0x00000000152845b9 clickhouse`Aws::Client::AWSClient::AttemptExhaustively(this=0x00007ffde2f8f000, uri=0x00007ffdd4d44f38, request=0x00007ffdd4d45d10, method=HTTP_PUT, signerName="SignatureV4", signerRegionOverride="us-east-1", signerServiceNameOverride="s3") const + 1337 at AWSClient.cpp:272
        frame 11: 0x0000000015298d0d clickhouse`Aws::Client::AWSXMLClient::MakeRequest() const + 45 at AWSXmlClient.cpp:99
        frame 12: 0x0000000015298cb5 clickhouse`Aws::Client::AWSXMLClient::MakeRequest() const + 309 at AWSXmlClient.cpp:66
        frame 13: 0x0000000015354b23 clickhouse`Aws::S3::S3Client::PutObject(this=0x00007ffde2f8f000, request=0x00007ffdd4d45d10) const + 2659 at S3Client.cpp:1731
        frame 14: 0x00000000100b174f clickhouse`DB::S3::Client::PutObject(DB::S3::ExtendedRequest<Aws::S3::Model::PutObjectRequest> const&) const [inlined]
        frame 15: 0x00000000100b173a clickhouse`DB::S3::Client::PutObject(DB::S3::ExtendedRequest<Aws::S3::Model::PutObjectRequest> const&) const + 41 at Client.cpp:578
        frame 16: 0x00000000100b1711 clickhouse`DB::S3::Client::PutObject(DB::S3::ExtendedRequest<Aws::S3::Model::PutObjectRequest> const&) const + 981 at Client.cpp:508
        frame 17: 0x00000000100b133c clickhouse`DB::S3::Client::PutObject(DB::S3::ExtendedRequest<Aws::S3::Model::PutObjectRequest> const&) const [inlined]
        frame 18: 0x00000000100b133c clickhouse`DB::S3::Client::PutObject() const + 28 at Client.cpp:418
        frame 19: 0x00000000103b96d6 clickhouse`DB::copyDataToS3File()

</details>

This new behaviour could be enabled with `s3_disable_checksum=true`.

Note, that I've checked this implementation with GCS/R2/S3/MinIO and it
works everywhere.
2023-11-26 19:20:19 +01:00
vdimir
15234474d7
Implement system table blob_storage_log 2023-11-21 09:18:25 +00:00
Alexey Milovidov
62a87665c5 Fix build 2023-11-19 16:31:18 +01:00
Sema Checherinda
a950595c24
Merge pull request #56314 from CheSema/s3-aggressive-timeouts
s3 adaptive timeouts
2023-11-19 14:12:14 +01:00
Alexey Milovidov
edc3b2fe48
Merge pull request #56958 from ClickHouse/metric-queued-jobs
Add metrics for the number of queued jobs, which is useful for the IO thread pool
2023-11-19 10:37:18 +01:00
Alexey Milovidov
d56cbda185 Add metrics for the number of queued jobs, which is useful for the IO thread pool 2023-11-18 19:07:59 +01:00
Antonio Andelic
9bcedf3764 Cleanup 2023-11-17 10:27:19 +00:00
Antonio Andelic
7dda3b2353 Review comments 2023-11-17 10:11:15 +00:00
Antonio Andelic
9d965368a2 Fix build 2023-11-15 08:36:24 +00:00