/** * Creates files for journal synchronization of a replicated backup. * * In order to simplify synchronization, the file IDs in the backup match those in the live * server. * * @param fileID the fileID to use when creating the file. */ public JournalFile createRemoteBackupSyncFile(long fileID) throws Exception { return createFile(false, false, true, false, fileID); }
/** * Creates files for journal synchronization of a replicated backup. * * In order to simplify synchronization, the file IDs in the backup match those in the live * server. * * @param fileID the fileID to use when creating the file. */ public JournalFile createRemoteBackupSyncFile(long fileID) throws Exception { return createFile(false, false, true, false, fileID); }
public void ensureMinFiles() throws Exception { int filesToCreate = minFiles - (dataFiles.size() + freeFilesCount.get()); if (filesToCreate > 0) { for (int i = 0; i < filesToCreate; i++) { // Keeping all files opened can be very costly (mainly on AIO) freeFiles.add(createFile(false, false, true, false, -1)); freeFilesCount.getAndIncrement(); } } }
public void ensureMinFiles() throws Exception { int filesToCreate = minFiles - (dataFiles.size() + freeFilesCount.get()); if (filesToCreate > 0) { for (int i = 0; i < filesToCreate; i++) { // Keeping all files opened can be very costly (mainly on AIO) freeFiles.add(createFile(false, false, true, false, -1)); freeFilesCount.getAndIncrement(); } } }
/** * This will get a File from freeFile without initializing it * * @return uninitialized JournalFile * @throws Exception * @see JournalImpl#initFileHeader(SequentialFileFactory, SequentialFile, int, long) */ private JournalFile takeFile(final boolean keepOpened, final boolean multiAIO, final boolean initFile, final boolean tmpCompactExtension) throws Exception { JournalFile nextFile = null; nextFile = freeFiles.poll(); if (nextFile != null) { freeFilesCount.getAndDecrement(); } if (nextFile == null) { nextFile = createFile(keepOpened, multiAIO, initFile, tmpCompactExtension, -1); } else { if (tmpCompactExtension) { SequentialFile sequentialFile = nextFile.getFile(); sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp"); } if (keepOpened) { openFile(nextFile, multiAIO); } } return nextFile; }
/** * This will get a File from freeFile without initializing it * * @return uninitialized JournalFile * @throws Exception * @see JournalImpl#initFileHeader(SequentialFileFactory, SequentialFile, int, long) */ private JournalFile takeFile(final boolean keepOpened, final boolean multiAIO, final boolean initFile, final boolean tmpCompactExtension) throws Exception { JournalFile nextFile = null; nextFile = freeFiles.poll(); if (nextFile != null) { freeFilesCount.getAndDecrement(); } if (nextFile == null) { nextFile = createFile(keepOpened, multiAIO, initFile, tmpCompactExtension, -1); } else { if (tmpCompactExtension) { SequentialFile sequentialFile = nextFile.getFile(); sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp"); } if (keepOpened) { openFile(nextFile, multiAIO); } } return nextFile; }