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

When the leader node is faulty, the flag for re-sharding cannot be set. #2449

Open
ExploreHeart opened this issue Oct 11, 2024 · 0 comments
Open

Comments

@ExploreHeart
Copy link

When the leader node is faulty, the flag for re-sharding cannot be set.
After the leader node is reselected, the re-sharding flag is not set. As a result, the faulty shard cannot be executed.
@TeslaCN
#1472

Solution:

class LeaderElectionJobListener implements DataChangedEventListener {
        
        @Override
        public void onChange(final DataChangedEvent event) {
            if (!JobRegistry.getInstance().isShutdown(jobName) && (isActiveElection(event.getKey(), event.getValue()) || isPassiveElection(event.getKey(), event.getType()))) {
                leaderService.electLeader();
               // Trigger failover and set shard identifiers.
                shardingService.setReshardingFlag();
                failoverService.failoverIfNecessary();
            }
        }
}
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

No branches or pull requests

1 participant