コード例 #1
0
ファイル: INLogEntry.java プロジェクト: prat0318/dbms
  /** Read in an IN entry. */
  public void readEntry(EnvironmentImpl envImpl, LogEntryHeader header, ByteBuffer entryBuffer) {

    int logVersion = header.getVersion();
    boolean version6OrLater = (logVersion >= 6);
    if (version6OrLater) {
      dbId = new DatabaseId();
      dbId.readFromLog(entryBuffer, logVersion);
      prevFullLsn = LogUtils.readLong(entryBuffer, false /*unpacked*/);
      if (logVersion >= 8) {
        prevDeltaLsn = LogUtils.readPackedLong(entryBuffer);
      }
    }
    /* Read IN. */
    in = newInstanceOfType();
    in.readFromLog(entryBuffer, logVersion);
    if (!version6OrLater) {
      dbId = new DatabaseId();
      dbId.readFromLog(entryBuffer, logVersion);
    }
    if (logVersion < 1) {
      prevFullLsn = DbLsn.NULL_LSN;
    } else if (logVersion == 1) {
      long fileNum = LogUtils.readUnsignedInt(entryBuffer);
      if (fileNum == 0xffffffffL) {
        prevFullLsn = DbLsn.NULL_LSN;
      } else {
        prevFullLsn = DbLsn.makeLsn(fileNum, 0);
      }
    } else if (!version6OrLater) {
      prevFullLsn = LogUtils.readLong(entryBuffer, true /*unpacked*/);
    }
  }
コード例 #2
0
  /**
   * Extends its super class to read in database operation information.
   *
   * @see LNLogEntry#readEntry
   */
  @Override
  public void readEntry(EnvironmentImpl envImpl, LogEntryHeader header, ByteBuffer entryBuffer) {

    readBaseLNEntry(envImpl, header, entryBuffer, false /*keyIsLastSerializedField*/);

    /*
     * The NameLNLogEntry was introduced in version 6. Before, a LNLogEntry
     * was used for NameLNs, and there is no extra information in the log
     * entry.
     */
    int version = header.getVersion();
    if (version >= 6) {
      operationType = DbOperationType.readTypeFromLog(entryBuffer, version);
      if (DbOperationType.isWriteConfigType(operationType)) {
        replicatedCreateConfig = new ReplicatedDatabaseConfig();
        replicatedCreateConfig.readFromLog(entryBuffer, version);
      }

      if (operationType == DbOperationType.TRUNCATE) {
        truncateOldDbId = new DatabaseId();
        truncateOldDbId.readFromLog(entryBuffer, version);
      }
    } else {
      operationType = DbOperationType.NONE;
    }
  }
コード例 #3
0
 /**
  * For a file header, the version is not available until after reading the item. Set the version
  * in the entry header so it can be used by FileReaders, etc. [#16939]
  */
 @Override
 public void readEntry(EnvironmentImpl envImpl, LogEntryHeader header, ByteBuffer entryBuffer) {
   super.readEntry(envImpl, header, entryBuffer);
   FileHeader entry = (FileHeader) getMainItem();
   header.setFileHeaderVersion(entry.getLogVersion());
 }