public ByteSequence read(Location location) throws IOException, IllegalStateException { DataFile dataFile = getDataFile(location); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); ByteSequence rc = null; try { rc = reader.readRecord(location); } finally { accessorPool.closeDataFileAccessor(reader); } return rc; }
public void update(Location location, ByteSequence data, boolean sync) throws IOException { DataFile dataFile = getDataFile(location); DataFileAccessor updater = accessorPool.openDataFileAccessor(dataFile); try { updater.updateRecord(location, data, sync); } finally { accessorPool.closeDataFileAccessor(updater); } }
public boolean isUnusedPreallocated(DataFile dataFile) throws IOException { if (preallocationScope == PreallocationScope.ENTIRE_JOURNAL_ASYNC) { DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { byte[] firstFewBytes = new byte[BATCH_CONTROL_RECORD_HEADER.length]; reader.readFully(0, firstFewBytes); ByteSequence bs = new ByteSequence(firstFewBytes); return bs.startsWith(EOF_RECORD); } catch (Exception ignored) { } finally { accessorPool.closeDataFileAccessor(reader); } } return false; }
public void corruptRecoveryLocation(Location recoveryPosition) throws IOException { DataFile dataFile = getDataFile(recoveryPosition); // with corruption on recovery we have no faith in the content - slip to the next batch record or eof DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf(); randomAccessFile.seek(recoveryPosition.getOffset() + 1); byte[] data = new byte[getWriteBatchSize()]; ByteSequence bs = new ByteSequence(data, 0, randomAccessFile.read(data)); int nextOffset = 0; if (findNextBatchRecord(bs, randomAccessFile) >= 0) { nextOffset = Math.toIntExact(randomAccessFile.getFilePointer() - bs.remaining()); } else { nextOffset = Math.toIntExact(randomAccessFile.length()); } Sequence sequence = new Sequence(recoveryPosition.getOffset(), nextOffset - 1); LOG.warn("Corrupt journal records found in '{}' between offsets: {}", dataFile.getFile(), sequence); // skip corruption on getNextLocation recoveryPosition.setOffset(nextOffset); recoveryPosition.setSize(-1); dataFile.corruptedBlocks.add(sequence); } catch (IOException e) { } finally { accessorPool.closeDataFileAccessor(reader); } }
location.setOffset(0); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf();
DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { reader.readLocationDetails(cur);
public ByteSequence read(Location location) throws IOException, IllegalStateException { DataFile dataFile = getDataFile(location); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); ByteSequence rc = null; try { rc = reader.readRecord(location); } finally { accessorPool.closeDataFileAccessor(reader); } return rc; }
public ByteSequence read(Location location) throws IOException, IllegalStateException { DataFile dataFile = getDataFile(location); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); ByteSequence rc = null; try { rc = reader.readRecord(location); } finally { accessorPool.closeDataFileAccessor(reader); } return rc; }
public void update(Location location, ByteSequence data, boolean sync) throws IOException { DataFile dataFile = getDataFile(location); DataFileAccessor updater = accessorPool.openDataFileAccessor(dataFile); try { updater.updateRecord(location, data, sync); } finally { accessorPool.closeDataFileAccessor(updater); } }
public void update(Location location, ByteSequence data, boolean sync) throws IOException { DataFile dataFile = getDataFile(location); DataFileAccessor updater = accessorPool.openDataFileAccessor(dataFile); try { updater.updateRecord(location, data, sync); } finally { accessorPool.closeDataFileAccessor(updater); } }
public void update(Location location, ByteSequence data, boolean sync) throws IOException { DataFile dataFile = getDataFile(location); DataFileAccessor updater = accessorPool.openDataFileAccessor(dataFile); try { updater.updateRecord(location, data, sync); } finally { accessorPool.closeDataFileAccessor(updater); } }
public ByteSequence read(Location location) throws IOException, IllegalStateException { DataFile dataFile = getDataFile(location); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); ByteSequence rc = null; try { rc = reader.readRecord(location); } finally { accessorPool.closeDataFileAccessor(reader); } return rc; }
public boolean isUnusedPreallocated(DataFile dataFile) throws IOException { if (preallocationScope == PreallocationScope.ENTIRE_JOURNAL_ASYNC) { DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { byte[] firstFewBytes = new byte[BATCH_CONTROL_RECORD_HEADER.length]; reader.readFully(0, firstFewBytes); ByteSequence bs = new ByteSequence(firstFewBytes); return bs.startsWith(EOF_RECORD); } catch (Exception ignored) { } finally { accessorPool.closeDataFileAccessor(reader); } } return false; }
public boolean isUnusedPreallocated(DataFile dataFile) throws IOException { if (preallocationScope == PreallocationScope.ENTIRE_JOURNAL_ASYNC) { DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { byte[] firstFewBytes = new byte[BATCH_CONTROL_RECORD_HEADER.length]; reader.readFully(0, firstFewBytes); ByteSequence bs = new ByteSequence(firstFewBytes); return bs.startsWith(EOF_RECORD); } catch (Exception ignored) { } finally { accessorPool.closeDataFileAccessor(reader); } } return false; }
public boolean isUnusedPreallocated(DataFile dataFile) throws IOException { if (preallocationScope == PreallocationScope.ENTIRE_JOURNAL_ASYNC) { DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { byte[] firstFewBytes = new byte[BATCH_CONTROL_RECORD_HEADER.length]; reader.readFully(0, firstFewBytes); ByteSequence bs = new ByteSequence(firstFewBytes); return bs.startsWith(EOF_RECORD); } catch (Exception ignored) { } finally { accessorPool.closeDataFileAccessor(reader); } } return false; }
public void corruptRecoveryLocation(Location recoveryPosition) throws IOException { DataFile dataFile = getDataFile(recoveryPosition); // with corruption on recovery we have no faith in the content - slip to the next batch record or eof DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf(); randomAccessFile.seek(recoveryPosition.getOffset() + 1); byte[] data = new byte[getWriteBatchSize()]; ByteSequence bs = new ByteSequence(data, 0, randomAccessFile.read(data)); int nextOffset = 0; if (findNextBatchRecord(bs, randomAccessFile) >= 0) { nextOffset = Math.toIntExact(randomAccessFile.getFilePointer() - bs.remaining()); } else { nextOffset = Math.toIntExact(randomAccessFile.length()); } Sequence sequence = new Sequence(recoveryPosition.getOffset(), nextOffset - 1); LOG.warn("Corrupt journal records found in '{}' between offsets: {}", dataFile.getFile(), sequence); // skip corruption on getNextLocation recoveryPosition.setOffset(nextOffset); recoveryPosition.setSize(-1); dataFile.corruptedBlocks.add(sequence); } catch (IOException e) { } finally { accessorPool.closeDataFileAccessor(reader); } }
public void corruptRecoveryLocation(Location recoveryPosition) throws IOException { DataFile dataFile = getDataFile(recoveryPosition); // with corruption on recovery we have no faith in the content - slip to the next batch record or eof DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf(); randomAccessFile.seek(recoveryPosition.getOffset() + 1); byte[] data = new byte[getWriteBatchSize()]; ByteSequence bs = new ByteSequence(data, 0, randomAccessFile.read(data)); int nextOffset = 0; if (findNextBatchRecord(bs, randomAccessFile) >= 0) { nextOffset = Math.toIntExact(randomAccessFile.getFilePointer() - bs.remaining()); } else { nextOffset = Math.toIntExact(randomAccessFile.length()); } Sequence sequence = new Sequence(recoveryPosition.getOffset(), nextOffset - 1); LOG.warn("Corrupt journal records found in '{}' between offsets: {}", dataFile.getFile(), sequence); // skip corruption on getNextLocation recoveryPosition.setOffset(nextOffset); recoveryPosition.setSize(-1); dataFile.corruptedBlocks.add(sequence); } catch (IOException e) { } finally { accessorPool.closeDataFileAccessor(reader); } }
public void corruptRecoveryLocation(Location recoveryPosition) throws IOException { DataFile dataFile = getDataFile(recoveryPosition); // with corruption on recovery we have no faith in the content - slip to the next batch record or eof DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf(); randomAccessFile.seek(recoveryPosition.getOffset() + 1); byte[] data = new byte[getWriteBatchSize()]; ByteSequence bs = new ByteSequence(data, 0, randomAccessFile.read(data)); int nextOffset = 0; if (findNextBatchRecord(bs, randomAccessFile) >= 0) { nextOffset = Math.toIntExact(randomAccessFile.getFilePointer() - bs.remaining()); } else { nextOffset = Math.toIntExact(randomAccessFile.length()); } Sequence sequence = new Sequence(recoveryPosition.getOffset(), nextOffset - 1); LOG.warn("Corrupt journal records found in '{}' between offsets: {}", dataFile.getFile(), sequence); // skip corruption on getNextLocation recoveryPosition.setOffset(nextOffset); recoveryPosition.setSize(-1); dataFile.corruptedBlocks.add(sequence); } catch (IOException e) { } finally { accessorPool.closeDataFileAccessor(reader); } }
location.setOffset(0); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf();
location.setOffset(0); DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile); try { RandomAccessFile randomAccessFile = reader.getRaf().getRaf();