Skip to content

Keep the Filesystem database's directory in the file-rename grant test - #118773

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-05057-filesystem-db-cleanup
Sep 8, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-05057-filesystem-db-cleanup

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

05057_file_rename_after_processing_write_grant creates a Filesystem database over its user_files directory and, on its last two lines, drops the database and then removes the directory. The two cannot be made atomic: the DROP DATABASE is a call into the server and fails whenever the server is gone — routine under a stress run, where the server is killed and restarted while the tests run — while the rm -rf is local and always succeeds.

What that leaves behind is a Filesystem database whose path no longer exists, and loadMetadata aborts on it:

Application: Caught exception while loading metadata: Code: 36. DB::Exception:
Path does not exist: /var/lib/clickhouse/user_files/05057_file_rename_after_processing_write_grant_test_...:
while loading database `fsdb_...` from file metadata/fsdb_....sql. (BAD_ARGUMENTS)

Every subsequent start of that server hits the same exception, so the job dies with Cannot start clickhouse-server: server process is not running after 11 start attempts and loses everything the stress run had left to check.

Since the test was added on 2026-09-04 this has been failing stress jobs across the fleet — on master and on more than 20 unrelated pull requests over two days, across arm_tsan, amd_tsan, arm_msan, amd_msan and arm_asan_ubsan, s3:

SELECT check_start_time, check_name, pull_request_number
FROM checks
WHERE test_context_raw LIKE '%fsdb_05057_file_rename_after_processing%'
  AND check_start_time > now() - INTERVAL 10 DAY
ORDER BY check_start_time DESC

Removing only the files keeps the directory the database points at, so a database that survives the cleanup still resolves and the server starts.

This does not address the second half of the issue — that a Filesystem database with a missing directory prevents the whole server from starting, rather than making one database unavailable. A Filesystem database is a view over a directory, and losing that directory bricking the server looks like a robustness defect in its own right; that is left for a separate decision.

Closes: #118772
Related: #115798

Changelog category (leave one):

  • CI Fix or improvement (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/118773]

`05057_file_rename_after_processing_write_grant` created a `Filesystem`
database over its `user_files` directory and then, on its last two lines,
dropped the database and removed the directory. The two cannot be made atomic:
the `DROP DATABASE` is a call into the server and fails whenever the server is
gone, which is routine under a stress run, while the `rm -rf` is local and
always succeeds.

What that left behind was a `Filesystem` database whose path no longer existed,
and `loadMetadata` aborts on it:

    Application: Caught exception while loading metadata: Code: 36.
    DB::Exception: Path does not exist:
    /var/lib/clickhouse/user_files/05057_file_rename_after_processing_write_grant_test_...:
    while loading database `fsdb_...` from file metadata/fsdb_....sql. (BAD_ARGUMENTS)

Every subsequent start of that server hit the same exception, so the job died
with `Cannot start clickhouse-server: server process is not running after 11
start attempts` and lost everything the stress run had left to check. Since the
test was added on 2026-09-04 this has been failing stress jobs on `master` and
on more than 20 unrelated pull requests, across `arm_tsan`, `amd_tsan`,
`arm_msan`, `amd_msan` and `arm_asan_ubsan, s3`.

Removing only the files keeps the directory the database points at, so a
database that survives the cleanup resolves and the server starts.

This does not address the second half of the issue - that a `Filesystem`
database with a missing directory prevents the whole server from starting,
rather than making one database unavailable - which is left for a separate
decision.

Closes: #118772
@clickhouse-gh

clickhouse-gh Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3534c14]

Summary: ✅


AI Review

Summary

The PR updates 05057_file_rename_after_processing_write_grant.sh so the test cleanup removes only its *.csv files and leaves the backing user_files directory in place. That matches the stated contract: if the server is restarted between the test's manual DROP DATABASE cleanup and the local filesystem cleanup, the leftover Filesystem database still points at an existing path and no longer prevents the next server start. I reviewed the current diff, the full test, the existing PR discussion, and the relevant stateless-test runner behavior, and I did not find an actionable correctness, cleanup-order, or PR-metadata problem in the change.

Final Verdict

✅ No findings. No inline review comments were posted.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Sep 8, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Sep 8, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 8, 2026
Merged via the queue into master with commit df764fa Sep 8, 2026
343 of 344 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-05057-filesystem-db-cleanup branch September 8, 2026 20:28
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 8, 2026
@clickhouse-gh clickhouse-gh Bot added comp-table-functions Table functions for temporary read/write to external systems (FROM ... tableFunction()). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-table-functions Table functions for temporary read/write to external systems (FROM ... tableFunction()). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

2 participants