jt2594838 commented on code in PR #15676:
URL: https://github.com/apache/iotdb/pull/15676#discussion_r2135000181
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/util/builder/PipeTsFileBuilder.java:
##########
@@ -81,27 +81,40 @@ private File getNextBaseDir() throws
DiskSpaceInsufficientException {
}
}
}
+ File baseDir = null;
+ for (int retryTimes = 0; retryTimes <= 1; retryTimes++) {
+ String folder = FOLDER_MANAGER.get().getNextFolder();
Review Comment:
Should not retry only once, the same below
for (int retryTimes = 0; retryTimes <=
FOLDER_MANAGER.get().numHealthyFolder(); retryTimes++) {
or
while(FOLDER_MANAGER.get().hasHealthyFolder())
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java:
##########
@@ -212,13 +212,25 @@ public void writeToDataRegion(DataRegion dataRegion,
LoadTsFilePieceNode pieceNo
uuid2WriterManager.computeIfAbsent(
uuid,
o -> {
- try {
- return new TsFileWriterManager(new File(getNextFolder(),
uuid));
- } catch (DiskSpaceInsufficientException e) {
- exception.set(e);
- return null;
+ String folder = null;
+ for (int retryTimes = 0; retryTimes <= 1; retryTimes++) {
+ try {
+ folder = getNextFolder();
+ return new TsFileWriterManager(new File(folder, uuid));
+ } catch (DiskSpaceInsufficientException e) {
+ exception.set(e);
+ return null;
+ } catch (Exception ignored) {
+ synchronized (FOLDER_MANAGER) {
+ FOLDER_MANAGER
+ .get()
+ .updateFolderState(folder,
FolderManager.FolderState.ABNORMAL);
+ }
+ }
}
+ return null;
});
Review Comment:
This retry (and the previous ones) had better be encapsulated within
FolderManager, like
`getNextWithRetry(Consumer<String> folderConsumer)`
--
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]