Beispiel #1
0
  protected boolean checkDeletedInTx() {
    OrientBaseGraph curGraph = getGraph();
    if (curGraph == null) return false;

    ORID id;
    if (getRecord() != null) id = getRecord().getIdentity();
    else return false;

    final ORecordOperation oper = curGraph.getRawGraph().getTransaction().getRecordEntry(id);
    if (oper == null) return id.isTemporary();
    else return oper.type == ORecordOperation.DELETED;
  }
  private void doDeserialization() {
    if (deserialized) return;

    int offset = 0;
    int entriesSize = OIntegerSerializer.INSTANCE.deserialize(serializedContent, offset);
    offset += OIntegerSerializer.INT_SIZE;

    for (int i = 0; i < entriesSize; i++) {
      ORID rid = OLinkSerializer.INSTANCE.deserialize(serializedContent, offset);
      offset += OLinkSerializer.RID_SIZE;

      OIdentifiable identifiable;
      if (rid.isTemporary()) identifiable = rid.getRecord();
      else identifiable = rid;

      addEntry(identifiable);
    }

    deserialized = true;
  }
  public ORecordInternal<?> loadRecord(
      final ORID iRid,
      final ORecordInternal<?> iRecord,
      final String iFetchPlan,
      final boolean ignoreCache,
      final boolean loadTombstone,
      final OStorage.LOCKING_STRATEGY iLockingStrategy) {
    checkTransaction();

    final ORecordInternal<?> txRecord = getRecord(iRid);
    if (txRecord == OTransactionRealAbstract.DELETED_RECORD)
      // DELETED IN TX
      return null;

    if (txRecord != null) {
      if (iRecord != null && txRecord != iRecord)
        OLogManager.instance()
            .warn(
                this,
                "Found record in transaction with the same RID %s but different instance. "
                    + "Probably the record has been loaded from another transaction and reused on the current one: reload it "
                    + "from current transaction before to update or delete it",
                iRecord.getIdentity());
      return txRecord;
    }

    if (iRid.isTemporary()) return null;

    // DELEGATE TO THE STORAGE, NO TOMBSTONES SUPPORT IN TX MODE
    final ORecordInternal<?> record =
        database.executeReadRecord(
            (ORecordId) iRid, iRecord, iFetchPlan, ignoreCache, false, iLockingStrategy);

    if (record != null) addRecord(record, ORecordOperation.LOADED, null);

    return record;
  }