@Override public void truncate( File path, long size ) throws IOException { delegate.truncate( path, size ); }
@Override public void truncate( File path, long size ) throws IOException { fs.truncate( path, size ); }
public void setMigrationStatus( FileSystemAbstraction fs, File stateFile, String info ) { if ( fs.fileExists( stateFile ) ) { try { fs.truncate( stateFile, 0 ); } catch ( IOException e ) { throw new RuntimeException( e ); } } try ( Writer writer = fs.openAsWriter( stateFile, StandardCharsets.UTF_8, false ) ) { writer.write( name() ); writer.write( '\n' ); writer.write( info ); writer.flush(); } catch ( IOException e ) { throw new RuntimeException( e ); } } }
@Override public void truncate( File path, long size ) throws IOException { adversary.injectFailure( FileNotFoundException.class, IOException.class, IllegalArgumentException.class, SecurityException.class, NullPointerException.class ); delegate.truncate( path, size ); }
@Override public void truncate( File path, long size ) throws IOException { chooseFileSystem( path ).truncate( path, size ); }
private void truncateLogFiles( long recoveredTransactionLogVersion, long recoveredTransactionOffset ) throws IOException { File lastRecoveredTransactionLog = logFiles.getLogFileForVersion( recoveredTransactionLogVersion ); fs.truncate( lastRecoveredTransactionLog, recoveredTransactionOffset ); forEachSubsequentLogFile( recoveredTransactionLogVersion, fileIndex -> fs.deleteFile( logFiles.getLogFileForVersion( fileIndex ) ) ); }
fs.truncate( path, 0 );
@Test public void shouldCompleteInitializationOfStoresWithIncompleteHeaders() throws Exception { StoreFactory storeFactory = storeFactory( Config.defaults() ); storeFactory.openAllNeoStores( true ).close(); FileSystemAbstraction fs = fsRule.get(); for ( File f : fs.listFiles( testDirectory.databaseDir() ) ) { fs.truncate( f, 0 ); } storeFactory.openAllNeoStores( true ).close(); } }
public static void removeCheckPointFromTxLog( FileSystemAbstraction fileSystem, File databaseDirectory ) throws IOException { LogFiles logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder( databaseDirectory, fileSystem ).build(); LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>(); LogTailScanner tailScanner = new LogTailScanner( logFiles, logEntryReader, new Monitors() ); LogTailScanner.LogTailInformation logTailInformation = tailScanner.getTailInformation(); if ( logTailInformation.commitsAfterLastCheckpoint() ) { // done already return; } // let's assume there is at least a checkpoint assertNotNull( logTailInformation.lastCheckPoint ); LogPosition logPosition = logTailInformation.lastCheckPoint.getLogPosition(); File logFile = logFiles.getLogFileForVersion( logPosition.getLogVersion() ); fileSystem.truncate( logFile, logPosition.getByteOffset() ); } }
private PhysicalFlushableChannel resetStoreFile( File nextStore ) throws IOException { fsa.truncate( nextStore, 0 ); return new PhysicalFlushableChannel( fsa.open( nextStore, OpenMode.READ_WRITE ) ); }
private PhysicalFlushableChannel resetStoreFile( File nextStore ) throws IOException { fsa.truncate( nextStore, 0 ); return new PhysicalFlushableChannel( fsa.open( nextStore, "rw" ) ); }
public void setMigrationStatus( FileSystemAbstraction fs, File stateFile, String info ) { if ( fs.fileExists( stateFile ) ) { try { fs.truncate( stateFile, 0 ); } catch ( IOException e ) { throw new RuntimeException( e ); } } try ( Writer writer = fs.openAsWriter( stateFile, StandardCharsets.UTF_8, false ) ) { writer.write( name() ); writer.write( '\n' ); writer.write( info ); writer.flush(); } catch ( IOException e ) { throw new RuntimeException( e ); } } }
private void truncateLogFiles( long recoveredTransactionLogVersion, long recoveredTransactionOffset ) throws IOException { File lastRecoveredTransactionLog = logFiles.getLogFileForVersion( recoveredTransactionLogVersion ); fs.truncate( lastRecoveredTransactionLog, recoveredTransactionOffset ); forEachSubsequentLogFile( recoveredTransactionLogVersion, fileIndex -> fs.deleteFile( logFiles.getLogFileForVersion( fileIndex ) ) ); }
fs.truncate( path, 0 );