/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
write.begin(); if (write.diskBound == null && write.diskBoundLocation == -1) { batch.remove(write); checksum.update(w.getDiskBound(), 0, pageSize); } catch (Throwable t) { throw IOExceptionSupport.create("Cannot create recovery file. Reason: " + t, t); recoveryFile.write(w.getDiskBound(), 0, pageSize); writeFile.write(w.getDiskBound(), 0, pageSize); w.done(); if (w.isDone()) { writes.remove(w.page.getPageId()); if (w.tmpFile != null && tmpFilesForRemoval.contains(w.tmpFile)) {
page.copy(update.getPage()); return;
write.begin(); if (write.diskBound == null && write.diskBoundLocation == -1) { batch.remove(write); checksum.update(w.getDiskBound(), 0, pageSize); } catch (Throwable t) { throw IOExceptionSupport.create("Cannot create recovery file. Reason: " + t, t); recoveryFile.write(w.getDiskBound(), 0, pageSize); writeFile.write(w.getDiskBound(), 0, pageSize); w.done(); if (w.isDone()) { writes.remove(w.page.getPageId()); if (w.tmpFile != null && tmpFilesForRemoval.contains(w.tmpFile)) {
write.begin(); if (write.diskBound == null && write.diskBoundLocation == -1) { batch.remove(write); checksum.update(w.getDiskBound(), 0, pageSize); } catch (Throwable t) { throw IOExceptionSupport.create("Cannot create recovery file. Reason: " + t, t); recoveryFile.write(w.getDiskBound(), 0, pageSize); writeFile.write(w.getDiskBound(), 0, pageSize); w.done(); if (w.isDone()) { writes.remove(w.page.getPageId()); if (w.tmpFile != null && tmpFilesForRemoval.contains(w.tmpFile)) {
write.begin(); if (write.diskBound == null && write.diskBoundLocation == -1) { batch.remove(write); checksum.update(w.getDiskBound(), 0, pageSize); } catch (Throwable t) { throw IOExceptionSupport.create("Cannot create recovery file. Reason: " + t, t); recoveryFile.write(w.getDiskBound(), 0, pageSize); writeFile.write(w.getDiskBound(), 0, pageSize); w.done(); if (w.isDone()) { writes.remove(w.page.getPageId()); if (w.tmpFile != null && tmpFilesForRemoval.contains(w.tmpFile)) {
page.copy(update.getPage()); return;
page.copy(update.getPage()); return;
page.copy(update.getPage()); return;
} else { if (value.currentLocation != -1) { write.setCurrentLocation(value.page, value.currentLocation, value.length); write.tmpFile = value.tmpFile; longTx = true; } else { write.setCurrent(value.page, value.current);
} else { if (value.currentLocation != -1) { write.setCurrentLocation(value.page, value.currentLocation, value.length); write.tmpFile = value.tmpFile; longTx = true; } else { write.setCurrent(value.page, value.current);
} else { if (value.currentLocation != -1) { write.setCurrentLocation(value.page, value.currentLocation, value.length); write.tmpFile = value.tmpFile; longTx = true; } else { write.setCurrent(value.page, value.current);
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }
@Override public Long getKey() { return write.getPage().getPageId(); }
@Override public Long getKey() { return write.getPage().getPageId(); }