Ejemplo n.º 1
0
  public void accumulateFreeSlot(
      TransactionalIdSystemImpl idSystem,
      FreespaceCommitter freespaceCommitter,
      boolean forFreespace) {
    if (forFreespace() != forFreespace) {
      return;
    }
    if (_firstOperation == SlotChangeOperation.create) {
      return;
    }
    if (_currentOperation == SlotChangeOperation.update
        || _currentOperation == SlotChangeOperation.delete) {

      Slot slot = modifiedSlotInParentIdSystem(idSystem);
      if (Slot.isNull(slot)) {
        slot = idSystem.committedSlot(_key);
      }

      // No old slot at all can be the case if the object
      // has been deleted by another transaction and we add it again.
      if (!Slot.isNull(slot)) {
        freespaceCommitter.delayedFree(slot, freeToSystemFreespaceSystem());
      }
    }
  }
Ejemplo n.º 2
0
 protected void freePreviouslyModifiedSlot(FreespaceManager freespaceManager) {
   if (Slot.isNull(_newSlot)) {
     return;
   }
   free(freespaceManager, _newSlot);
   _newSlot = null;
 }
Ejemplo n.º 3
0
 protected void free(FreespaceManager freespaceManager, Slot slot) {
   if (slot.isNull()) {
     return;
   }
   if (freespaceManager == null) {
     return;
   }
   freespaceManager.free(slot);
 }
Ejemplo n.º 4
0
  public StatefulBuffer readStatefulBufferBySlot(Transaction trans, int id, Slot slot) {
    if (Slot.isNull(slot)) {
      return null;
    }

    if (DTrace.enabled) {
      DTrace.READ_SLOT.logLength(slot.address(), slot.length());
    }

    StatefulBuffer buffer = createStatefulBuffer(trans, slot.address(), slot.length());
    buffer.setID(id);
    buffer.readEncrypt(this, slot.address());
    return buffer;
  }
Ejemplo n.º 5
0
  public ByteArrayBuffer readBufferBySlot(Slot slot) {
    if (Slot.isNull(slot)) {
      return null;
    }

    if (DTrace.enabled) {
      DTrace.READ_SLOT.logLength(slot.address(), slot.length());
    }

    ByteArrayBuffer buffer = new ByteArrayBuffer(slot.length());

    buffer.readEncrypt(this, slot.address());
    return buffer;
  }
Ejemplo n.º 6
0
  public void free(Slot slot) {
    if (slot.isNull()) {
      return;

      // TODO: This should really be an IllegalArgumentException but old database files
      //       with index-based FreespaceManagers appear to deliver zeroed slots.
      // throw new IllegalArgumentException();
    }
    if (_freespaceManager == null) {
      // Can happen on early free before freespacemanager
      // is up, during conversion.
      return;
    }

    if (DTrace.enabled) {
      DTrace.FILE_FREE.logLength(slot.address(), slot.length());
    }

    _freespaceManager.free(slot);
  }
Ejemplo n.º 7
0
 public boolean isDeleted() {
   return slotModified() && _newSlot.isNull();
 }
Ejemplo n.º 8
0
 private final boolean isFreeOnRollback() {
   return !Slot.isNull(_newSlot);
 }