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
Reconcile terminology and method naming to 'used/unused segments'; Rename MetadataSegmentManager to MetadataSegmentsManager #7306
Changes from 51 commits
87556bc
e44e199
25de70d
fe13d9c
050bd3b
562f5b4
a6138da
cb6fe7f
164f783
d959bb0
01c4494
06ec389
09fab95
f4774e1
8d5200d
255f320
f34eef0
2ebb23c
ba8ed62
64b0404
231a529
a113231
abad3f3
cb1f3b0
a5840b8
f4283d2
559f2c8
93c12cd
dfc0dbb
553b804
886e580
77fc5e8
1258fa0
15cb9ae
c2c7547
9cd239e
a723553
26a8381
afcd301
1557acc
96bcab7
d934853
c3e488e
f65e654
5e8f3e4
697f0d5
66a23f9
d3882c4
4b9d992
b77a327
d355aa6
718bb23
19b7f3a
2a6bcff
22e71d1
c575e6e
c5d22a0
285ebc9
53f572a
da7667c
91a5c8c
a566b6d
6da0b9d
d0bf20a
10587c1
2ad6dd5
6745f4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,22 +88,22 @@ enum State | |
|
||
// (start partitionId, end partitionId) -> minorVersion -> atomicUpdateGroup | ||
private final TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> standbyGroups; | ||
private final TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> visibleGroup; | ||
private final TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> visibleGroups; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I intentionally used the singular form here to say that there is only one visibleGroup in any case. Perhaps the code should be refactored to be more clear. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I renamed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds good to me. Thanks for adding a comment. |
||
private final TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> overshadowedGroups; | ||
|
||
OvershadowableManager() | ||
{ | ||
this.knownPartitionChunks = new HashMap<>(); | ||
this.standbyGroups = new TreeMap<>(); | ||
this.visibleGroup = new TreeMap<>(); | ||
this.visibleGroups = new TreeMap<>(); | ||
this.overshadowedGroups = new TreeMap<>(); | ||
} | ||
|
||
OvershadowableManager(OvershadowableManager<T> other) | ||
{ | ||
this.knownPartitionChunks = new HashMap<>(other.knownPartitionChunks); | ||
this.standbyGroups = new TreeMap<>(other.standbyGroups); | ||
this.visibleGroup = new TreeMap<>(other.visibleGroup); | ||
this.visibleGroups = new TreeMap<>(other.visibleGroups); | ||
this.overshadowedGroups = new TreeMap<>(other.overshadowedGroups); | ||
} | ||
|
||
|
@@ -123,7 +123,7 @@ private TreeMap<RootPartitionRange, Short2ObjectSortedMap<AtomicUpdateGroup<T>>> | |
case STANDBY: | ||
return standbyGroups; | ||
case VISIBLE: | ||
return visibleGroup; | ||
return visibleGroups; | ||
case OVERSHADOWED: | ||
return overshadowedGroups; | ||
default: | ||
|
@@ -669,7 +669,7 @@ boolean addChunk(PartitionChunk<T> chunk) | |
final AtomicUpdateGroup<T> newAtomicUpdateGroup = new AtomicUpdateGroup<>(chunk); | ||
|
||
// Decide the initial state of the new atomicUpdateGroup | ||
final boolean overshadowed = visibleGroup | ||
final boolean overshadowed = visibleGroups | ||
.values() | ||
.stream() | ||
.flatMap(map -> map.values().stream()) | ||
|
@@ -785,7 +785,7 @@ private List<AtomicUpdateGroup<T>> findLatestNonFullyAvailableAtomicUpdateGroups | |
} | ||
|
||
final List<AtomicUpdateGroup<T>> visibles = new ArrayList<>(); | ||
for (Short2ObjectSortedMap<AtomicUpdateGroup<T>> map : manager.visibleGroup.values()) { | ||
for (Short2ObjectSortedMap<AtomicUpdateGroup<T>> map : manager.visibleGroups.values()) { | ||
visibles.addAll(map.values()); | ||
} | ||
return visibles; | ||
|
@@ -807,7 +807,7 @@ private List<AtomicUpdateGroup<T>> findLatestFullyAvailableOvershadowedAtomicUpd | |
|
||
final OvershadowableManager<T> manager = new OvershadowableManager<>(overshadowedGroups); | ||
final List<AtomicUpdateGroup<T>> visibles = new ArrayList<>(); | ||
for (Short2ObjectSortedMap<AtomicUpdateGroup<T>> map : manager.visibleGroup.values()) { | ||
for (Short2ObjectSortedMap<AtomicUpdateGroup<T>> map : manager.visibleGroups.values()) { | ||
for (AtomicUpdateGroup<T> atomicUpdateGroup : map.values()) { | ||
if (!atomicUpdateGroup.isFull()) { | ||
return Collections.emptyList(); | ||
|
@@ -885,12 +885,12 @@ PartitionChunk<T> removeChunk(PartitionChunk<T> partitionChunk) | |
|
||
public boolean isEmpty() | ||
{ | ||
return visibleGroup.isEmpty(); | ||
return visibleGroups.isEmpty(); | ||
} | ||
|
||
public boolean isComplete() | ||
{ | ||
return visibleGroup.values().stream().allMatch(map -> Iterables.getOnlyElement(map.values()).isFull()); | ||
return visibleGroups.values().stream().allMatch(map -> Iterables.getOnlyElement(map.values()).isFull()); | ||
} | ||
|
||
@Nullable | ||
|
@@ -915,7 +915,7 @@ PartitionChunk<T> getChunk(int partitionId) | |
|
||
List<PartitionChunk<T>> getVisibleChunks() | ||
{ | ||
return getAllChunks(visibleGroup); | ||
return getAllChunks(visibleGroups); | ||
} | ||
|
||
List<PartitionChunk<T>> getOvershadowedChunks() | ||
|
@@ -954,14 +954,14 @@ public boolean equals(Object o) | |
OvershadowableManager<?> that = (OvershadowableManager<?>) o; | ||
return Objects.equals(knownPartitionChunks, that.knownPartitionChunks) && | ||
Objects.equals(standbyGroups, that.standbyGroups) && | ||
Objects.equals(visibleGroup, that.visibleGroup) && | ||
Objects.equals(visibleGroups, that.visibleGroups) && | ||
Objects.equals(overshadowedGroups, that.overshadowedGroups); | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash(knownPartitionChunks, standbyGroups, visibleGroup, overshadowedGroups); | ||
return Objects.hash(knownPartitionChunks, standbyGroups, visibleGroups, overshadowedGroups); | ||
} | ||
|
||
@Override | ||
|
@@ -970,7 +970,7 @@ public String toString() | |
return "OvershadowableManager{" + | ||
"knownPartitionChunks=" + knownPartitionChunks + | ||
", standbyGroups=" + standbyGroups + | ||
", visibleGroup=" + visibleGroup + | ||
", visibleGroups=" + visibleGroups + | ||
", overshadowedGroups=" + overshadowedGroups + | ||
'}'; | ||
} | ||
|
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 you add a javadoc saying when it can be null? Perhaps it would be
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 suggestion, applied