private void verifyLoc(long maxSize, StorageLocation loc) { Assert.assertEquals(maxSize, loc.available()); for (int i = 0; i <= maxSize; ++i) { Assert.assertTrue(String.valueOf(i), loc.canHandle(makeSegment("2013/2014", i))); } }
/** * location may fail because of IO failure, most likely in two cases:<p> * 1. druid don't have the write access to this location, most likely the administrator doesn't config it correctly<p> * 2. disk failure, druid can't read/write to this disk anymore */ private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException { for (StorageLocation loc : getSortedList(locations)) { if (loc.canHandle(segment)) { File storageDir = new File(loc.getPath(), storageDirStr); try { loadInLocationWithStartMarker(segment, storageDir); return loc; } catch (SegmentLoadingException e) { log.makeAlert( e, "Failed to load segment in current location %s, try next location if any", loc.getPath().getAbsolutePath() ) .addData("location", loc.getPath().getAbsolutePath()) .emit(); cleanupCacheFiles(loc.getPath(), storageDir); } } } throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getId()); }
/** * location may fail because of IO failure, most likely in two cases:<p> * 1. druid don't have the write access to this location, most likely the administrator doesn't config it correctly<p> * 2. disk failure, druid can't read/write to this disk anymore */ private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException { for (StorageLocation loc : getSortedList(locations)) { if (loc.canHandle(segment)) { File storageDir = new File(loc.getPath(), storageDirStr); try { loadInLocationWithStartMarker(segment, storageDir); return loc; } catch (SegmentLoadingException e) { log.makeAlert( e, "Failed to load segment in current location %s, try next location if any", loc.getPath().getAbsolutePath() ) .addData("location", loc.getPath().getAbsolutePath()) .emit(); cleanupCacheFiles(loc.getPath(), storageDir); } } } throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getIdentifier()); }