|
26 | 26 | import org.apache.iotdb.commons.queryengine.common.SessionInfo; |
27 | 27 | import org.apache.iotdb.commons.queryengine.common.SqlDialect; |
28 | 28 | import org.apache.iotdb.commons.queryengine.utils.TimestampPrecisionUtils; |
| 29 | +import org.apache.iotdb.commons.utils.RetryUtils; |
29 | 30 | import org.apache.iotdb.db.conf.IoTDBDescriptor; |
30 | 31 | import org.apache.iotdb.db.exception.load.LoadAnalyzeException; |
31 | 32 | import org.apache.iotdb.db.exception.load.LoadAnalyzeInvalidPathException; |
|
43 | 44 | import org.apache.iotdb.db.queryengine.plan.relational.metadata.Metadata; |
44 | 45 | import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.LoadTsFile; |
45 | 46 | import org.apache.iotdb.db.queryengine.plan.statement.crud.LoadTsFileStatement; |
| 47 | +import org.apache.iotdb.db.storageengine.dataregion.modification.ModificationFile; |
46 | 48 | import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResource; |
47 | 49 | import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResourceStatus; |
48 | 50 | import org.apache.iotdb.db.storageengine.dataregion.utils.TsFileResourceUtils; |
|
69 | 71 | import java.io.FileNotFoundException; |
70 | 72 | import java.io.IOException; |
71 | 73 | import java.nio.BufferUnderflowException; |
| 74 | +import java.nio.file.Files; |
72 | 75 | import java.util.ArrayList; |
73 | 76 | import java.util.Arrays; |
74 | 77 | import java.util.Collections; |
@@ -490,14 +493,29 @@ && handleSingleMiniFile(i)) { |
490 | 493 | DataNodeQueryMessages.EMPTY_FILE_DETECTED_WILL_SKIP_LOADING_THIS_FILE, |
491 | 494 | tsFile.getAbsolutePath()); |
492 | 495 | if (isDeleteAfterLoad) { |
493 | | - org.apache.iotdb.commons.utils.FileUtils.deleteFileIfExist(tsFile); |
| 496 | + deleteFile(tsFile); |
| 497 | + deleteFile(new File(LoadUtil.getTsFileResourcePath(tsFile.getAbsolutePath()))); |
| 498 | + deleteFile(ModificationFile.getExclusiveMods(tsFile)); |
| 499 | + deleteFile(new File(LoadUtil.getTsFileModsV1Path(tsFile.getAbsolutePath()))); |
494 | 500 | } |
495 | 501 | } finally { |
496 | 502 | // reset the session info to the original one |
497 | 503 | context.setSession(sessionInfo); |
498 | 504 | } |
499 | 505 | } |
500 | 506 |
|
| 507 | + private void deleteFile(final File file) { |
| 508 | + try { |
| 509 | + RetryUtils.retryOnException( |
| 510 | + () -> { |
| 511 | + Files.deleteIfExists(file.toPath()); |
| 512 | + return null; |
| 513 | + }); |
| 514 | + } catch (final Exception e) { |
| 515 | + LOGGER.warn(DataNodeQueryMessages.DELETE_AFTER_LOADING_ERROR, file, e); |
| 516 | + } |
| 517 | + } |
| 518 | + |
501 | 519 | private boolean handleSingleMiniFile(final int i) throws FileNotFoundException { |
502 | 520 | final long startTime = System.nanoTime(); |
503 | 521 | try { |
|
0 commit comments