Conversation
src/Interpreters/loadMetadata.cpp
Outdated
| databases.emplace(unescapeForFileName(it.name()), it.path().toString()); | ||
| } | ||
|
|
||
| if (!default_database_name.empty() && !databases.count(default_database_name)) |
|
|
||
| static void renameat2(const std::string & old_path, const std::string & new_path, int flags) | ||
| { | ||
| if (old_path.empty() || new_path.empty()) |
There was a problem hiding this comment.
Please, use more detailed exception message.
Like Cannot rename old_path to new_path because one of them is empty or Cannot rename old_path to new_path because one of them is absolute.
src/Common/rename.cpp
Outdated
| @@ -0,0 +1,122 @@ | |||
| #include <Common/rename.h> | |||
There was a problem hiding this comment.
I think file name is too general.
At least better to use renameDirectory.h or something.
src/Common/rename.cpp
Outdated
| return; | ||
|
|
||
| if (errno == EEXIST) | ||
| throwFromErrnoWithPath("Cannot RENAME_NOREPLACE " + old_path + " to " + new_path, new_path, ErrorCodes::ATOMIC_RENAME_FAIL); |
There was a problem hiding this comment.
Cannot rename old_path to new_path because path is already exists.
There was a problem hiding this comment.
Please, add the comment to throwFromErrnoWithPath declaration in Exception.h
| if (errno == EEXIST) | ||
| throwFromErrnoWithPath("Cannot RENAME_NOREPLACE " + old_path + " to " + new_path, new_path, ErrorCodes::ATOMIC_RENAME_FAIL); | ||
| if (errno == ENOENT) | ||
| throwFromErrno("Paths cannot be exchanged because " + old_path + " or " + new_path + " does not exist", ErrorCodes::ATOMIC_RENAME_FAIL); |
There was a problem hiding this comment.
Good comment.
But why we don't use throwFromErrnoWithPath now?
There was a problem hiding this comment.
In case of RENAME_EXCHANGE we cannot choose one of them. However, throwFromErrnoWithPath is useful only to add information about available space and inodes to exception message
| /// Do not use [[noreturn]] to avoid warnings like "code will never be executed" in other places | ||
| #pragma GCC diagnostic push | ||
| #pragma GCC diagnostic ignored "-Wmissing-noreturn" | ||
| static void renameExchangeFallback(const std::string &, const std::string &) |
There was a problem hiding this comment.
Do we need this function?
maybe throw exception right into renameExchange
There was a problem hiding this comment.
We need it to suppress warnings like declaration missing '[[noreturn]]' and code will never be executed in MacOS build only for this exception and this function.
|
|
||
| void loadStoredObjects(Context & context, bool has_force_restore_data_flag) override; | ||
|
|
||
| void assertCanBeDetached(bool cleenup); |
src/Databases/DatabaseAtomic.cpp
Outdated
|
|
||
|
|
||
| DatabaseAtomic::DatabaseAtomic(String name_, String metadata_path_, Context & context_) | ||
| : DatabaseOrdinary(name_, metadata_path_, "store/", "DatabaseAtomic (" + name_ + ")", context_) |
There was a problem hiding this comment.
std::move for name_ and metadata_path_
There was a problem hiding this comment.
name_ cannot be moved because it's also used in other argument
|
Looks like this can lead to SIGSEGV on parallel |
|
It's |
|
Can we "alter" a database to |
As for now it can be done only manually by modifying metadata files and moving data of tables. Also it's possible to |
|
Thanks! I think I will wait for the official ALTER release and keep an eye on this engine. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
For changelog. Remove if this is non-significant change.
Category (leave one):
Short description (up to few sentences):
Added experimental database engine Atomic. It supports non-blocking
DROPandRENAME TABLEqueries and atomicEXCHANGE TABLES t1 AND t2query#6787