Commit Graph

1763 Commits

Author SHA1 Message Date
Alexander Tokmakov
910d6dc0ce
Merge pull request #45342 from ClickHouse/exception_message_patterns
Save message format strings for DB::Exception
2023-01-20 18:46:52 +03:00
kssenii
f56f515392 Fix 2023-01-19 18:45:06 +01:00
kssenii
4ce8950712 Minor changes 2023-01-19 17:53:10 +01:00
Anton Popov
65a71b4431 fix reading from encrypted disk 2023-01-18 19:02:20 +00:00
Alexander Tokmakov
5cd90c1a3e Merge branch 'master' into exception_message_patterns 2023-01-17 20:04:04 +01:00
serxa
ce7e22b87b add detailed profile events for throttling 2023-01-17 18:29:24 +00:00
Kseniia Sumarokova
5586f71950
Merge pull request #41231 from kssenii/minor-change-in-remote-read
Fix assertion in async read buffer from remote
2023-01-17 12:32:57 +01:00
Kseniia Sumarokova
6a02bdc917
Update AsynchronousReadIndirectBufferFromRemoteFS.cpp 2023-01-17 00:37:47 +01:00
Alexander Tokmakov
870cfcc36a less fmt::runtime usages 2023-01-17 00:11:59 +01:00
Kseniia Sumarokova
57c22f005b
Merge branch 'master' into minor-change-in-remote-read 2023-01-16 14:22:16 +01:00
Kseniia Sumarokova
7b612da871
Update AsynchronousReadIndirectBufferFromRemoteFS.cpp 2023-01-16 14:21:09 +01:00
Kseniia Sumarokova
4d22b49be7
Update DiskObjectStorage.cpp 2023-01-16 14:19:18 +01:00
Vitaly Baranov
16a20cd06e Use std::string_view instead of const std::string_view & 2023-01-16 10:18:04 +01:00
Vitaly Baranov
e435edb4ab Make checkObjectExists() easier. 2023-01-16 10:06:20 +01:00
Vitaly Baranov
a955504043 Move throw_on_error parameter to the end. 2023-01-15 20:28:16 +01:00
Vitaly Baranov
21b8aaeb8b Stop using HeadObject requests in S3
because they don't work well with endpoints without explicit region.
2023-01-15 20:28:11 +01:00
serxa
693489a8ad review fixes 2023-01-12 15:51:04 +00:00
Sergei Trifonov
12d8543578
Merge branch 'master' into cancellable-mutex-integration 2023-01-12 16:03:49 +01:00
Anton Popov
f119cdd5d8 fix rare logical error: 'Too large alignment' 2023-01-12 14:33:03 +00:00
alesapin
df8ceeefdc
Merge pull request #45134 from ClickHouse/fix_flaky_azure_test
Fix flaky azure test
2023-01-12 13:02:34 +01:00
alesapin
47f91381ee Fix flaky 2023-01-11 23:46:52 +01:00
alesapin
e581a56ed0 Better 2023-01-11 15:30:48 +01:00
alesapin
fe8f373aa6 Less stupid tests 2023-01-11 15:20:18 +01:00
alesapin
9b16b3f48f Fix potential memory leak 2023-01-11 01:03:01 +01:00
Kruglov Pavel
ce6962614d
Merge branch 'master' into mmap-for-storage-file 2023-01-10 17:34:01 +01:00
Kseniia Sumarokova
b22b51213f
Merge pull request #44868 from kssenii/improve-async-buffer-from-remote
Small perf improvement for async buffer from remote
2023-01-09 13:31:15 +01:00
serxa
15bb127b01 replace every std::shared_mutex with DB::FastSharedMutex 2023-01-06 23:35:38 +00:00
kssenii
81070907a2 Better time watch 2023-01-06 18:44:48 +01:00
kssenii
8fde606768 Resolve some review comments 2023-01-06 16:10:00 +01:00
kssenii
2a030c1dc0 Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2023-01-06 15:58:27 +01:00
Kseniia Sumarokova
573d3283b0
Merge pull request #44327 from kssenii/use-new-named-collections-code-2
Replace old named collections code with new (from #43147) part 2
2023-01-06 13:06:26 +01:00
alesapin
d5e41dbb0b
Update src/Disks/ObjectStorages/Web/registerDiskWebServer.cpp 2023-01-04 12:29:28 +01:00
kssenii
9368a3dc7d Remove redundant 2023-01-03 16:47:42 +01:00
kssenii
67509aa2d5 Merge remote-tracking branch 'upstream/master' into use-new-named-collections-code-2 2023-01-03 16:41:30 +01:00
kssenii
bda8f0d410 Better async buffer from remote 2023-01-03 15:27:37 +01:00
Smita Kulkarni
8a5fd7f96d Added comments and addressed review comments - Allow macro substitution in endpoint 2023-01-03 11:44:26 +01:00
SmitaRKulkarni
16dd6ca02f
Merge branch 'master' into 40951_Allow_macro_substitution_in_endpoint 2023-01-02 20:34:24 +01:00
alesapin
4948a8c17b
Remove disk restart proxy and disk decorator (#44647)
* Remove disk restart proxy and disk decorator
* Automatic style fix
* Returned some trash back
* Fix build again
* Fix failing test

Co-authored-by: robot-clickhouse <robot-clickhouse@users.noreply.github.com>
2022-12-30 14:47:30 +01:00
SmitaRKulkarni
f9a3aeb172
Merge branch 'master' into 40951_Allow_macro_substitution_in_endpoint 2022-12-30 10:43:14 +01:00
Nikita Mikhaylov
ffaff7167b
Fix flaky tests (#44690) 2022-12-29 14:32:10 +01:00
Smita Kulkarni
3d62bc2635 Allow macro substitution in endpoint of disks
Implementation:
* Updated to substitute macros in endpoint for all disks (s3, hfs, web).
Testing:
* Added an integration test test/integration/test_endpoint_macro_substitution.
2022-12-23 15:09:24 +01:00
alesapin
2fecf420cb
Merge pull request #44513 from ClickHouse/small_polishing
Minor code polishing
2022-12-23 13:47:26 +01:00
kssenii
8308177361 Merge remote-tracking branch 'upstream/master' into use-new-named-collections-code-2 2022-12-23 12:14:46 +01:00
kssenii
853f2ea123 Merge remote-tracking branch 'upstream/master' into use-new-named-collections-code-2 2022-12-23 11:49:02 +01:00
vdimir
5a91fa332f
Fix after merge 2022-12-22 15:38:28 +00:00
alesapin
fa467b3398 Minor code polishing 2022-12-22 14:31:42 +01:00
vdimir
921ac8f9fb
Fix build and unit test 2022-12-22 13:08:54 +00:00
vdimir
f7d97c5b70
Fix build after merge 2022-12-22 11:03:30 +00:00
vdimir
88008726d8
Merge branch 'master' into vdimir/tmp-data-in-fs-cache-2 2022-12-22 10:58:39 +00:00
vdimir
182b34c11e
Fixes 2022-12-22 10:22:57 +00:00
vdimir
db19e2c878
Use TemporaryFileOnDisk instead of TemporaryFileInPath 2022-12-22 10:22:56 +00:00
vdimir
26716121f4
Make 'reserve' and 'write' in FileSegmentRangeWriter independent 2022-12-22 10:22:55 +00:00
Vladimir C
f2eaf0158e
Apply suggestions from code review
Co-authored-by: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com>
2022-12-22 10:22:55 +00:00
vdimir
d30d25dbbe
Temporary files evict fs cache 2022-12-22 10:22:49 +00:00
kssenii
ac25d32105 Fix stress test 2022-12-21 09:44:56 +01:00
kssenii
6bd4f8c029 Merge remote-tracking branch 'upstream/master' into use-new-named-collections-code-2 2022-12-20 21:17:28 +01:00
Kseniia Sumarokova
b8bf28eee0
Merge branch 'master' into write-throw-cache-fix-writing 2022-12-20 11:40:49 +01:00
Nikolai Kochetov
4032ee8203 Try to fix another one test 2022-12-18 12:31:17 +00:00
Nikolai Kochetov
62ff98344e Validate s3 part upload settings. 2022-12-17 14:09:53 +00:00
kssenii
30547d2dcd Replace old named collections code for url 2022-12-17 00:24:05 +01:00
pufit
bb4405a629 Merge remote-tracking branch 'origin/mmap-for-storage-file' into mmap-for-storage-file 2022-12-15 18:17:47 -05:00
pufit
b7df684762 Enum settings, fix else branch. 2022-12-15 18:08:19 -05:00
kssenii
dfefd8dfcd Fix write-throw-cache possible write finish 2022-12-15 19:58:54 +01:00
kssenii
ea5b06023a Merge remote-tracking branch 'refs/remotes/upstream/master' into allow-single-disk-instead-of-storage-policy 2022-12-14 13:59:51 +01:00
Anton Popov
0c87031e80 Merge remote-tracking branch 'upstream/master' into HEAD 2022-12-13 16:33:21 +00:00
Vitaly Baranov
7d701e9b32
Merge pull request #44065 from vitlibar/fix-race-in-s3-multipart-upload
Fix race in s3 multipart upload
2022-12-12 15:28:05 +01:00
pufit
3599ff1a40
Merge branch 'master' into mmap-for-storage-file 2022-12-12 09:07:27 -05:00
pufit
1d6e77a29a Move reader selection logic back to StorageFile. 2022-12-11 16:15:41 -05:00
Vitaly Baranov
b91af1b650 Fix initialization of s3 request settings. 2022-12-10 05:43:51 +01:00
pufit
2d87cc1a6c Add storage_file_read_method setting. 2022-12-08 18:02:29 -05:00
alesapin
350bacec60 Followup 2022-12-08 18:43:54 +01:00
alesapin
7a223f4956 Slightly better clickhouse disks and remove DiskMemory 2022-12-08 18:20:54 +01:00
pufit
9b46baa17d Rewrite StorageFile buffer creation with createReadBufferFromFileBase.
Add file descriptor support for `createReadBufferFromFileBase`.
Fix file_size overflow in `createReadBufferFromFileBase`.
Fix `MMapReadBufferFromFileWithCache` file_size definition.
2022-12-07 22:31:32 -05:00
kssenii
d278a0dbfb Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-12-05 12:59:44 +01:00
kssenii
d91f3808bd Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-12-05 12:54:32 +01:00
Vladimir C
7d6950d397
Revert "Temporary files evict fs cache" 2022-12-02 14:50:56 +01:00
vdimir
1da1adc884
Better finalization in FileSegmentRangeWriter 2022-12-01 11:49:26 +00:00
vdimir
35c4e8ac84
wip: temporary files evict fs cache 2022-12-01 11:49:25 +00:00
vdimir
816af3dc16
wip: temporary files evict fs cache 2022-12-01 11:49:25 +00:00
vdimir
7a814d2854
wip: temporary files evict fs cache 2022-12-01 11:49:24 +00:00
vdimir
98fe3c6c02
Temporary files evict fs cache 2022-12-01 11:49:17 +00:00
Kruglov Pavel
8f22c9b013
Merge pull request #43824 from ianton-ru/ORION-1976
Fix multipart upload for large S3 object
2022-12-01 12:26:50 +01:00
Anton Ivashkin
d6ca97c8d0 Fix multipart upload for large S3 object 2022-11-30 11:58:04 +02:00
Anton Popov
65a78bcd91 improve performance of storage S3 2022-11-26 15:24:01 +00:00
Kseniia Sumarokova
37d1eb353f
Update AsynchronousReadIndirectBufferFromRemoteFS.cpp 2022-11-25 16:01:06 +01:00
Kseniia Sumarokova
ce062d2e01
Update AsynchronousReadIndirectBufferFromRemoteFS.cpp 2022-11-25 15:03:51 +01:00
Kseniia Sumarokova
5c90d5aa7e
Merge pull request #43253 from xiedeyantu/fix-s3-glob
fix s3 support question mark wildcard
2022-11-22 14:26:56 +01:00
kssenii
5f649baffe Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-11-22 14:19:51 +01:00
Alexander Gololobov
31bffdd735
Merge pull request #43460 from ClickHouse/smaller_buffer_for_small_files
Use smaller buffer for small files
2022-11-22 14:00:22 +01:00
Alexander Gololobov
5afd2a1add Pass file size to better choose buffer size 2022-11-21 22:36:45 +01:00
Alexander Gololobov
86a0dd010f Use read_hint and file_size for choosing buffer size 2022-11-21 22:36:28 +01:00
kssenii
93365b0b29 Commit forgotten files 2022-11-20 19:28:11 +01:00
Azat Khuzhin
c393af2812 Fix is_read_only property of local disks
But it wasn't a problem before, since before it was not possible to have
readonly==true.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:35:41 +01:00
Azat Khuzhin
e6e223adc2 Check if local disk is readonly before access checks 2022-11-20 16:35:32 +01:00
Azat Khuzhin
cb60576221 Change DiskLocal::setup() signature (it always return true)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:31:37 +01:00
Azat Khuzhin
38c009214a Change the name pattern for memory disks
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:28:35 +01:00
Azat Khuzhin
11be9b9ad1 Create disk directory before access check for local disk
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:28:35 +01:00
Azat Khuzhin
dddcca5cc1 Fix deadlock in DiskRestartProxy on disk restart
stacktrace:
    contrib/libcxx/src/condition_variable.cpp:47::std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&)
    contrib/libcxx/src/shared_mutex.cpp:65::std::__1::shared_timed_mutex::lock_shared()
    src/Disks/DiskRestartProxy.cpp:229::DB::DiskRestartProxy::writeFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unsigned long, DB::WriteMode, DB::WriteSettings const&)
    src/Disks/IDisk.cpp:0::DB::IDisk::checkAccessImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)
    contrib/libcxx/include/string:1499::DB::IDisk::checkAccess()
    src/Disks/IDisk.cpp:0::DB::IDisk::startup(std::__1::shared_ptr<DB::Context const>, bool)
    src/Disks/DiskRestartProxy.cpp:375::DB::DiskRestartProxy::restart(std::__1::shared_ptr<DB::Context const>)
    contrib/libcxx/include/__memory/shared_ptr.h:701::DB::InterpreterSystemQuery::restartDisk(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&)
    src/Interpreters/InterpreterSystemQuery.cpp:508::DB::InterpreterSystemQuery::execute()
    src/Interpreters/executeQuery.cpp:0::DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*)
    src/Interpreters/executeQuery.cpp:1083::DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum)
    src/Server/TCPHandler.cpp:0::DB::TCPHandler::runImpl()
    src/Server/TCPHandler.cpp:1904::DB::TCPHandler::run()
    contrib/poco/Net/src/TCPServerConnection.cpp:57::Poco::Net::TCPServerConnection::start()
    contrib/libcxx/include/__memory/unique_ptr.h:48::Poco::Net::TCPServerDispatcher::run()
    contrib/poco/Foundation/src/ThreadPool.cpp:213::Poco::PooledThread::run()
    contrib/poco/Foundation/include/Poco/SharedPtr.h:156::Poco::ThreadImpl::runnableEntry(void*)

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:28:35 +01:00
Azat Khuzhin
44f23c2568 Make disks checks only for clickhouse-server
This will fix clickhouse-disks

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:28:35 +01:00
Azat Khuzhin
2efd29f49d Implement access (read/read-by-offset/write/delete) check for all disks
Previously we had such access (read/write/delete) checks only for S3 and
Azure disks (read/read-by-offset/write/delete), this patch adds check
for all disks.

Also I've added the disk name into IDisk interface, since it is required
for the error message in IDisk::checkAccess(), but I have to add
DiskEncrypted::encrypted_name due DiskEncrypted inherits from
DiskDecorator not from IDisk, and so does not have ability to set disk
name (DiskEncrypted could pass the disk name to the DiskDecorator, but
it is not used anywere, and besides this will require to duplicate the
name for each user of DiskDecorator).

Also from nwo on, skip_access_check will make sense for every disk, plus
now startup() called for each disk (before it was missed for some of
them).

And I've added skip_access_check as as a member for DiskRestartProxy,
since it calls startup() on restart().

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:28:35 +01:00
Azat Khuzhin
324b1a7658 Add server UUID for the S3 disks checks to avoid possible races
Otherwise, if you are lucky enough, race condition is possible, and you
can get some errors because one server already removed the file while
another was trying to read it.

But it was possible only for:
- batch deletes check for "s3" disk
- and all checks for "s3_plain" disk, since this disk does not uses
  random names

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-20 16:11:45 +01:00
Kseniia Sumarokova
f0dbfbb0f4
Merge pull request #42800 from azat/disks/web-fix
Do not suppress exceptions in web disk (and fix retries for requests from web disk)
2022-11-20 16:07:45 +01:00
kssenii
08e4805c99 Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-11-19 13:26:56 +01:00
Azat Khuzhin
c029549859 Allow to drop tables from s3_plain disk (so as from web disk)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-19 10:10:27 +01:00
Azat Khuzhin
e2726e03cc Override DiskDecorator::isReadOnly()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-19 10:10:27 +01:00
kssenii
30c5344de4 Get rid of ASTPtr in settings changes 2022-11-18 19:29:45 +01:00
kssenii
babc0c84b0 Revert "Not better"
This reverts commit 66175cb9c8.
2022-11-18 13:00:46 +01:00
kssenii
66175cb9c8 Not better 2022-11-18 13:00:30 +01:00
xiedeyantu
c258d3ac8b fix s3 support question mark wildcard 2022-11-18 12:11:22 +08:00
Sergei Trifonov
f2f0676bcc
Revert "Revert "S3 request per second rate throttling"" 2022-11-17 17:35:04 +01:00
kssenii
5cdf216c8f Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-11-17 16:39:36 +01:00
Alexander Tokmakov
9011a18234
Revert "S3 request per second rate throttling" 2022-11-16 22:33:48 +03:00
Sergei Trifonov
159743edd6
Merge pull request #43014 from ClickHouse/disk-s3-throttler
S3 request per second rate throttling
2022-11-16 18:51:06 +01:00
Azat Khuzhin
1510adeca9 Fix retries for web disk
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-12 12:45:19 +01:00
Azat Khuzhin
4bb7832f63 Handle 404 errors as non fatal during obtaining list from web disk
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-12 12:37:26 +01:00
Azat Khuzhin
d28411f68b Do not suppress exceptions in web disk
Before this patch it is possible that web disk will suppress it and
instead of got an exception during read you will get just zero records:

    2022.10.28 15:18:30.739698 [ 10663 ] {} <Error> ReadWriteBufferFromHTTP: HTTP request to `http://127.0.0.1:8080/store/a3e/a3e65e1f-5fd4-47ed-9dbd-307f2586b52d/detached/.index` failed at try 1/1 with bytes read: 0/unknown. Error: Connection refused. (Current backoff wait is 100/1600 ms)
    2022.10.28 15:18:30.841210 [ 10663 ] {} <Trace> DiskWeb: Cannot load disk metadata. Error: Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 22.11.1.1...

Here this exception received on initialization, from server context,
i.e. w/o query context and that's why it hadn't throw, and eventually
you will just zero records:

    SELECT *
    FROM data_from_web

    Query id: ee544a5e-3c67-4fb4-8f14-f8e4a082b237

    Ok.

    0 rows in set. Elapsed: 0.019 sec.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-12 12:37:26 +01:00
Azat Khuzhin
ac27bc0193 Add trailing slash (/) in S3ObjectStorage::getDirectoryContents()
Otherwise it returns only the directory itself.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 18:08:41 +01:00
Azat Khuzhin
d3e0f16873 Remove common root path in MetadataStorageFromPlainObjectStorage::listDirectory()
This path should not leak into users/outside, since later it can be
passed to other APIs, i.e. exists() and so on.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 18:08:41 +01:00
Azat Khuzhin
9296bfb161 Handle list_object_keys_size for Azure
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 18:08:41 +01:00
Azat Khuzhin
2cbc61df18 Fix ATTACH FROM s3_plain for wide part
Previously because of incorrect
MetadataStorageFromPlainObjectStorage::exists(), that used
S3ObjectStorage::exists() before, which works only for existing keys,
not some intermediate path.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 18:08:41 +01:00
Azat Khuzhin
41884d3b88 Optimize MetadataStorageFromPlainObjectStorage::getFileSize()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 18:08:41 +01:00
Azat Khuzhin
7b7ae175df Add max_keys for IObjectStorage::findAllFiles()
v2: Fix google-default-arguments for IObjectStorage::findAllFiles()
v3: Update max_keys for S3 requests in S3ObjectStorage::findAllFiles() loop
v4: Clarify things about max_keys vs list_object_keys_size in S3ObjectStorage::findAllFiles()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 18:08:26 +01:00
Azat Khuzhin
434b9c14d8 Handle all entries for azure blob storage (not only first 5k)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-10 17:42:32 +01:00
Sergei Trifonov
8eedd1e046
Merge branch 'master' into disk-s3-throttler 2022-11-08 15:00:56 +01:00
serxa
6d5d9ff421 rename ReadWriteSettings -> RequestSettings 2022-11-08 13:48:23 +00:00
kssenii
50c4beeef6 Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-11-08 14:45:42 +01:00
kssenii
d876a39e8d Fix after merge 2022-11-08 00:47:10 +01:00
serxa
2daec0b45e S3 request per second rate throttling + refactoring 2022-11-07 18:05:40 +00:00
kssenii
b5b25c2676 Merge remote-tracking branch 'upstream/master' into allow-single-disk-instead-of-storage-policy 2022-11-07 17:02:41 +01:00
Aleksandr Musorin
5cb69d8a22 changed type name for S3_Plain storage
renamed a disk for S3PlainObjectStorage in system.disks table from s3 to s3_plain
2022-11-04 17:35:51 +01:00
Azat Khuzhin
c93262170d Remove ReadOnlyMetadataStorage
Throw exceptions from IMetadataStorage instead to avoid introducing
extra abstractions.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:30 +01:00
Azat Khuzhin
51bd0c2ac1 Make ReadOnlyMetadataStorage really readonly
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
bceca73f6f Throw NOT_IMPLEMENTED form ReadOnlyMetadataStorage::getLastChanged()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
3b7abbbff4 Rename s/listPrefix/findAllFiles, s/listPrefixInPath/getDirectoryContents/
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
fa7535c90d Slightly optimize MetadataStorageFromPlainObjectStorage::isDirectory()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
82ea67eb51 Slightly better MetadataStorageFromPlainObjectStorage::isFile()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
95fb2ad3cf Implement ATTACH of MergeTree table for s3_plain disk
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
4e42521f44 Introduce ReadOnlyMetadataStorage
And use it for:
- MetadataStorageFromPlainObjectStorage
- MetadataStorageFromStaticFilesWebServer

This will allow to reduce ~100-200 lines of duplicated code, and plus
make the code less error prone.

Note, for now I tried to make this without behaviour changes.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
f8ba24f040 Implement S3ObjectStorage::listPrefixInPath()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:26 +01:00
Azat Khuzhin
18e4fdf40f Introduce IObjectStorage::listPrefixInPath()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:25 +01:00
Azat Khuzhin
ee18140c48 Remove listPrefix() implementation for disks that does not support send_metadata
The reason for removing is it because not compatible with restoring
(with send_metadata set) anyway:
- HDFS - is not compatible with send_metadata, and besides it's
  implementaion is not correct, since it is simply `ls -l`, while the
  following is required: `find . -maxdepth 1 -type f`
- Web - is not compatible with send_metadata anyway
- Local - is not compatible with send_metadata anyway

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:25 +01:00
Azat Khuzhin
88db8ae7fa Add a comment for IObjectStorage::listPrefix()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:25 +01:00
Azat Khuzhin
94d9600fb8 Implement MetadataStorageFromPlainObjectStorage::getLastChanged() (as for web)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:25 +01:00
Azat Khuzhin
b34ffda272 Implement MetadataStorageFromPlainObjectStorage::getLastModified() (used by MergeTree)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:25 +01:00
Azat Khuzhin
f6d0c03ee5 Fix path to files in MetadataStorageFromPlainObjectStorage
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-31 12:02:25 +01:00
Azat Khuzhin
7a5432feaa Fix possible SIGSEGV for web disks when file does not exists
It can be triggered in multiple ways, either when file does not exists
and you are trying to create MergeTree table from web (that has special
code for UUID handling) or by simply OPTIMIZE TABLE FINAL for MergeTree
table that is located on web disk, in both cases you will get the
following:

<details>

<summary>stacktrace</summary>

    2022.10.28 14:08:40.631226 [ 6043 ] {6165bf5f-e76b-4bca-941c-7c7ff5e3b46b} <Trace> ContextAccess (default): Access granted: OPTIMIZE ON default.data_from_web
    2022.10.28 14:08:40.632017 [ 6043 ] {6165bf5f-e76b-4bca-941c-7c7ff5e3b46b} <Debug> default.data_from_web (a3e65e1f-5fd4-47ed-9dbd-307f2586b52d) (MergerMutator): Selected 1 parts from all_1_1_0 to all_1_1_0
    2022.10.28 14:08:40.632496 [ 6043 ] {6165bf5f-e76b-4bca-941c-7c7ff5e3b46b} <Trace> default.data_from_web (a3e65e1f-5fd4-47ed-9dbd-307f2586b52d): Trying to reserve 1.00 MiB using storage policy from min volume index 0
    2022.10.28 14:08:40.632752 [ 6043 ] {6165bf5f-e76b-4bca-941c-7c7ff5e3b46b} <Trace> DiskObjectStorage(DiskWebServer): Reserved 1.00 MiB on remote disk `web_disk`, having unreserved 16.00 EiB.
    2022.10.28 14:08:40.634155 [ 6043 ] {a3e65e1f-5fd4-47ed-9dbd-307f2586b52d::all_1_1_1} <Debug> MergeTask::PrepareStage: Merging 1 parts: from all_1_1_0 to all_1_1_0 into Compact
    2022.10.28 14:08:40.634498 [ 6043 ] {a3e65e1f-5fd4-47ed-9dbd-307f2586b52d::all_1_1_1} <Trace> WebObjectStorage: Loading metadata for directory: http://127.0.0.1:8080/store/a3e/a3e65e1f-5fd4-47ed-9dbd-307f2586b52d/tmp_merge_all_1_1_1
    2022.10.28 14:08:40.635025 [ 6043 ] {a3e65e1f-5fd4-47ed-9dbd-307f2586b52d::all_1_1_1} <Trace> DiskWeb: Adding directory: store/a3e/a3e65e1f-5fd4-47ed-9dbd-307f2586b52d/tmp_merge_all_1_1_1/
    2022.10.28 14:08:40.635355 [ 6043 ] {a3e65e1f-5fd4-47ed-9dbd-307f2586b52d::all_1_1_1} <Trace> ReadWriteBufferFromHTTP: Sending request to http://127.0.0.1:8080/store/a3e/a3e65e1f-5fd4-47ed-9dbd-307f2586b52d/tmp_merge_all_1_1_1/.index
    2022.10.28 14:08:40.639618 [ 6043 ] {a3e65e1f-5fd4-47ed-9dbd-307f2586b52d::all_1_1_1} <Trace> DiskWeb: Cannot load disk metadata. Error: Code: 86. DB::Exception: Received error from remote server /store/a3e/a3e65e1f-5fd4-47ed-9dbd-307f2586b52d/tmp_merge_all_1_1_1/.index. HTTP status code: 404 Not Found, body: <!doctype html><html><head><title>404 Not Found</title><style>
    body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; }
    h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; }
    h1, p { padding-left: 10px; }
    code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;}
    </style>
    </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/store/a3e/a3e65e1f-5fd4-47ed-9dbd-307f2586b52d/tmp_merge_all_1_1_1/.index</code> was not found on this server.</p></body></html>: while loading disk metadata. (RECEIVED_ERROR_FROM_REMOTE_IO_SERVER) (version 22.11.1.1)
    2022.10.28 14:08:40.640527 [ 5488 ] {} <Trace> BaseDaemon: Received signal 11
    2022.10.28 14:08:40.641529 [ 9027 ] {} <Fatal> BaseDaemon: ########################################
    2022.10.28 14:08:40.642759 [ 9027 ] {} <Fatal> BaseDaemon: (version 22.11.1.1, build id: 12145DA78CE5E9EBB10A034177FAE5967EF81A4A) (from thread 6043) (query_id: a3e65e1f-5fd4-47ed-9dbd-307f2586b52d::all_1_1_1) (query: optimize table data_from_web final) Received signal Segmentation fault (11)
    2022.10.28 14:08:40.643260 [ 9027 ] {} <Fatal> BaseDaemon: Address: NULL pointer. Access: read. Unknown si_code.
    2022.10.28 14:08:40.643769 [ 9027 ] {} <Fatal> BaseDaemon: Stack trace: 0x7ffff416c0f2 0x7ffff7cd1ca8 0x7ffff679ae5e 0x7fffd52e7906 0x7fffd50c65aa 0x7fffca7a0d42 0x7fffcaee79ec 0x7fffcaf242f8 0x7fffcaf242b5 0x7fffcaf2427d 0x7fffcaf24255 0x7fffcaf2421d 0x7ffff65c3686 0x7ffff65c2295 0x7fffcaeee2a9 0x7fffcaef2c43 0x7fffcaee3c0e 0x7fffcc4a7851 0x7fffcc4a768f 0x7fffcc4abb2d 0x7fffcfdce828 0x7fffd03e3eaa 0x7fffd03dfe3b 0x7fffc8ec42d4 0x7fffc8ed51d2 0x7ffff4bdd839 0x7ffff4bde0a8 0x7ffff48ab261 0x7ffff48a769a 0x7ffff48a6335 0x7ffff409f8fd 0x7ffff4121a60
    2022.10.28 14:08:40.644411 [ 9027 ] {} <Fatal> BaseDaemon: 4. ? @ 0x7ffff416c0f2 in ?
    2022.10.28 14:08:40.676390 [ 9027 ] {} <Fatal> BaseDaemon: 5. /src/ch/clickhouse/src/Common/StringUtils/StringUtils.cpp:9: detail::startsWith(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, char const*, unsigned long) @ 0x1ca8 in /src/ch/clickhouse/.cmake/src/Common/StringUtils/libstring_utilsd.so
    2022.10.28 14:08:40.730727 [ 9027 ] {} <Fatal> BaseDaemon: 6. /src/ch/clickhouse/src/Common/StringUtils/StringUtils.h:19: startsWith(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0x59ae5e in /src/ch/clickhouse/.cmake/src/libclickhouse_common_iod.so
    2022.10.28 14:08:40.923955 [ 9027 ] {} <Fatal> BaseDaemon: 7. /src/ch/clickhouse/src/Disks/ObjectStorages/Web/MetadataStorageFromStaticFilesWebServer.cpp:58: DB::MetadataStorageFromStaticFilesWebServer::exists(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const @ 0x6e7906 in /src/ch/clickhouse/.cmake/src/libdbmsd.so
    2022.10.28 14:08:41.291996 [ 9027 ] {} <Fatal> BaseDaemon: 8. /src/ch/clickhouse/src/Disks/ObjectStorages/DiskObjectStorage.cpp:181: DB::DiskObjectStorage::exists(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const @ 0x4c65aa in /src/ch/clickhouse/.cmake/src/libdbmsd.so
    2022.10.28 14:08:41.704697 [ 9027 ] {} <Fatal> BaseDaemon: 9. /src/ch/clickhouse/src/Storages/MergeTree/DataPartStorageOnDisk.cpp:74: DB::DataPartStorageOnDisk::exists() const @ 0xda0d42 in /src/ch/clickhouse/.cmake/src/libclickhouse_storages_mergetreed.so
    2022.10.28 14:08:43.032459 [ 9027 ] {} <Fatal> BaseDaemon: 10. /src/ch/clickhouse/src/Storages/MergeTree/MergeTask.cpp:147: DB::MergeTask::ExecuteAndFinalizeHorizontalPart::prepare() @ 0x14e79ec in /src/ch/clickhouse/.cmake/src/libclickhouse_storages_mergetreed.so
    ...
    Segmentation fault (core dumped)

</details>

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-28 15:15:49 +02:00
Anton Popov
79889198b1 fix style check 2022-10-25 23:03:37 +00:00
Anton Popov
c4d4f2dbed better interface 2022-10-25 22:14:06 +00:00
Anton Popov
c8199bc125
Merge branch 'master' into refactor-data-part 2022-10-25 14:31:05 +02:00
Nikolai Kochetov
5c4444237e
Merge pull request #42617 from ClickHouse/revert-revert-41268-disable-s3-parallel-write-for-part-moves-to-disk-s3
Revert revert 41268 disable s3 parallel write for part moves to disk s3
2022-10-25 14:29:27 +02:00