-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ReplicatedMapProxy - refactored check and retry initialization logic ... #14331
Conversation
Hi @netudima ! After 1.5 years, we finally managed to take a look at the PR. To be honest, we haven't been good stewards of community PRs but things are changing around here. I believe your PR makes perfect sense but there are a couple of small improvements I'd add here. First off, I think you can use Secondly, since we're now adding support for many partitions (20k, 50k), I think we need to "throttle" loading a bit so maybe just add some local variable that will keep track of how many concurrent loading processes there are. For now, let's limit it to something like 100 - we can always change that number later. And lastly, nitpicking - can you replace the If you're unable to continue with the PR since a lot of time has passed, we understand. I'll make sure we adopt the PR and continue with it and also mention you in the commit as the original author. |
Hi @mmedenjak, thank you for the feedback :-). I will take a look and try to address your comments during 1-2 weeks. |
Looks like the issue is checkstyle: If the issue persists after rebasing to latest master, I think you can ignore it, like here. |
…to do it in parallel for different partitions. It is much faster compared to the original way - try to sync a partition and sleep.
a499a49
to
64daef9
Compare
…aneously sent requestDataForPartition
@mmedenjak, I have updated the PR based on the comments. Regarding |
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.
Looks good, added one minor observation and one suggested change. Thank you for rebasing the fix!
hazelcast/src/main/java/com/hazelcast/replicatedmap/impl/ReplicatedMapProxy.java
Show resolved
Hide resolved
int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); | ||
BitSet nonLoadedStores = new BitSet(partitionCount); | ||
int[] retryCount = new int[partitionCount]; | ||
for (int i = 0; i < partitionCount; i++) { |
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.
Minor: you can use nonLoadedStores.set(0, partitionCount);
instead of looping.
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 even better option is possible :-) - I can rename the set to loadedStores
and mark a bit as set when a partition loading is completed. In this case the init logic is not required.
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 tried doing something similar but beware in that the nextClearBit
will never return -1 but might instead return a number which is even out of the partition ID range. So if all partitions are loaded, loadedPartitions.nextClearBit()
will return partitionCount + 1
@netudima thanks for your PR, much appreciated. |
It is a bit tricky, because the code from the issue shows a difference in a loading time, not in a functional behaviour. Maybe it can be tested using a test with timeout (but it can be unreliable when a test is running on a different hardware). Do you have some examples of unit tests with timeouts in Hazelcast codebase? |
@netudima I agree with you, i couldn't think of a solid test that wouldn't cause more pain to maintain. |
And after several years, we managed to get you to make a contribution. Thank you and here's a medal 🥇 cc @Holmistr If you want, you can pick another issue. I can say right now everyone's a bit busy but we try to get community PRs merged faster these days. |
🥳, thank you a lot for your help |
…... (hazelcast#14331) ReplicatedMapProxy - refactored check and retry initialization logic to do it in parallel for different partitions. It is much faster compared to the original way - try to sync a partition and sleep.
…to do it in parallel for different partitions. It is much faster compared to the original way - try to sync a partition and sleep.
Fixes #14330