This commit is contained in:
vdimir 2024-08-27 16:31:34 +02:00 committed by GitHub
commit f0eb301eec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -57,7 +57,7 @@ namespace ErrorCodes
extern const int NO_SUCH_DATA_PART; extern const int NO_SUCH_DATA_PART;
extern const int ABORTED; extern const int ABORTED;
extern const int SUPPORT_IS_DISABLED; extern const int SUPPORT_IS_DISABLED;
extern const int TABLE_IS_READ_ONLY; extern const int UNSUPPORTED_METHOD;
} }
namespace ActionLocks namespace ActionLocks
@ -2526,7 +2526,7 @@ PreparedSetsCachePtr StorageMergeTree::getPreparedSetsCache(Int64 mutation_id)
void StorageMergeTree::assertNotReadonly() const void StorageMergeTree::assertNotReadonly() const
{ {
if (isStaticStorage()) if (isStaticStorage())
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is in readonly mode due to static storage"); throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Table is in readonly mode due to static storage");
} }
void StorageMergeTree::fillNewPartName(MutableDataPartPtr & part, DataPartsLock &) void StorageMergeTree::fillNewPartName(MutableDataPartPtr & part, DataPartsLock &)

View File

@ -193,6 +193,7 @@ namespace ErrorCodes
extern const int SUPPORT_IS_DISABLED; extern const int SUPPORT_IS_DISABLED;
extern const int FAULT_INJECTED; extern const int FAULT_INJECTED;
extern const int CANNOT_FORGET_PARTITION; extern const int CANNOT_FORGET_PARTITION;
extern const int UNSUPPORTED_METHOD;
} }
namespace ActionLocks namespace ActionLocks
@ -4776,7 +4777,7 @@ bool StorageReplicatedMergeTree::fetchPart(
bool try_fetch_shared) bool try_fetch_shared)
{ {
if (isStaticStorage()) if (isStaticStorage())
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is in readonly mode due to static storage"); throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Table is in readonly mode due to static storage");
auto zookeeper = zookeeper_ ? zookeeper_ : getZooKeeper(); auto zookeeper = zookeeper_ ? zookeeper_ : getZooKeeper();
const auto part_info = MergeTreePartInfo::fromPartName(part_name, format_version); const auto part_info = MergeTreePartInfo::fromPartName(part_name, format_version);
@ -5629,7 +5630,7 @@ void StorageReplicatedMergeTree::assertNotReadonly() const
if (is_readonly) if (is_readonly)
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is in readonly mode (replica path: {})", replica_path); throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is in readonly mode (replica path: {})", replica_path);
if (isStaticStorage()) if (isStaticStorage())
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is in readonly mode due to static storage"); throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Table is in readonly mode due to static storage");
} }
@ -5639,7 +5640,7 @@ SinkToStoragePtr StorageReplicatedMergeTree::write(const ASTPtr & /*query*/, con
throw Exception(ErrorCodes::NOT_INITIALIZED, "Table is not initialized yet"); throw Exception(ErrorCodes::NOT_INITIALIZED, "Table is not initialized yet");
if (isStaticStorage()) if (isStaticStorage())
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is in readonly mode due to static storage"); throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Table is in readonly mode due to static storage");
/// If table is read-only because it doesn't have metadata in zk yet, then it's not possible to insert into it /// If table is read-only because it doesn't have metadata in zk yet, then it's not possible to insert into it
/// Without this check, we'll write data parts on disk, and afterwards will remove them since we'll fail to commit them into zk /// Without this check, we'll write data parts on disk, and afterwards will remove them since we'll fail to commit them into zk
/// In case of remote storage like s3, it'll generate unnecessary PUT requests /// In case of remote storage like s3, it'll generate unnecessary PUT requests