Skip to content

Commit

Permalink
Modify assignment datastore access.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajunwang committed Oct 18, 2019
1 parent 9bc9e03 commit 14d93ce
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,18 +509,18 @@ private Map<String, ResourceAssignment> getBaselineAssignment(
LatencyMetric.class);
stateReadLatency.startMeasuringLatency();
currentBaseline = assignmentMetadataStore.getBaseline();
currentBaseline.keySet().retainAll(resources);
stateReadLatency.endMeasuringLatency();
} catch (HelixException ex) {
LOG.error("Failed to get the current baseline assignment. Use the current states instead.",
ex);
currentBaseline = getCurrentStateAssingment(currentStateOutput, resources);
} catch (Exception ex) {
throw new HelixRebalanceException(
"Failed to get the current baseline assignment because of unexpected error.",
HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex);
}
}
if (currentBaseline.isEmpty()) {
LOG.warn("The current baseline assignment record is empty. Use the current states instead.");
currentBaseline = getCurrentStateAssingment(currentStateOutput, resources);
}
currentBaseline.keySet().retainAll(resources);
return currentBaseline;
}

Expand All @@ -543,19 +543,19 @@ private Map<String, ResourceAssignment> getBestPossibleAssignment(
LatencyMetric.class);
stateReadLatency.startMeasuringLatency();
currentBestAssignment = assignmentMetadataStore.getBestPossibleAssignment();
currentBestAssignment.keySet().retainAll(resources);
stateReadLatency.endMeasuringLatency();
} catch (HelixException ex) {
LOG.error(
"Failed to get the current best possible assignment. Use the current states instead.",
ex);
currentBestAssignment = getCurrentStateAssingment(currentStateOutput, resources);
} catch (Exception ex) {
throw new HelixRebalanceException(
"Failed to get the current best possible assignment because of unexpected error.",
HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex);
}
}
if (currentBestAssignment.isEmpty()) {
LOG.warn(
"The current best possible assignment record is empty. Use the current states instead.");
currentBestAssignment = getCurrentStateAssingment(currentStateOutput, resources);
}
currentBestAssignment.keySet().retainAll(resources);
return currentBestAssignment;
}

Expand Down

0 comments on commit 14d93ce

Please sign in to comment.