/** guards against NullPointer * utility which tries to seek on the DFSIS and will try an alternative source * if the FSDataInputStream throws an NPE HBASE-17501 * @param istream * @param offset * @throws IOException */ static public void seekOnMultipleSources(FSDataInputStream istream, long offset) throws IOException { try { // attempt to seek inside of current blockReader istream.seek(offset); } catch (NullPointerException e) { // retry the seek on an alternate copy of the data // this can occur if the blockReader on the DFSInputStream is null istream.seekToNewSource(offset); } } }
@Override public boolean seekToNewSource(long targetPos) throws IOException { final long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); final boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { boolean res; try { res = in.seekToNewSource(targetPos); } catch (FileNotFoundException e) { res = tryOpen().seekToNewSource(targetPos); } catch (NullPointerException e) { // HDFS 1.x - DFSInputStream.getBlockAt() res = tryOpen().seekToNewSource(targetPos); } catch (AssertionError e) { // assert in HDFS 1.x - DFSInputStream.getBlockAt() res = tryOpen().seekToNewSource(targetPos); } if (res) pos = targetPos; return res; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
/** {@inheritDoc} */ @Override public synchronized boolean seekToNewSource(long targetPos) throws IOException { readStart(); try { return is.seekToNewSource(targetPos); } finally { readEnd(); } }
@Override public boolean seekToNewSource(long targetPos) throws IOException { return is.seekToNewSource(targetPos); } }
@Override public boolean seekToNewSource(long targetPos) throws IOException { try { return underlyingIs.seekToNewSource(targetPos); } catch(FSError e) { throw FileSystemWrapper.propagateFSError(e); } }
@Override public boolean seekToNewSource(long targetPos) throws IOException { try { return is.seekToNewSource(targetPos); } catch(FSError e) { throw FileSystemWrapper.propagateFSError(e); } } }
@Override public boolean seekToNewSource(long targetPos) throws IOException { final long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); final boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { final long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); final boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { final long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); final boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { final long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); final boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { long sumsPos = getChecksumFilePos(targetPos); fs.reportChecksumFailure(file, datas, targetPos, sums, sumsPos); boolean newDataSource = datas.seekToNewSource(targetPos); return sums.seekToNewSource(sumsPos) || newDataSource; }
@Override public boolean seekToNewSource(long targetPos) throws IOException { Span span = Trace.start("FSDataInputStream.seekToNewSource"); try { return impl.seekToNewSource(targetPos); } finally { span.stop(); } }
private void validateSeekToNewSource(FileSystem fs) throws IOException { assumeHugeFileExists(); try (FSDataInputStream inputStream = fs.open(TEST_FILE_PATH)) { assertFalse(inputStream.seekToNewSource(0)); } }
/** * Validates the implementation of Seekable.seekToNewSource, which should * return false for version 1 of the block blob input stream. * @throws IOException */ @Test public void test_0305_SeekToNewSourceV1() throws IOException { assumeHugeFileExists(); try (FSDataInputStream inputStream = fs.open(TEST_FILE_PATH)) { assertFalse(inputStream.seekToNewSource(0)); } }
/** * Validates the implementation of Seekable.seekToNewSource * @throws IOException */ @Test public void testSeekToNewSource() throws Exception { assumeHugeFileExists(); try (FSDataInputStream inputStream = this.getFileSystem().open(TEST_FILE_PATH)) { assertFalse(inputStream.seekToNewSource(0)); } }