Skip to content

Commit

Permalink
Fix set router epoch on runtime invalidate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeeshan Lokhandwala committed Dec 6, 2017
1 parent c48e731 commit 5d2f6ff
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions runtime/src/main/java/org/corfudb/runtime/CorfuRuntime.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,15 @@ private CompletableFuture<Layout> fetchLayout() {
// it is acceptable (at least the code on 10/13/2016 does not have issues)
// but setEpoch of routers needs to be synchronized as those variables are
// not local.
try {
l.getAllServers().stream().map(getRouterFunction).forEach(x ->
x.setEpoch(l.getEpoch()));
} catch (NetworkException ne) {
// We have already received the layout and there is no need to keep client waiting.
// NOTE: This is true assuming this happens only at router creation.
// If not we also have to take care of setting the latest epoch on Client Router.
log.warn("fetchLayout: Error getting router : {}", ne);
for (String server : l.getAllServers()) {
try {
getRouter(server).setEpoch(l.getEpoch());
} catch (NetworkException ne) {
// We have already received the layout and there is no need to keep client waiting.
// NOTE: This is true assuming this happens only at router creation.
// If not we also have to take care of setting the latest epoch on Client Router.
log.warn("fetchLayout: Error getting router : {}", ne);
}
}
layoutServers = l.getLayoutServers();
layout = layoutFuture;
Expand Down

0 comments on commit 5d2f6ff

Please sign in to comment.