Dyqer opened a new pull request, #15194:
URL: https://github.com/apache/dolphinscheduler/pull/15194
<!--Thanks very much for contributing to Apache DolphinScheduler, we are
happy that you want to help us improve DolphinScheduler! -->
## Purpose of the pull request
Now we will assign the commands to our masters through the command id, but
the command id generator is depends on the mysql increment step, if the
increment step equals the master size, it will always assign the commands to
the first master.
So we use the hash id to assign the commands, i write some code to check the
distribution, it looks not bad
```java
import org.apache.commons.codec.digest.DigestUtils;
/**
* @Author: Leoric Yue
* @ModuleOwner: Ethan Sang
* @Date: 11/21/2023 10:30
* @Description: HashTest
*/
public class HashTest {
public static void main(String[] args) {
int k = 7; // number of masters
int limit = 900000000;
int[] res = new int[k];
for (int id = 100000000; id <= 900000000; id += k) {
long hashId = hashCommandId(id);
long r = hashId % k;
res[(int) r] += 1;
}
for (int i = 0; i < k; i++) {
System.out.println(i + ": " + res[i]);
}
}
private static long hashCommandId(Integer commandId) {
String md5 = DigestUtils.md5Hex(String.valueOf(commandId));
return Integer.valueOf(md5.substring(0, 4), 16);
}
}
```
```
0: 16330315
1: 16331143
2: 16318265
3: 16329685
4: 16324449
5: 16325290
6: 16326568
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]