Repository navigation
Follow up changes for setting table_readonly - #100950
Conversation
|
Workflow [PR], commit [4f659ef] Summary: ❌
AI ReviewSummaryThis PR hardens handling around ClickHouse Rules
Final Verdict
|
| { | ||
| if (auto * query_with_table = dynamic_cast<ASTQueryWithTableAndOutput *>(task.query.get())) | ||
| { | ||
| auto table_id = context->tryResolveStorageID(*query_with_table, Context::ResolveOrdinary); |
There was a problem hiding this comment.
tryResolveStorageID here uses the server-level context, not the per-task query context. For ON CLUSTER statements with an unqualified table name, this can resolve against the wrong default database (often default), fail to find the storage, and keep TABLE_IS_READ_ONLY retriable.
That reintroduces retry loops for non-replicated tables outside default.
Please resolve table id using the same context as query execution (task.makeQueryContext(...) / task default DB) before checking supportsReplication, so retry classification is deterministic.
LLVM Coverage Report
Changed lines: 100.00% (39/39) · Uncovered code |
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
| e.code() != ErrorCodes::TOO_MANY_SIMULTANEOUS_QUERIES && | ||
| e.code() != ErrorCodes::MEMORY_LIMIT_EXCEEDED; | ||
|
|
||
| /// TABLE_IS_READ_ONLY is retriable for ReplicatedMergeTree (temporary ZooKeeper disconnect), |
There was a problem hiding this comment.
This code fragment looks like a kludge. The right way will be - having two error codes: TABLE_IS_READ_ONLY and TABLE_IS_PERMANENTLY_READ_ONLY.
|
Let's describe the reason - why |
|
Superseded by #105109, which addresses @alexey-milovidov's review feedback by introducing a dedicated |
Some authors don't want this kind of automated help on their PRs. Pre- filter the involves set on `author.login` against a configurable `SKIP_AUTHORS` array (initially just `alesapin`), applied right after the backport filter so all three downstream filters (authored, assigned, taken-over) honour it. NB: the jq predicate binds `.author.login as $a` first, otherwise the subsequent `$skip | index(.author.login)` would evaluate `.author.login` against `$skip` (an array) and fail with "Cannot index array with string". Verified live: 426 involves -> 415 after both filters, with the two alesapin PRs (`#100950 Follow up changes for setting table_readonly`, `#99933 Do automatic partitions pruning for mutations when it's possible`) correctly identified for skipping. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
31120da
into
ClickHouse:master
`TABLE_IS_READ_ONLY` was overloaded for both transient (`ReplicatedMergeTree` in temporary read-only state due to ZooKeeper disconnect) and permanent (`table_readonly` setting, static storage) cases. `DDLWorker` retries it indefinitely, which is correct for the transient case but caused `OPTIMIZE TABLE ON CLUSTER` to hang when `table_readonly = 1`. Replace the kludge in `DDLWorker::tryExecuteQuery` (which classified by resolving the storage and probing `supportsReplication`) with a clean split: `TABLE_IS_READ_ONLY` stays retriable; `TABLE_IS_PERMANENTLY_READ_ONLY` is non-retriable and is thrown by `assertNotReadonly` and `isStaticStorage` sites in `StorageMergeTree`, `StorageReplicatedMergeTree`, and the four DML interpreters (`ALTER`, `DELETE`, `UPDATE`, `DROP TRUNCATE`). Updates the existing tests that exercised these throw sites (`s3_plain`, `readonly` disk, `table_disk`, `table_readonly`) to expect the new error code. Addresses review feedback on ClickHouse#100950.
Some authors don't want this kind of automated help on their PRs. Pre- filter the involves set on `author.login` against a configurable `SKIP_AUTHORS` array (initially just `alesapin`), applied right after the backport filter so all three downstream filters (authored, assigned, taken-over) honour it. NB: the jq predicate binds `.author.login as $a` first, otherwise the subsequent `$skip | index(.author.login)` would evaluate `.author.login` against `$skip` (an array) and fail with "Cannot index array with string". Verified live: 426 involves -> 415 after both filters, with the two alesapin PRs (`ClickHouse#100950 Follow up changes for setting table_readonly`, `ClickHouse#99933 Do automatic partitions pruning for mutations when it's possible`) correctly identified for skipping. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
ClickHouse throws proper exception for attempts to use
table_readonlyfor replicated engines. Also better exception handling for DDL queries (and DatabaseReplicated) related to this setting. Followup to #97652.Documentation entry for user-facing changes