DomGarguilo commented on code in PR #3980:
URL: https://github.com/apache/accumulo/pull/3980#discussion_r1408272098


##########
core/src/main/java/org/apache/accumulo/core/util/Merge.java:
##########
@@ -244,21 +244,20 @@ protected Iterator<Size> getSizeIterator(AccumuloClient 
client, String tablename
     // open up metadata, walk through the tablets.
 
     TableId tableId;
-    TabletsMetadata tablets;
+    ClientContext context = (ClientContext) client;
     try {
-      ClientContext context = (ClientContext) client;
       tableId = context.getTableId(tablename);
-      tablets = TabletsMetadata.builder(context).scanMetadataTable()
-          .overRange(new KeyExtent(tableId, end, 
start).toMetaRange()).fetch(FILES, PREV_ROW)
-          .build();
     } catch (Exception e) {
       throw new MergeException(e);
     }
-
-    return tablets.stream().map(tm -> {
-      long size = 
tm.getFilesMap().values().stream().mapToLong(DataFileValue::getSize).sum();
-      return new Size(tm.getExtent(), size);
-    }).iterator();
+    try (TabletsMetadata tablets = 
TabletsMetadata.builder(context).scanMetadataTable()

Review Comment:
   Addressed in cc9bc8a by creating the iterator off a new collection so that 
it does not rely on the underlying `TabletsMetadata` anymore so it can be 
closed.



##########
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/bulkVer2/PrepBulkImport.java:
##########
@@ -205,10 +205,13 @@ private KeyExtent checkForMerge(final long tid, final 
Manager manager) throws Ex
     try (LoadMappingIterator lmi =
         BulkSerialize.readLoadMapping(bulkDir.toString(), bulkInfo.tableId, 
fs::open)) {
 
-      TabletIterFactory tabletIterFactory =
-          startRow -> 
TabletsMetadata.builder(manager.getContext()).forTable(bulkInfo.tableId)
-              .overlapping(startRow, 
null).checkConsistency().fetch(PREV_ROW).build().stream()
-              .map(TabletMetadata::getExtent).iterator();
+      TabletIterFactory tabletIterFactory = startRow -> {
+        try (TabletsMetadata tabletsMetadata =
+            
TabletsMetadata.builder(manager.getContext()).forTable(bulkInfo.tableId)
+                .overlapping(startRow, 
null).checkConsistency().fetch(PREV_ROW).build()) {
+          return 
tabletsMetadata.stream().map(TabletMetadata::getExtent).iterator();

Review Comment:
   Addressed in cc9bc8a by creating the iterator off a new collection so that 
it does not rely on the underlying `TabletsMetadata` anymore so it can be 
closed.



-- 
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]

Reply via email to