Skip to content

Commit

Permalink
Revert "Prohibit CREATE on static storages (ATTACH should be used ins…
Browse files Browse the repository at this point in the history
…tead)"

CREATE is used by Replicated database even for ATTACH, and anyway ATTACH
creates format_version.txt as well (without previuos patch).

This reverts commit 323f1f320ebe7e588d443abf78efa2c60193e7a9.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
  • Loading branch information
azat committed Jan 26, 2024
1 parent 7ba31bf commit 90ab986
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/Storages/StorageMergeTree.cpp
Expand Up @@ -115,14 +115,12 @@ StorageMergeTree::StorageMergeTree(
, writer(*this)
, merger_mutator(*this)
{
if (!attach && isStaticStorage())
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Creating data on static storage is prohibited, use ATTACH instead");

initializeDirectoriesAndFormatVersion(relative_data_path_, attach, date_column_name);


loadDataParts(has_force_restore_data_flag, std::nullopt);

if (!attach && !getDataPartsForInternalUsage().empty())
if (!attach && !getDataPartsForInternalUsage().empty() && !isStaticStorage())
throw Exception(ErrorCodes::INCORRECT_DATA,
"Data directory for table already containing data parts - probably "
"it was unclean DROP table or manual intervention. "
Expand Down
3 changes: 0 additions & 3 deletions src/Storages/StorageReplicatedMergeTree.cpp
Expand Up @@ -338,9 +338,6 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
, replicated_fetches_throttler(std::make_shared<Throttler>(getSettings()->max_replicated_fetches_network_bandwidth, getContext()->getReplicatedFetchesThrottler()))
, replicated_sends_throttler(std::make_shared<Throttler>(getSettings()->max_replicated_sends_network_bandwidth, getContext()->getReplicatedSendsThrottler()))
{
if (!attach && isStaticStorage())
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Creating data on static storage is prohibited, use ATTACH instead");

initializeDirectoriesAndFormatVersion(relative_data_path_, attach, date_column_name);
/// We create and deactivate all tasks for consistency.
/// They all will be scheduled and activated by the restarting thread.
Expand Down

0 comments on commit 90ab986

Please sign in to comment.