Skip to content

Cherry pick #133464 to 26.9: Remove the background cleanup of unused directories in store/ - #133546

Merged
robot-ch-test-poll3 merged 4 commits into
backport/26.9/133464from
cherrypick/26.9/133464
Nov 22, 2026
Merged

robot-ch-test-poll3 merged 4 commits into
backport/26.9/133464from
cherrypick/26.9/133464

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Original pull-request #133464

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

alexey-milovidov and others added 3 commits November 22, 2026 01:42
`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]>
Remove the background cleanup of unused directories in `store/`
@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Nov 22, 2026
Conflicts:
- `src/Interpreters/DatabaseCatalog.cpp`: removed `cleanupStoreDirectoryTask` and `maybeRemoveDirectory` from the 26.9 code; did not bring `checkDatabaseCanBeRenamedWithNoCyclicDependencies`, which is absent in 26.9.
- `ci/jobs/scripts/integration_tests_configs.py`, `tests/casa_del_dolor/properties.py`: kept the 26.9 versions and removed the entries of the deleted test and settings.
- `tests/integration/test_store_cleanup/test.py`: deleted, as in the original change.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@robot-ch-test-poll3
robot-ch-test-poll3 merged commit 6164bb5 into backport/26.9/133464 Nov 22, 2026
2 checks passed
@robot-ch-test-poll3
robot-ch-test-poll3 deleted the cherrypick/26.9/133464 branch November 22, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants