Skip to content

Conversation

@ZhongJinHacker
Copy link
Contributor

Purpose of the pull request

close #17232

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(or)

Pull Request Notice

Pull Request Notice

If your pull request contains incompatible change, you should also add it to docs/docs/en/guide/upgrade/incompatible.md

@SbloodyS SbloodyS changed the title [fix-17232][master]: handle the problem that master nodes gains the same slot id [Fix-17232][master] handle the problem that master nodes gains the same slot id Jun 4, 2025
@SbloodyS SbloodyS added the bug Something isn't working label Jun 4, 2025
@SbloodyS SbloodyS added this to the 3.3.1 milestone Jun 4, 2025
@ruanwenjun
Copy link
Member

ruanwenjun commented Jun 4, 2025

@ZhongJinHacker Thanks for your patch, good catch!

It's better to sort the master list at MasterSlotManager#doReBalance, this component is used to manage the slot, other component don't need to take care of the slot(master order)

public void doReBalance(List<MasterServerMetadata> normalMasterServers) {
int tmpCurrentSlot = -1;
for (int i = 0; i < normalMasterServers.size(); i++) {
if (normalMasterServers.get(i).getAddress().equals(masterConfig.getMasterAddress())) {
tmpCurrentSlot = i;
break;
}
}
if (tmpCurrentSlot == -1) {
log.warn(
"Do rebalance failed, cannot found the current master: {} in the normal master clusters: {}. Please check the current master server status",
masterConfig.getMasterAddress(), normalMasterServers);
currentSlot = -1;
return;
}
if (totalSlots == normalMasterServers.size() && currentSlot == tmpCurrentSlot) {
log.debug("No need to rebalance, the currentSlot: {}, totalSlots: {} doesn't changed", currentSlot,
totalSlots);
return;
}
totalSlots = normalMasterServers.size();
currentSlot = tmpCurrentSlot;
log.info("Do rebalance success, current master slot: {}, total master slots: {}", currentSlot, totalSlots);
}

@ZhongJinHacker
Copy link
Contributor Author

ok, I will fix it

ruanwenjun
ruanwenjun previously approved these changes Jun 4, 2025
Copy link
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

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

LGTM

@ruanwenjun
Copy link
Member

Please run mvn spotless:apply to fix the code style.

@ZhongJinHacker
Copy link
Contributor Author

done

Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

+1

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 5, 2025

Copy link
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

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

LGTM

@ruanwenjun ruanwenjun merged commit 7266e3f into apache:dev Jun 5, 2025
72 of 74 checks passed
hackergin pushed a commit to hackergin/dolphinscheduler that referenced this pull request Jun 15, 2025
davidzollo pushed a commit to davidzollo/dolphinscheduler that referenced this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Master] when use K8S to deploy master nodes use scroll batch deploy mode, the master nodes may gain the same slot id

3 participants