|
@@ -596,14 +596,13 @@ public class DirectoryScanner implements Runnable {
|
|
|
diffs.put(bpid, diffRecord);
|
|
|
|
|
|
statsRecord.totalBlocks = blockpoolReport.length;
|
|
|
- List<FinalizedReplica> bl = dataset.getFinalizedBlocks(bpid);
|
|
|
- FinalizedReplica[] memReport = bl.toArray(new FinalizedReplica[bl.size()]);
|
|
|
- Arrays.sort(memReport); // Sort based on blockId
|
|
|
-
|
|
|
+ final List<FinalizedReplica> bl = dataset.getFinalizedBlocks(bpid);
|
|
|
+ Collections.sort(bl); // Sort based on blockId
|
|
|
+
|
|
|
int d = 0; // index for blockpoolReport
|
|
|
int m = 0; // index for memReprot
|
|
|
- while (m < memReport.length && d < blockpoolReport.length) {
|
|
|
- FinalizedReplica memBlock = memReport[m];
|
|
|
+ while (m < bl.size() && d < blockpoolReport.length) {
|
|
|
+ FinalizedReplica memBlock = bl.get(m);
|
|
|
ScanInfo info = blockpoolReport[d];
|
|
|
if (info.getBlockId() < memBlock.getBlockId()) {
|
|
|
if (!dataset.isDeletingBlock(bpid, info.getBlockId())) {
|
|
@@ -650,8 +649,8 @@ public class DirectoryScanner implements Runnable {
|
|
|
++m;
|
|
|
}
|
|
|
}
|
|
|
- while (m < memReport.length) {
|
|
|
- FinalizedReplica current = memReport[m++];
|
|
|
+ while (m < bl.size()) {
|
|
|
+ FinalizedReplica current = bl.get(m++);
|
|
|
addDifference(diffRecord, statsRecord,
|
|
|
current.getBlockId(), current.getVolume());
|
|
|
}
|