-
Notifications
You must be signed in to change notification settings - Fork 93
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
Implementation of Redlock #271
Conversation
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.
Thanks for doing this. It looks good. Some minor code changes and comment requests.
Will have a second pass after the first round is addressed.
dyno-contrib/src/main/java/com/netflix/dyno/contrib/ArchaiusConnectionPoolConfiguration.java
Outdated
Show resolved
Hide resolved
dyno-contrib/src/main/java/com/netflix/dyno/contrib/consul/ConsulHostsSupplier.java
Outdated
Show resolved
Hide resolved
dyno-core/src/main/java/com/netflix/dyno/connectionpool/ConnectionPoolConfiguration.java
Show resolved
Hide resolved
...core/src/main/java/com/netflix/dyno/connectionpool/impl/ConnectionPoolConfigurationImpl.java
Outdated
Show resolved
Hide resolved
dyno-jedis/src/main/java/com/netflix/dyno/jedis/DynoJedisUtils.java
Outdated
Show resolved
Hide resolved
dyno-recipes/src/main/java/com/netflix/dyno/recipes/lock/DynoLockClient.java
Outdated
Show resolved
Hide resolved
dyno-recipes/src/main/java/com/netflix/dyno/recipes/lock/DynoLockClient.java
Outdated
Show resolved
Hide resolved
dyno-recipes/src/main/java/com/netflix/dyno/recipes/lock/DynoLockClient.java
Show resolved
Hide resolved
dyno-recipes/src/main/java/com/netflix/dyno/recipes/lock/DynoLockClient.java
Show resolved
Hide resolved
dyno-recipes/src/main/java/com/netflix/dyno/recipes/lock/DynoLockClient.java
Show resolved
Hide resolved
2942281
to
39f09af
Compare
dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/HostsUpdater.java
Outdated
Show resolved
Hide resolved
List<String> racks = numHostsPerRack.keySet().stream().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList()); | ||
for(String rack: racks) { | ||
// // Already have required number of hosts for voting. Do not take any more. | ||
// if(numHostsRequired.get() <= 0) { |
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.
Should we just remove this commented code?
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.
good point. this got left behind. will remove.
AtomicInteger numHostsRequired = new AtomicInteger(effectiveVotingSize); | ||
// Map to keep track of number of hosts to take for voting from this rack | ||
Map<String, Integer> numHosts = new HashMap<>(); | ||
// Sort racks to get the same order |
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.
Would this work reliably if we have the same rack names across DCs?
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.
resolved offline
// continue; | ||
// } | ||
// Need more hosts take as as many as you can from this rack. | ||
int v = (int) Math.min(numHostsRequired.get(), numHostsPerRack.get(rack)); |
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.
How do we handle the case where we don't have enough voting hosts? Eg: If we just get back one host from this?
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.
good point. added a check for an edge case.
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.
LGTM, thanks for addressing the review comments.
597038d
to
7b25392
Compare
Implementing redlock in Dyno.
Will add more tests. Starting PR to get some feedback to iterate.