You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/07/23 19:50:19 UTC
[GitHub] [accumulo] hkeebler commented on a change in pull request #1287:
Fix #1273 Fix Bulk Messages
hkeebler commented on a change in pull request #1287: Fix #1273 Fix Bulk Messages
URL: https://github.com/apache/accumulo/pull/1287#discussion_r306501993
##########
File path: server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/PrepBulkImport.java
##########
@@ -179,37 +181,23 @@ private void checkForMerge(final Master master) throws Exception {
VolumeManager fs = master.getFileSystem();
final UniqueNameAllocator namer = master.getContext().getUniqueNameAllocator();
Path sourceDir = new Path(bulkInfo.sourceDir);
- FileStatus[] files = fs.listStatus(sourceDir);
+ List<FileStatus> files = BulkImport.filterInvalid(fs.listStatus(sourceDir));
Path bulkDir = createNewBulkDir(master.getContext(), fs, bulkInfo.tableId);
Path mappingFile = new Path(sourceDir, Constants.BULK_LOAD_MAPPING);
Map<String,String> oldToNewNameMap = new HashMap<>();
- for (FileStatus file : files) {
- final FileStatus fileStatus = file;
- final Path originalPath = fileStatus.getPath();
- String[] fileNameParts = originalPath.getName().split("\\.");
- String extension = "";
- boolean invalidFileName;
- if (fileNameParts.length > 1) {
- extension = fileNameParts[fileNameParts.length - 1];
- invalidFileName = !FileOperations.getValidExtensions().contains(extension);
- } else {
- invalidFileName = true;
- }
- if (invalidFileName) {
- log.warn("{} does not have a valid extension, ignoring", fileStatus.getPath());
- continue;
- }
- String newName = "I" + namer.getNextName() + "." + extension;
- Path newPath = new Path(bulkDir, newName);
- oldToNewNameMap.put(originalPath.getName(), newPath.getName());
+ for (FileStatus file : files) {
+ // since these are only valid files we know it has an extension
+ String newName =
+ "I" + namer.getNextName() + "." + FilenameUtils.getExtension(file.getPath().getName());
+ oldToNewNameMap.put(file.getPath().getName(), new Path(bulkDir, newName).getName());
}
// also have to move mapping file
- Path newMappingFile = new Path(bulkDir, mappingFile.getName());
- oldToNewNameMap.put(mappingFile.getName(), newMappingFile.getName());
+ oldToNewNameMap.put(mappingFile.getName(), new Path(bulkDir, mappingFile.getName()).getName());
Review comment:
except the latter is a "new" directory path "bulkdir"
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services