Skip to content

Commit

Permalink
Merge f576b3c into 88ec830
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcclp committed Aug 8, 2019
2 parents 88ec830 + f576b3c commit d33a246
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
Expand Up @@ -2739,14 +2739,30 @@ public static void copyCarbonDataFileToCarbonStorePath(String localFilePath,
LOGGER.info(String.format("Copying %s to %s, operation id %d", localFilePath,
carbonDataDirectoryPath, copyStartTime));
try {
CarbonFile localCarbonFile =
FileFactory.getCarbonFile(localFilePath, FileFactory.getFileType(localFilePath));
CarbonFile localCarbonFile = FileFactory.getCarbonFile(localFilePath);
// the size of local carbon file must be greater than 0
if (localCarbonFile.getSize() == 0L) {
LOGGER.error("The size of local carbon file: " + localFilePath + " is 0.");
throw new CarbonDataWriterException("The size of local carbon file is 0.");
}
String carbonFilePath = carbonDataDirectoryPath + localFilePath
.substring(localFilePath.lastIndexOf(File.separator));
copyLocalFileToCarbonStore(carbonFilePath, localFilePath,
CarbonCommonConstants.BYTEBUFFER_SIZE,
getMaxOfBlockAndFileSize(fileSizeInBytes, localCarbonFile.getSize()));
} catch (IOException e) {
CarbonFile targetCarbonFile = FileFactory.getCarbonFile(carbonFilePath);
// the size of carbon file must be greater than 0
// and the same as the size of local carbon file
if (targetCarbonFile.getSize() == 0L ||
(targetCarbonFile.getSize() != localCarbonFile.getSize())) {
LOGGER.error("The size of carbon file: " + carbonFilePath + " is 0 "
+ "or is not the same as the size of local carbon file: ("
+ "carbon file size=" + targetCarbonFile.getSize()
+ ", local carbon file size=" + localCarbonFile.getSize() + ")");
throw new CarbonDataWriterException("The size of carbon file is 0 "
+ "or is not the same as the size of local carbon file.");
}
} catch (Exception e) {
throw new CarbonDataWriterException(
"Problem while copying file from local store to carbon store", e);
}
Expand Down

0 comments on commit d33a246

Please sign in to comment.