bsglz commented on a change in pull request #1737:
URL: https://github.com/apache/hbase/pull/1737#discussion_r433122611
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SequenceIdAccounting.java
##########
@@ -440,27 +434,27 @@ boolean areAllLower(Map<byte[], Long> sequenceids,
Collection<byte[]> keysBlocki
* {@link #lowestUnflushedSequenceIds} has a sequence id less than that
passed in
* <code>sequenceids</code> then return it.
* @param sequenceids Sequenceids keyed by encoded region name.
- * @return regions found in this instance with sequence ids less than those
passed in.
+ * @return stores of regions found in this instance with sequence ids less
than those passed in.
*/
- byte[][] findLower(Map<byte[], Long> sequenceids) {
- List<byte[]> toFlush = null;
+ Map<byte[], List<byte[]>> findLower(Map<byte[], Long> sequenceids) {
+ Map<byte[], List<byte[]>> toFlush = null;
// Keeping the old behavior of iterating unflushedSeqNums under
oldestSeqNumsLock.
synchronized (tieLock) {
for (Map.Entry<byte[], Long> e : sequenceids.entrySet()) {
Map<ImmutableByteArray, Long> m =
this.lowestUnflushedSequenceIds.get(e.getKey());
if (m == null) {
continue;
}
- // The lowest sequence id outstanding for this region.
- long lowest = getLowestSequenceId(m);
- if (lowest != HConstants.NO_SEQNUM && lowest <= e.getValue()) {
- if (toFlush == null) {
- toFlush = new ArrayList<>();
+ for (Map.Entry<ImmutableByteArray, Long> me : m.entrySet()) {
+ if (me.getValue() <= e.getValue()) {
+ if (toFlush == null) {
+ toFlush = new TreeMap(Bytes.BYTES_COMPARATOR);
+ }
+ toFlush.computeIfAbsent(e.getKey(), k -> new
ArrayList<>()).add(Bytes.toBytes(me.getKey().toString()));
}
- toFlush.add(e.getKey());
}
}
}
- return toFlush == null ? null : toFlush.toArray(new byte[0][]);
+ return toFlush == null ? null : toFlush;
Review comment:
Oh, awkward.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]