Example #1
0
  public RocksDBKeyedStateBackend(
      JobID jobId,
      String operatorIdentifier,
      ClassLoader userCodeClassLoader,
      File instanceBasePath,
      DBOptions dbOptions,
      ColumnFamilyOptions columnFamilyOptions,
      TaskKvStateRegistry kvStateRegistry,
      TypeSerializer<K> keySerializer,
      int numberOfKeyGroups,
      KeyGroupRange keyGroupRange,
      Collection<KeyGroupsStateHandle> restoreState)
      throws Exception {

    this(
        jobId,
        operatorIdentifier,
        userCodeClassLoader,
        instanceBasePath,
        dbOptions,
        columnFamilyOptions,
        kvStateRegistry,
        keySerializer,
        numberOfKeyGroups,
        keyGroupRange);

    LOG.info("Initializing RocksDB keyed state backend from snapshot.");

    if (LOG.isDebugEnabled()) {
      LOG.debug("Restoring snapshot from state handles: {}.", restoreState);
    }

    try {
      if (MigrationUtil.isOldSavepointKeyedState(restoreState)) {
        LOG.info("Converting RocksDB state from old savepoint.");
        restoreOldSavepointKeyedState(restoreState);
      } else {
        RocksDBRestoreOperation restoreOperation = new RocksDBRestoreOperation(this);
        restoreOperation.doRestore(restoreState);
      }
    } catch (Exception ex) {
      dispose();
      throw ex;
    }
  }