DomGarguilo commented on code in PR #3980:
URL: https://github.com/apache/accumulo/pull/3980#discussion_r1447952887
##########
core/src/main/java/org/apache/accumulo/core/util/Merge.java:
##########
@@ -149,17 +148,37 @@ public void mergomatic(AccumuloClient client, String
table, Text start, Text end
throw new IllegalArgumentException("cannot merge tablets on the
metadata table");
}
List<Size> sizes = new ArrayList<>();
- long totalSize = 0;
- // Merge any until you get larger than the goal size, and then merge one
less tablet
- Iterator<Size> sizeIterator = getSizeIterator(client, table, start, end);
- while (sizeIterator.hasNext()) {
- Size next = sizeIterator.next();
- totalSize += next.size;
- sizes.add(next);
- if (totalSize > goalSize) {
- totalSize = mergeMany(client, table, sizes, goalSize, force, false);
- }
+ AtomicLong totalSize = new AtomicLong();
+
+ TableId tableId;
+ ClientContext context = (ClientContext) client;
+ try {
+ tableId = context.getTableId(table);
+ } catch (Exception e) {
+ throw new MergeException(e);
+ }
+ try (TabletsMetadata tablets =
TabletsMetadata.builder(context).scanMetadataTable()
+ .overRange(new KeyExtent(tableId, end,
start).toMetaRange()).fetch(FILES, PREV_ROW)
+ .build()) {
+ tablets.stream().map(tm -> {
+ long size =
tm.getFilesMap().values().stream().mapToLong(DataFileValue::getSize).sum();
+ return new Size(tm.getExtent(), size);
+ }).forEach(next -> {
Review Comment:
I moved back to an iterator in a2122ee
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]