KYLIN-4397 Use newLinkedHashMap for deterministic order in AssignmentUtil.java #1133
Merged
shaofengshi merged 1 commit intoapache:masterfrom Mar 26, 2020
Conversation
Member
|
I am a little confused at the moment. From your message in JIRA issue, you found that error : java.lang.AssertionError: expected:<2> but was:<1>
at org.apache.kylin.stream.coordinator.assign.DefaultAssignerTest.reBalanceTest(DefaultAssignerTest.java:165) when executing assertEquals(2, rsAssignment.size());You claim that public Map<Integer, Map<String, List<Partition>>> reBalancePlan(List<ReplicaSet> replicaSets,
List<StreamingCubeInfo> cubes, List<CubeAssignment> existingAssignments) {
Map<Integer, Map<String, List<Partition>>> newPlan = Maps.newHashMap();
if (replicaSets == null || cubes == null || cubes.size() == 0 || replicaSets.size() == 0) {
return newPlan;
}So, maybe you change the implementation of Finally , I didn't reproduce this kind of error in my dev env. I felt confused too. |
Member
|
@cpugputpu Hi, if I misunderstand anything, please let me know, thank you in advance. |
hit-lacus
reviewed
Mar 17, 2020
Member
hit-lacus
left a comment
There was a problem hiding this comment.
Looks like it is not necessary code change. Hope author will give more explanation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims to solve the issue here: https://issues.apache.org/jira/browse/KYLIN-4397
The fix is to use
newLinkedHashMapinstead ofnewHashMapwhen initializing a Map. In this way, the non-deterministic behaviour is eliminated and the test will not suffer from the failure again. The code will be more stable.