Repository navigation
Support for IDisk in Keeper - #50098
Conversation
|
This is an automated comment for commit eba60dd with description of existing statuses. It's updated for the latest CI running
|
f18c51c to
7811ff1
Compare
7811ff1 to
092cf99
Compare
6a34ff6 to
0f73e90
Compare
|
This PR added some optimizations for reading snapshot from file which obviously don't work for |
0f73e90 to
99ffacd
Compare
99ffacd to
f519aa4
Compare
fbba85a to
ad2b926
Compare
| Phase getServerState() const; | ||
| void setServerState(Phase server_state_); | ||
|
|
||
| bool ignoreSystemPathOnStartup() const; |
There was a problem hiding this comment.
Is this still relevant or can I remove it and throw an error if there's a system path in a snapshot?
There was a problem hiding this comment.
It shouldn't be, let's remove. It was added long time ago as a safety mechanism when system nodes were added in case people were using those paths for something else.
save_state removed the state-OLD backup before it truncated and rewrote the live state file, so a crash in that window left neither a valid state file nor a backup. On restart read_state returned nullptr and Keeper reset to term 0 / voted_for -1 while its log still held committed entries, which can violate Raft safety (double vote in a term, two leaders, loss of committed data). Keep the backup until the new state file is fully written and synced. This restores the crash-safe recovery that ClickHouse#50098 already implemented but that was unreachable: read_state's state-OLD fallback and the trailing removeFileIfExists(old_path) were dead code while the backup was deleted early. read_state now promotes the recovered backup to the live state file with copyFile + removeFileIfExists instead of moveFile, because moveFile is not implemented for plain (s3_plain) object-storage metadata, which is a supported state disk. copyFile and removeFileIfExists are already used by save_state on the same disk, so they are supported everywhere. No on-disk format or sidecar-file scheme change. Regression test TestDurableStateCrashDuringSave injects a failure while save_state rewrites the state file and asserts read_state still recovers the previously persisted state. Its test disk also rejects moveFile to mirror plain metadata. It fails without this change and passes with it. Closes: ClickHouse#111454 Co-Authored-By: Claude Opus 4.8 <[email protected]>
save_state removed the state-OLD backup before it truncated and rewrote the live state file, so a crash in that window left neither a valid state file nor a backup. On restart read_state returned nullptr and Keeper reset to term 0 / voted_for -1 while its log still held committed entries, which can violate Raft safety (double vote in a term, two leaders, loss of committed data). Keep the backup until the new state file is fully written and synced. This restores the crash-safe recovery that ClickHouse#50098 already implemented but that was unreachable: read_state's state-OLD fallback and the trailing removeFileIfExists(old_path) were dead code while the backup was deleted early. read_state now promotes the recovered backup to the live state file with copyFile + removeFileIfExists instead of moveFile, because moveFile is not implemented for plain (s3_plain) object-storage metadata, which is a supported state disk. copyFile and removeFileIfExists are already used by save_state on the same disk, so they are supported everywhere. No on-disk format or sidecar-file scheme change. Regression test TestDurableStateCrashDuringSave injects a failure while save_state rewrites the state file and asserts read_state still recovers the previously persisted state. Its test disk also rejects moveFile to mirror plain metadata. It fails without this change and passes with it. This is the initial, minimal fix from the first commit of ClickHouse#111551 by @groeneai, extracted onto current master as a standalone step, without the additional hardening added in later commits of that PR (see the -step2 branch for that part). Closes: ClickHouse#111454 Related: ClickHouse#111551
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add support for external disks in Keeper for storing snapshots and logs.
Continuation of #45884
s3_plain(usesmoveFilewhich is not supported bys3_plaindisks)Disks heavily depend on the
Contextwhich pulls huge amount of dependencies with it. To keep those dependencies at minimum, standalone Keeper will use a stripped-downContextwith all the functions necessary for Disks.Also, I explicitly added only Local disk and S3 disks (without cache) as a starting point. In future PRs we can try extending the support but I didn't see a reason to support all of the disks immediately because the benefits are questionable while I would need to add even more dependencies.
Docs: ClickHouse/clickhouse-docs#1206
cc @alesapin @kssenii (sanity check for the Disks part) @LiuYangkuan
Documentation entry for user-facing changes