Repository navigation
Remove the background cleanup of unused directories in store/ - #133464
Conversation
`DatabaseCatalogCleanupStoreDirectoryTask` (added in #38265) walked `store/` on every disk, revoked all access rights from the directories it considered unused (`chmod 0`), and removed them recursively after `database_catalog_unused_dir_rm_timeout_sec` (30 days by default). Its notion of "unused" was "there is no UUID mapping for this directory", which is not a reliable sign of garbage: - With `async_load_databases` the task can run while a table is still being attached, so it hides the data directory of a live, attached table, and every query to the table fails with `Permission denied` (#133462). - After a power loss that loses a `.sql` metadata file, the task hides and then deletes data that could be recovered with `ATTACH TABLE ... UUID` (#111837). Leaving garbage in `store/` is better than the complex and error-prone logic of removing it, so the task is removed, as proposed in #133462 (comment) The server settings `database_catalog_unused_dir_hide_timeout_sec`, `database_catalog_unused_dir_rm_timeout_sec`, and `database_catalog_unused_dir_cleanup_period_sec` are kept as obsolete settings without effect, because the server refuses to start with unknown keys in the configuration, and existing configurations (including the workaround from the issue) contain them. The "locking" of UUIDs in `DatabaseCatalog` (`addUUIDMapping`, `TemporaryLockForUUIDDirectory`) stays: it also protects from two tables or databases using the same UUID and so the same directory. The test `test_store_cleanup` is removed together with the task. The test `01601_detach_permanently` no longer has to tolerate `STD_EXCEPTION`, which was caused by the task revoking access rights from a table directory. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Workflow [PR], commit [33655d7] Summary: ✅
AI ReviewSummaryRemoves Final VerdictStatus: ✅ Approve |
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
The failure of |
|
📊 Cloud Performance Report ✅ AI verdict: This PR does not change the speed of any query on clickbench or tpch_adapted_1_official. The only flagged query, clickbench Q4 (COUNT(DISTINCT UserID)), was marked inconclusive automatically because it falls inside master's normal range: the PR median of 80.5 ms is inside master's current range of 67-81 ms, even though it is +15.0% over the 70 ms baseline. The PR removes the background cleanup task for unused store/ directories, marks its three settings as obsolete, and changes comments and tests. None of that code runs while a query executes, so leaving Q4 inconclusive is the right call. Q4 also has a noisy history on master. clickbenchFlagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
@groeneai, after this is merged, remove the unused methods and send a PR. |
|
Acknowledged. After #133464 is merged I'll send a PR removing
|
|
Sent: #133549 removes |
Backport #133464 to 26.11: Remove the background cleanup of unused directories in `store/`
Cherry pick #133464 to 26.3: Remove the background cleanup of unused directories in `store/`
Resolve the conflicts of the cherry-pick of #133464 to 26.3: - `ServerSettings.cpp`: 26.3 has the old documentation format; replace the three `database_catalog_unused_dir_*` declarations with the obsolete ones. - `DatabaseCatalog.cpp`: remove `cleanupStoreDirectoryTask` and `maybeRemoveDirectory` in the 26.3 form (`getSchedulePool` returns a reference there); `checkDatabaseCanBeRenamedWithNoCyclicDependencies` does not exist on 26.3 and is not brought in. - `integration_tests_configs.py`, `tests/casa_del_dolor/properties.py`: 26.3 has no entries for the removed test and settings, keep the release version. - `test_store_cleanup`: removed (modified on 26.3, deleted by the change). - `02888_obsolete_settings.reference`: add the three settings to the 26.3 list. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ectories in `store/`
Resolve conflicts of the cherry-pick of #133464 to 26.8: remove `cleanupStoreDirectoryTask` and `maybeRemoveDirectory` from `DatabaseCatalog`, mark the `database_catalog_unused_dir_*` server settings as obsolete, and remove `test_store_cleanup`. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Cherry pick #133464 to 26.8: Remove the background cleanup of unused directories in `store/`
…ectories in `store/`
Cherry pick #133464 to 26.9: Remove the background cleanup of unused directories in `store/`
…ectories in `store/`
Cherry pick #133464 to 26.10: Remove the background cleanup of unused directories in `store/`
…rectories in `store/`
Backport #133464 to 26.10: Remove the background cleanup of unused directories in `store/`
Backport #133464 to 26.9: Remove the background cleanup of unused directories in `store/`
Backport #133464 to 26.8: Remove the background cleanup of unused directories in `store/`
Backport #133464 to 26.3: Remove the background cleanup of unused directories in `store/`
DatabaseCatalogCleanupStoreDirectoryTask(added in #38265) walkedstore/on every disk, revoked all access rights from the directories it considered unused (chmod 0), and removed them recursively afterdatabase_catalog_unused_dir_rm_timeout_sec(30 days by default).Its only criterion for "unused" was that there is no UUID mapping for the directory, and that is not a reliable sign of garbage:
async_load_databases, the task can run while a table is still being attached. It then hides the data directory of a live, attached table, every query to the table fails withPermission denied, and the directory is scheduled for removal:store/cleanup chmod 0s the directory of a live, attached table whenasync_load_databasesis on #133462.sqlmetadata file, the task hides and later deletes the data that could be recovered withATTACH TABLE ... UUID: Automaticstore/cleanup destroys power-loss-recoverable data:chmod 0after 1 hour blocks the documentedATTACH TABLE ... UUIDrecovery, then the only copy of acknowledged fsynced data is deleted #111837Leaving garbage in
store/is better than the complex and error-prone logic of removing it, so the task is removed entirely, as proposed in #133462 (comment)Notes:
database_catalog_unused_dir_hide_timeout_sec,database_catalog_unused_dir_rm_timeout_sec, anddatabase_catalog_unused_dir_cleanup_period_secare kept as obsolete settings without effect. The server refuses to start with unknown keys in the configuration, and existing configurations contain these settings (the workaround from the issue is to set all three to large values).DatabaseCatalog(addUUIDMappingwithout a table,TemporaryLockForUUIDDirectory), which came with the same pull request, stays: by now it is also what prevents two tables or databases from using the same UUID and so the same directory. Only the comments that referred to the task are updated.IDisk::stat,IDisk::chmod,supportsStat, andsupportsChmodhave no other users after this change. They are left in place to keep the change small and easy to backport, and can be removed separately.test_store_cleanupis removed together with the task, and the test configurations no longer set the removed settings.01601_detach_permanentlyno longer has to tolerateSTD_EXCEPTION, which was caused by the task revoking access rights from a table directory.Closes: #133462
Closes: #111837
Related: #38265
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Removed the background task that cleaned up unused directories in
store/. Withasync_load_databasesenabled, it could revoke all access rights from the data directory of an attached table (queries to the table failed withPermission denied) and delete the directory 30 days later. It could also delete the data of a table that was recoverable withATTACH TABLE ... UUIDafter a power loss. Unused directories instore/are now left untouched. The server settingsdatabase_catalog_unused_dir_hide_timeout_sec,database_catalog_unused_dir_rm_timeout_sec, anddatabase_catalog_unused_dir_cleanup_period_secare obsolete and have no effect.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/133464]
Version info
26.12.1.173-master(included in26.12and later)26.11.1.2924,26.10.11.8,26.9.37.5,26.8.45.4,26.3.70.4