luoluoyuyu commented on code in PR #15276:
URL: https://github.com/apache/iotdb/pull/15276#discussion_r2030837714


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/util/builder/PipeTreeModelTsFileBuilder.java:
##########
@@ -91,178 +105,201 @@ public synchronized void close() {
     isTabletAlignedList.clear();
   }
 
-  private List<Pair<String, File>> writeTabletsToTsFiles()
-      throws IOException, WriteProcessException {
-    final Map<String, List<Tablet>> device2Tablets = new HashMap<>();
-    final Map<String, Boolean> device2Aligned = new HashMap<>();
+  private List<Pair<String, File>> writeTabletsToTsFiles() throws 
WriteProcessException {
+    final List<Pair<String, File>> sealedFiles = new ArrayList<>();
+    try (final RestorableTsFileIOWriter writer = new 
RestorableTsFileIOWriter(createFile())) {
+      writeTabletsIntoOneFile(writer);
+      sealedFiles.add(new Pair<>(null, writer.getFile()));
+    } catch (final Exception e) {
+      LOGGER.warn(
+          "Batch id = {}: Failed to write tablets into tsfile, because {}",
+          currentBatchId.get(),
+          e.getMessage(),
+          e);
+      // TODO: handle ex
+      throw new WriteProcessException(e);
+    }
+
+    return sealedFiles;
+  }
+
+  private void writeTabletsIntoOneFile(final RestorableTsFileIOWriter writer) 
throws Exception {
+    // TODO: database & region
+    final String database = "test_db";
+    final String dataRegionId = "test_dr";
+    final IMemTable memTable = new PrimitiveMemTable(database, dataRegionId);

Review Comment:
   ```memTable.memSize()``` can get the memory used by MemTable. Here, the 
memory used by MemTable needs to be included in Pipe memory management.



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