Examples of OOperationUnitRecord


Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OOperationUnitRecord

      if (!(record instanceof OOperationUnitRecord)) {
        lsn = writeAheadLog.next(lsn);
        continue;
      }

      OOperationUnitRecord operationUnitRecord = (OOperationUnitRecord) record;
      if (operationUnitRecord.getOperationUnitId().equals(unitId)) {
        operationUnit.add(lsn);
        if (record instanceof OAtomicUnitEndRecord)
          break;
      }
      lsn = writeAheadLog.next(lsn);
View Full Code Here

Examples of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OOperationUnitRecord

      if (walRecord instanceof OAtomicUnitStartRecord) {
        List<OLogSequenceNumber> operationList = new ArrayList<OLogSequenceNumber>();
        operationUnits.put(((OAtomicUnitStartRecord) walRecord).getOperationUnitId(), operationList);
        operationList.add(lsn);
      } else if (walRecord instanceof OOperationUnitRecord) {
        OOperationUnitRecord operationUnitRecord = (OOperationUnitRecord) walRecord;
        OOperationUnitId unitId = operationUnitRecord.getOperationUnitId();

        final List<OLogSequenceNumber> records = operationUnits.get(unitId);

        assert records != null;

        if (records == null) {
          OLogManager.instance().warn(this,
              "Record with lsn %s  which indication of start of atomic operation was truncated will be skipped.",
              walRecord.getLsn());
          continue;
        }

        records.add(lsn);

        if (operationUnitRecord instanceof OUpdatePageRecord) {
          final OUpdatePageRecord updatePageRecord = (OUpdatePageRecord) operationUnitRecord;

          final long fileId = updatePageRecord.getFileId();
          final long pageIndex = updatePageRecord.getPageIndex();

          if (!diskCache.isOpen(fileId))
            diskCache.openFile(fileId);

          final OCacheEntry cacheEntry = diskCache.load(fileId, pageIndex, true);
          final OCachePointer cachePointer = cacheEntry.getCachePointer();
          cachePointer.acquireExclusiveLock();
          try {
            ODurablePage durablePage = new ODurablePage(cacheEntry, ODurablePage.TrackMode.NONE);
            durablePage.restoreChanges(updatePageRecord.getChanges());
            durablePage.setLsn(lsn);

            cacheEntry.markDirty();
          } finally {
            cachePointer.releaseExclusiveLock();
            diskCache.release(cacheEntry);
          }

        } else if (operationUnitRecord instanceof OFileCreatedCreatedWALRecord) {

          final OFileCreatedCreatedWALRecord fileCreatedCreatedRecord = (OFileCreatedCreatedWALRecord) operationUnitRecord;
          diskCache.openFile(fileCreatedCreatedRecord.getFileName(), fileCreatedCreatedRecord.getFileId());

        } else if (operationUnitRecord instanceof OAtomicUnitEndRecord) {
          final OAtomicUnitEndRecord atomicUnitEndRecord = (OAtomicUnitEndRecord) walRecord;

          if (atomicUnitEndRecord.isRollback())
            undoOperation(records);

          operationUnits.remove(unitId);
        } else {
          OLogManager.instance().error(this, "Invalid WAL record type was passed %s. Given record will be skipped.",
              operationUnitRecord.getClass());
          assert false : "Invalid WAL record type was passed " + operationUnitRecord.getClass().getName();
        }
      } else
        OLogManager.instance().warn(this, "Record %s will be skipped during data restore.", walRecord);

      recordsProcessed++;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.