VGalaxies commented on code in PR #15276:
URL: https://github.com/apache/iotdb/pull/15276#discussion_r2031376144
##########
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:
It seems unnecessary, as memory control has already been implemented in the
outer layer using PipeTreeModelTsFileBuilder, such as PipeTabletEventBatch.
We should clearly identify whether the caller or callee performs memory
control, and here it is the caller.
--
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]