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
*: ignore tombstone stores #4223
Conversation
Signed-off-by: Neil Shen <overvenus@gmail.com>
8bfbdb7
to
b682c27
Compare
Signed-off-by: Neil Shen <overvenus@gmail.com>
if store.get_state() != metapb::StoreState::Tombstone { | ||
Ok(store) | ||
} else { | ||
Err(Error::StoreTombstone(format!("{:?}", store))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why return error when the store is Tombstone
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tombstone stores are no longer belongs to the cluster, other TiKVs should ignore such stores. See more pingcap/tidb#9269
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seem we don't need to use a string for the StoreTombstone. maybe integer is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PD may return StoreTombston error too, but it does not contain a store id, so I choose string for simplicity.
let err = header.get_error(); | ||
match err.get_field_type() { | ||
ErrorType::ALREADY_BOOTSTRAPPED => Err(Error::ClusterBootstrapped(header.get_cluster_id())), | ||
ErrorType::NOT_BOOTSTRAPPED => Err(Error::ClusterNotBootstrapped(header.get_cluster_id())), | ||
ErrorType::INCOMPATIBLE_VERSION => Err(Error::Incompatible), | ||
_ => Err(box_err!(err.get_message())), | ||
ErrorType::STORE_TOMBSTONE => Err(Error::StoreTombstone(err.get_message().to_owned())), | ||
ErrorType::UNKNOWN => Err(box_err!(err.get_message())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the UNKNOWN error type will be returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on PD.
/test |
src/pd/client.rs
Outdated
} | ||
|
||
fn get_all_stores(&self) -> Result<Vec<metapb::Store>> { | ||
fn get_all_stores(&self, include_tombstone: bool) -> Result<Vec<metapb::Store>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think PD support such API is more elegant. BTW, how lightning interact with this API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lightning doesn't interact with TiKV stores directly, Importer does (src/import/import.rs
in this PR).
Importer uses this API to get all TiKV nodes to forward the "switch to import mode" or "compact cluster" command. It doesn't affect SST ingestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cc @nolouch What do you think? Is it ok to support this feature in PD side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to do that.
Signed-off-by: Neil Shen <overvenus@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Neil Shen <overvenus@gmail.com>
/run-all-tests |
PTAL |
@huachaohuang PTAL, thanks! |
When I first added this |
Yes, but it does not with to this PR, they all have the same API. Some users already met this bug, so I think we should merge this PR ASAP. |
@overvenus how about just fixing this in PD? |
Could we have a solution that can be easily cherry-picked to 2.1? |
Signed-off-by: Neil Shen <overvenus@gmail.com>
PTAL, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-all-tests |
/rebuild |
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
What have you changed? (mandatory)
Ignore tombstone stores.
What are the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
Unit tests.
Does this PR affect documentation (docs) update? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No.
Refer to a related PR or issue link (optional)
Fixes #4221
Cc pingcap/tidb#9269