StefanRRichter commented on a change in pull request #7674: [FLINK-10043] [State Backends] Refactor RocksDBKeyedStateBackend object construction/initialization/restore code URL: https://github.com/apache/flink/pull/7674#discussion_r258674539
########## File path: flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/snapshot/RocksFullSnapshotStrategy.java ########## @@ -122,28 +123,29 @@ public RocksFullSnapshotStrategy( createCheckpointStreamSupplier(checkpointId, primaryStreamFactory, checkpointOptions); final List<StateMetaInfoSnapshot> stateMetaInfoSnapshots = new ArrayList<>(kvStateInformation.size()); - final List<Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase>> metaDataCopy = + final List<StateColumnFamilyHandle> metaDataCopy = new ArrayList<>(kvStateInformation.size()); - for (Tuple2<ColumnFamilyHandle, RegisteredStateMetaInfoBase> tuple2 : kvStateInformation.values()) { + for (StateColumnFamilyHandle stateCFHandle : kvStateInformation.values()) { // snapshot meta info - stateMetaInfoSnapshots.add(tuple2.f1.snapshot()); - metaDataCopy.add(tuple2); + stateMetaInfoSnapshots.add(stateCFHandle.getStateMetaInfo().snapshot()); + metaDataCopy.add(stateCFHandle); } - final ResourceGuard.Lease lease = rocksDBResourceGuard.acquireResource(); - final Snapshot snapshot = db.getSnapshot(); + try (ResourceGuard.Lease lease = rocksDBResourceGuard.acquireResource()) { Review comment: This looks like a change that introduces a bug, because it will close the lease to early, before they asynchronous part is completed. This can lead to an async snapshot attempting to interact with a closed db, because the db is no longer protected against closing after the end of the synchronous part. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services