@Nonnull @Override public RunnableFuture<SnapshotResult<KeyedStateHandle>> doSnapshot( long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory primaryStreamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception { final SupplierWithException<CheckpointStreamWithResultProvider, Exception> checkpointStreamSupplier = createCheckpointStreamSupplier(checkpointId, primaryStreamFactory, checkpointOptions); final List<StateMetaInfoSnapshot> stateMetaInfoSnapshots = new ArrayList<>(kvStateInformation.size()); final List<Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase>> metaDataCopy = new ArrayList<>(kvStateInformation.size()); for (Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase> tuple2 : kvStateInformation.values()) { // snapshot meta info stateMetaInfoSnapshots.add(tuple2.f1.snapshot()); metaDataCopy.add(tuple2); } final ResourceGuard.Lease lease = rocksDBResourceGuard.acquireResource(); final Snapshot snapshot = db.getSnapshot(); final SnapshotAsynchronousPartCallable asyncSnapshotCallable = new SnapshotAsynchronousPartCallable( checkpointStreamSupplier, lease, snapshot, stateMetaInfoSnapshots, metaDataCopy, primaryStreamFactory.toString()); return asyncSnapshotCallable.toAsyncSnapshotFutureTask(cancelStreamRegistry); }
AbstractRocksDBState<?, ?, SV> rocksDBState = (AbstractRocksDBState<?, ?, SV>) state; Snapshot rocksDBSnapshot = db.getSnapshot(); try ( RocksIteratorWrapper iterator = getRocksIterator(db, stateMetaInfo.f0);
/** * Constructor. * * @param db RocksDB database to snapshot * @throws NullPointerException if {@code db} is null */ public SnapshotRocksDBKVStore(RocksDB db) { this(db, db.getSnapshot()); }
/** * 1) Create a snapshot object from RocksDB. * * @param checkpointId id of the checkpoint for which we take the snapshot * @param checkpointTimeStamp timestamp of the checkpoint for which we take the snapshot */ public void takeDBSnapShot(long checkpointId, long checkpointTimeStamp) { Preconditions.checkArgument(snapshot == null, "Only one ongoing snapshot allowed!"); this.kvStateIterators = new ArrayList<>(stateBackend.kvStateInformation.size()); this.checkpointId = checkpointId; this.checkpointTimeStamp = checkpointTimeStamp; this.snapshot = stateBackend.db.getSnapshot(); }
/** * <p>Return a handle to the current DB state. Iterators created with * this handle will all observe a stable snapshot of the current DB * state. The caller must call ReleaseSnapshot(result) when the * snapshot is no longer needed.</p> * * <p>nullptr will be returned if the DB fails to take a snapshot or does * not support snapshot.</p> * * @return Snapshot {@link Snapshot} instance */ public Snapshot getSnapshot() { long snapshotHandle = getSnapshot(nativeHandle_); if (snapshotHandle != 0) { return new Snapshot(snapshotHandle); } return null; }
@Nonnull @Override public RunnableFuture<SnapshotResult<KeyedStateHandle>> doSnapshot( long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory primaryStreamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception { final SupplierWithException<CheckpointStreamWithResultProvider, Exception> checkpointStreamSupplier = createCheckpointStreamSupplier(checkpointId, primaryStreamFactory, checkpointOptions); final List<StateMetaInfoSnapshot> stateMetaInfoSnapshots = new ArrayList<>(kvStateInformation.size()); final List<Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase>> metaDataCopy = new ArrayList<>(kvStateInformation.size()); for (Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase> tuple2 : kvStateInformation.values()) { // snapshot meta info stateMetaInfoSnapshots.add(tuple2.f1.snapshot()); metaDataCopy.add(tuple2); } final ResourceGuard.Lease lease = rocksDBResourceGuard.acquireResource(); final Snapshot snapshot = db.getSnapshot(); final SnapshotAsynchronousPartCallable asyncSnapshotCallable = new SnapshotAsynchronousPartCallable( checkpointStreamSupplier, lease, snapshot, stateMetaInfoSnapshots, metaDataCopy, primaryStreamFactory.toString()); return asyncSnapshotCallable.toAsyncSnapshotFutureTask(cancelStreamRegistry); }
@Nonnull @Override public RunnableFuture<SnapshotResult<KeyedStateHandle>> doSnapshot( long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory primaryStreamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception { final SupplierWithException<CheckpointStreamWithResultProvider, Exception> checkpointStreamSupplier = createCheckpointStreamSupplier(checkpointId, primaryStreamFactory, checkpointOptions); final List<StateMetaInfoSnapshot> stateMetaInfoSnapshots = new ArrayList<>(kvStateInformation.size()); final List<Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase>> metaDataCopy = new ArrayList<>(kvStateInformation.size()); for (Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase> tuple2 : kvStateInformation.values()) { // snapshot meta info stateMetaInfoSnapshots.add(tuple2.f1.snapshot()); metaDataCopy.add(tuple2); } final ResourceGuard.Lease lease = rocksDBResourceGuard.acquireResource(); final Snapshot snapshot = db.getSnapshot(); final SnapshotAsynchronousPartCallable asyncSnapshotCallable = new SnapshotAsynchronousPartCallable( checkpointStreamSupplier, lease, snapshot, stateMetaInfoSnapshots, metaDataCopy, primaryStreamFactory.toString()); return asyncSnapshotCallable.toAsyncSnapshotFutureTask(cancelStreamRegistry); }
AbstractRocksDBState<?, ?, SV, S> rocksDBState = (AbstractRocksDBState<?, ?, SV, S>) state; Snapshot rocksDBSnapshot = db.getSnapshot(); try ( RocksIteratorWrapper iterator = getRocksIterator(db, stateMetaInfo.f0);
AbstractRocksDBState<?, ?, SV, S> rocksDBState = (AbstractRocksDBState<?, ?, SV, S>) state; Snapshot rocksDBSnapshot = db.getSnapshot(); try ( RocksIteratorWrapper iterator = getRocksIterator(db, stateMetaInfo.f0);