Exemplo n.º 1
0
 @Override
 protected void setSoftlyClosed(final boolean iValue) throws IOException {
   final ByteBuffer buffer = getWriteBuffer(OBinaryProtocol.SIZE_BYTE);
   buffer.put((byte) (iValue ? 1 : 0));
   writeData(buffer, SOFTLY_CLOSED_OFFSET);
   synch();
 }
Exemplo n.º 2
0
  private void flushPage(long fileId, long pageIndex, ODirectMemoryPointer dataPointer)
      throws IOException {
    if (writeAheadLog != null) {
      OLogSequenceNumber lsn = ODurablePage.getLogSequenceNumberFromPage(dataPointer);
      OLogSequenceNumber flushedLSN = writeAheadLog.getFlushedLSN();
      if (flushedLSN == null || flushedLSN.compareTo(lsn) < 0) writeAheadLog.flush();
    }

    final byte[] content = dataPointer.get(0, pageSize);
    OLongSerializer.INSTANCE.serializeNative(MAGIC_NUMBER, content, 0);

    final int crc32 = calculatePageCrc(content);
    OIntegerSerializer.INSTANCE.serializeNative(crc32, content, OLongSerializer.LONG_SIZE);

    final OFileClassic fileClassic = files.get(fileId);
    fileClassic.write(pageIndex * pageSize, content);

    if (syncOnPageFlush) fileClassic.synch();
  }
Exemplo n.º 3
0
 public void forceSyncStoredChanges() throws IOException {
   synchronized (syncObject) {
     for (OFileClassic fileClassic : files.values()) fileClassic.synch();
   }
 }