Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -127,7 +128,7 @@ public AssignmentStats importFiles(List<String> files) {
final Map<Path,List<KeyExtent>> completeFailures =
Collections.synchronizedSortedMap(new TreeMap<>());

final Map<Path,FileStatus> fileStatuses = new HashMap<>();
final Map<Path,FileStatus> fileStatuses = new ConcurrentHashMap<>();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed multiple threads were interacting w/ this map so changed the type to ensure threads see what other threads put in the map.


ClientService.Client client = null;
final TabletLocator locator = TabletLocator.getLocator(context, tableId);
Expand All @@ -147,9 +148,11 @@ public AssignmentStats importFiles(List<String> files) {
List<TabletLocation> tabletsToAssignMapFileTo = Collections.emptyList();
try {
FileStatus status = fs.getFileStatus(mapFile);
fileStatuses.put(mapFile, status);
tabletsToAssignMapFileTo = findOverlappingTablets(context, fs, locator, mapFile,
tableConf.getCryptoService(), status);
// Only add to map if there was no exception, just in case stale informatoin in
// filestatus caused the error.
fileStatuses.put(mapFile, status);
} catch (Exception ex) {
log.warn("Unable to find tablets that overlap file " + mapFile, ex);
}
Expand Down Expand Up @@ -223,6 +226,9 @@ public AssignmentStats importFiles(List<String> files) {
keListIter.remove();
} catch (Exception ex) {
log.warn("Exception finding overlapping tablets, will retry tablet " + ke, ex);
// Maybe information in the file status like block locations is stale and caused the
// error. Remove the file status to force reading file metadata from namenode.
fileStatuses.remove(entry.getKey());
}
timer.stop(Timers.QUERY_METADATA);
}
Expand Down
Loading