Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible intersecting parts for MergeTree (after moving to detached failed) #70476

Merged

Conversation

azat
Copy link
Collaborator

@azat azat commented Oct 8, 2024

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Fix possible intersecting parts for MergeTree (after moving to detached failed)

MergeTree is fragile in this case, since the source of truth for it is
the filesystem and it will be left in an inconsistent state.

Image the following:

  • during startup you got some broken part, that should be moved to
    detached
  • this rename throws exception (i.e. permission error)
  • but this error is ignored, server continues, and tries to merge
    something that produces intersecting parts for that broken part
  • later on restart you will got intersecting parts (since at the time of
    scanning for intersecting parts, the part is not checked)

So the error should not be ignored.

Also adjust the error message slightly (remove ZooKeeper mention) and ignore only ErrnoException/std::filesystem::filesystem_error.

Initially introduced in: #13544 (cc @amosbird)

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-bugfix Pull request with bugfix, not backported by default label Oct 8, 2024
@robot-clickhouse-ci-1
Copy link
Contributor

robot-clickhouse-ci-1 commented Oct 8, 2024

This is an automated comment for commit 50fc035 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
Bugfix validationChecks that either a new test (functional or integration) or there some changed tests that fail with the binary built on master branch❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success

@azat
Copy link
Collaborator Author

azat commented Oct 8, 2024

Stateless tests (aarch64) — Some tests restarted, fail: 1, passed: 7104, skipped: 14
Stateless tests (tsan, s3 storage) [2/3] — fail: 1, passed: 2318, skipped: 68

@azat
Copy link
Collaborator Author

azat commented Oct 24, 2024

Can someone take a look please?

@azat
Copy link
Collaborator Author

azat commented Nov 6, 2024

Kind ping

@azat azat force-pushed the fix-possible-intersecting-parts-in-mt branch from cffc891 to f51050d Compare November 6, 2024 10:21
@azat
Copy link
Collaborator Author

azat commented Nov 28, 2024

Kind ping

@azat
Copy link
Collaborator Author

azat commented Nov 28, 2024

@tavplubix maybe you can take a look?

@tavplubix tavplubix self-assigned this Nov 28, 2024
src/Storages/MergeTree/MergeTreeData.cpp Outdated Show resolved Hide resolved
@azat azat force-pushed the fix-possible-intersecting-parts-in-mt branch 2 times, most recently from 86b883b to 498389a Compare November 28, 2024 17:24
@azat
Copy link
Collaborator Author

azat commented Dec 1, 2024

CI:

Rebased

@azat azat force-pushed the fix-possible-intersecting-parts-in-mt branch from 498389a to 39b32a2 Compare December 1, 2024 18:47
azat and others added 3 commits December 3, 2024 22:34
…from common code)

It could happen for MergeTree as well.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
MergeTree is fragile in this case, since the source of truth for it is
the filesystem and it will be left in an inconsistent state.

Image the following:
- during startup you got some broken part, that should be moved to
  detached
- this rename throws exception (i.e. permission error)
- but this error is ignored, server continues, and tries to merge
  something that produces intersecting parts for that broken part
- later on restart you will got intersecting parts (since at the time of
  scanning for intersecting parts, the part is not checked)

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Co-authored-by: Alexander Tokmakov <tavplubix@clickhouse.com>
… detached

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
@azat
Copy link
Collaborator Author

azat commented Dec 3, 2024

This branch has conflicts that must be resolved
src/Storages/MergeTree/IMergeTreeDataPart.cpp

Rebased

CH Inc synctests failed

Hope will be fixed as well

@azat azat force-pushed the fix-possible-intersecting-parts-in-mt branch from 39b32a2 to 50fc035 Compare December 3, 2024 21:36
@azat
Copy link
Collaborator Author

azat commented Dec 4, 2024

CH Inc syncFailed. Needs manual intervention. See job ID for details:33877795291

Apparently it requires some manual intervention

@tavplubix
Copy link
Member

Yes. Please do not force push to restart the CI. The reason I didn't merge it is not some flaky tests. The reason is that I had to resolve a conflict in "CH Inc sync", but every force push resets it :)

@tavplubix tavplubix added this pull request to the merge queue Dec 5, 2024
Merged via the queue into ClickHouse:master with commit 551605a Dec 5, 2024
215 of 219 checks passed
@azat azat deleted the fix-possible-intersecting-parts-in-mt branch December 5, 2024 13:05
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants