void delete(final JournalFile file) { file.incNegCount(addFile); addFile.decSize(size); if (updateFiles != null) { for (Pair<JournalFile, Integer> updFile : updateFiles) { file.incNegCount(updFile.getA()); updFile.getA().decSize(updFile.getB()); } } }
void delete(final JournalFile file) { file.incNegCount(addFile); addFile.decSize(size); if (updateFiles != null) { for (Pair<JournalFile, Integer> updFile : updateFiles) { file.incNegCount(updFile.getA()); updFile.getA().decSize(updFile.getB()); } } }
/** * The caller of this method needs to guarantee appendLock.lock before calling this method if being used outside of the lock context. * or else potFilesMap could be affected */ public void rollback(final JournalFile file) { JournalCompactor compactor = journal.getCompactor(); if (compacting && compactor != null) { compactor.addCommandRollback(this, file); } else { // Now add negs for the pos we added in each file in which there were // transactional operations // Note that we do this on rollback as we do on commit, since we need // to ensure the file containing // the rollback record doesn't get deleted before the files with the // transactional operations are deleted // Otherwise we may run into problems especially with XA where we are // just left with a prepare when the tx // has actually been rolled back for (JournalFile jf : pendingFiles) { file.incNegCount(jf); } } }
/** * The caller of this method needs to guarantee appendLock.lock before calling this method if being used outside of the lock context. * or else potFilesMap could be affected */ public void rollback(final JournalFile file) { JournalCompactor compactor = journal.getCompactor(); if (compacting && compactor != null) { compactor.addCommandRollback(this, file); } else { // Now add negs for the pos we added in each file in which there were // transactional operations // Note that we do this on rollback as we do on commit, since we need // to ensure the file containing // the rollback record doesn't get deleted before the files with the // transactional operations are deleted // Otherwise we may run into problems especially with XA where we are // just left with a prepare when the tx // has actually been rolled back for (JournalFile jf : pendingFiles) { file.incNegCount(jf); } } }
private void setupPosNeg(final int fileNumber, final int pos, final int... neg) { JournalFile file = files[fileNumber]; int totalDep = file.getTotalNegativeToOthers(); for (int i = 0; i < pos; i++) { file.incPosCount(); } for (int i = 0; i < neg.length; i++) { JournalFile reclaimable2 = files[i]; for (int j = 0; j < neg[i]; j++) { file.incNegCount(reclaimable2); totalDep++; } } assertEquals(totalDep, file.getTotalNegativeToOthers()); }