Fix race conditions in CREATE/DROP of different replicas of ReplicatedMergeTree#11592
Merged
alexey-milovidov merged 4 commits intomasterfrom Jun 11, 2020
Merged
Conversation
Member
Author
|
PVS Ok. |
alesapin
approved these changes
Jun 11, 2020
Member
alesapin
left a comment
There was a problem hiding this comment.
I think it's quite a complicated solution, but I cannot propose something simpler. It will not work between concurrent drop/create between different versions but it's OK.
| else if (code == Coordination::ZNOTEMPTY) | ||
| { | ||
| throw Exception(fmt::format( | ||
| "The old table was not completely removed from ZooKeeper, {} still exists and may contain some garbage.", zookeeper_path), ErrorCodes::TABLE_WAS_NOT_DROPPED); |
Member
There was a problem hiding this comment.
How it's possible? We create both zookeeper_path and it's content in a single transaction bellow. It can be empty or doesn't exist.
Member
Author
There was a problem hiding this comment.
I think that it's not possible. And it does not reproduce in test.
I will change to code to LOGICAL_ERROR.
| ops.emplace_back(zkutil::makeCreateRequest(zookeeper_path, "", zkutil::CreateMode::Persistent)); | ||
|
|
||
| /// Check that the table is not being dropped right now. | ||
| ops.emplace_back(zkutil::makeCreateRequest(zookeeper_path + "/dropped", "", zkutil::CreateMode::Persistent)); |
Member
There was a problem hiding this comment.
interesting way to check that node doesn't exist)
Member
Author
There was a problem hiding this comment.
Yes, and I did not invent it :) It's already used in other places in code.
tavplubix
approved these changes
Jun 11, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix race conditions in CREATE/DROP of different replicas of ReplicatedMergeTree. Continue to work if the table was not removed completely from ZooKeeper or not created successfully. This fixes #11432.
Detailed description / Documentation draft:
See https://clickhouse-test-reports.s3.yandex.net/11580/e2c6d090192d870edffc40e40deeb4c14417e5be/functional_stateless_tests_(thread)/test_run.txt.out.log