Revert "Prohibit CREATE on static storages (ATTACH should be used instead)"

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>
This commit is contained in:
Azat Khuzhin 2024-01-26 16:37:54 +01:00
parent 7ba31bf55c
commit 90ab986be6
2 changed files with 2 additions and 7 deletions

View File

@ -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. "

View File

@ -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.