public void doAppendBatch(WriteCommand writeRecord) throws IOException { writeRecord.location.setDataFileId(dataFile.getDataFileId()); writeRecord.location.setOffset(offset + size); size += writeRecord.location.getSize(); dataFile.incrementLength(writeRecord.location.getSize()); journal.addToTotalLength(writeRecord.location.getSize()); writes.offer(writeRecord); }
public void doFirstBatch(WriteCommand controlRecord, WriteCommand writeRecord) throws IOException { controlRecord.location.setType(Journal.BATCH_CONTROL_RECORD_TYPE); controlRecord.location.setSize(Journal.BATCH_CONTROL_RECORD_SIZE); controlRecord.location.setDataFileId(dataFile.getDataFileId()); controlRecord.location.setOffset(offset); writeRecord.location.setDataFileId(dataFile.getDataFileId()); writeRecord.location.setOffset(offset + Journal.BATCH_CONTROL_RECORD_SIZE); size = Journal.BATCH_CONTROL_RECORD_SIZE + writeRecord.location.getSize(); dataFile.incrementLength(size); journal.addToTotalLength(size); writes.offer(controlRecord); writes.offer(writeRecord); }