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

delete partition after fail #2788

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

yanchaomei
Copy link

What problem does this PR solve?

Problem Summary:
When the partition is successfully created on the metaserver, but fails to persist in the topology, we should go to the metaserver to delete the partition

What is changed and how it works?

What's Changed:

How it Works:

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@@ -222,6 +222,28 @@ void TopoUpdater::UpdatePartitionTopo(
LOG(WARNING) << "hearbeat report partition which is not in topo"
<< ", copysetId = " << copySetId
<< ", partitionId = " << it.GetPartitionId();

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a good idea to delete here. If you really want to do it, you'd better check inode and dentry numbers of this partition again and make sure it is empty.
This piece of code logic can directly call TopologyManager::DeletePartition.

Copy link
Author

Choose a reason for hiding this comment

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

I noticed that the logic in TopologyManager::DeletePartitio first fetches the corresponding partition from topology_. The situation we are facing now is that there is no corresponding partition in topology_.So, I added the DeleteAbnormalPartition function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Failure to create is just one of the cases where the partition exists in metaserver but not in mds, so to be on the safe side, it is best to check whether the partition is empty first.

You can split the original TopologyManager::DeletePartitio into a function, such as TopologyManager::DeletePartitionDirectly, which does not check whether it exists in mds, so TopologyManager::DeletePartitionDirectly can be reused by you and the original code at the same time, and you can There is no need to rewrite the sending logic again.

Signed-off-by: Yan Chao Mei <[email protected]>
@Cyber-SiKu
Copy link
Contributor

pls fix Code Formatter

@caoxianfei1
Copy link
Contributor

@yanchaomei Comlete it as soon as possible if have time.

@caoxianfei1 caoxianfei1 reopened this Nov 27, 2023
@yanchaomei
Copy link
Author

@yanchaomei Comlete it as soon as possible if have time.

get it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants