コード例 #1
0
  void readThis() throws OldFormatException {
    newSystemData(AbstractFreespaceManager.FM_LEGACY_RAM, StandardIdSystemFactory.LEGACY);
    blockSizeReadFromFile(1);

    _fileHeader = FileHeader.read(this);

    if (config().generateCommitTimestamps().isUnspecified()) {
      config().generateCommitTimestamps(_systemData.idToTimestampIndexId() != 0);
    }

    createStringIO(_systemData.stringEncoding());

    createIdSystem();

    initializeClassMetadataRepository();
    initalizeWeakReferenceSupport();

    setNextTimeStampId(systemData().lastTimeStampID());

    classCollection().setID(_systemData.classCollectionID());
    classCollection().read(systemTransaction());

    Converter.convert(new ConversionStage.ClassCollectionAvailableStage(this));

    _fileHeader.readIdentity(this);

    if (_config.isReadOnly()) {
      return;
    }

    if (!configImpl().commitRecoveryDisabled()) {
      _fileHeader.completeInterruptedTransaction(this);
    }

    FreespaceManager blockedFreespaceManager =
        AbstractFreespaceManager.createNew(this, _systemData.freespaceSystem());

    installFreespaceManager(blockedFreespaceManager);

    blockedFreespaceManager.read(this, _systemData.inMemoryFreespaceSlot());
    blockedFreespaceManager.start(_systemData.bTreeFreespaceId());

    _fileHeader = _fileHeader.convert(this);

    if (freespaceMigrationRequired(blockedFreespaceManager)) {
      migrateFreespace(blockedFreespaceManager);
    }

    writeHeader(true, false);

    if (Converter.convert(new ConversionStage.SystemUpStage(this))) {
      _systemData.converterVersion(Converter.VERSION);
      _fileHeader.writeVariablePart(this);
      transaction().commit();
    }
  }
コード例 #2
0
 private boolean freespaceMigrationRequired(FreespaceManager freespaceManager) {
   if (freespaceManager == null) {
     return false;
   }
   byte readSystem = _systemData.freespaceSystem();
   byte configuredSystem = configImpl().freespaceSystem();
   if (freespaceManager.systemType() == configuredSystem) {
     return false;
   }
   if (configuredSystem != 0) {
     return true;
   }
   return AbstractFreespaceManager.migrationRequired(readSystem);
 }
コード例 #3
0
 private void newSystemData(byte freespaceSystemType, byte idSystemType) {
   _systemData = new SystemData();
   _systemData.stringEncoding(configImpl().encoding());
   _systemData.freespaceSystem(freespaceSystemType);
   _systemData.idSystemType(idSystemType);
 }