Github user KanakaKumar commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2517#discussion_r203411199
--- Diff:
core/src/main/java/org/apache/carbondata/core/fileoperations/AtomicFileOperationsImpl.java
---
@@ -70,12 +78,20 @@ public AtomicFileOperationsImpl(String filePath,
FileType fileType) {
if (null != dataOutStream) {
CarbonUtil.closeStream(dataOutStream);
CarbonFile tempFile = FileFactory.getCarbonFile(tempWriteFilePath,
fileType);
- if (!tempFile.renameForce(filePath)) {
- throw new IOException("temporary file renaming failed, src="
- + tempFile.getPath() + ", dest=" + filePath);
+ if (!this.setFailed) {
+ if (!tempFile.renameForce(filePath)) {
+ throw new IOException(
+ "temporary file renaming failed, src=" + tempFile.getPath()
+ ", dest=" + filePath);
+ }
}
+ } else {
+ LOGGER.warn("The temporary file renaming skipped due to I/O error,
deleting file "
+ + tempWriteFilePath);
}
}
+ @Override public void setFailed() {
--- End diff --
setFailed needs to be raised on Exception cases in the below usages of
AtomicFileOperations
-
org.apache.carbondata.core.datamap.status.DiskBasedDataMapStatusProvider#writeLoadDetailsIntoFile
-
org.apache.carbondata.core.metadata.SegmentFileStore#writeSegmentFile(org.apache.carbondata.core.metadata.SegmentFileStore.SegmentFile,
java.lang.String)
-
org.apache.carbondata.core.statusmanager.SegmentStatusManager#writeLoadMetadata
Please also handle any other references I missed.
---