chia7712 commented on code in PR #22643:
URL: https://github.com/apache/kafka/pull/22643#discussion_r3457307100
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBTransactionBuffer.java:
##########
@@ -175,10 +178,50 @@ ManagedKeyValueIterator<Bytes, byte[]>
newBaseIterator(final Bytes from, final B
return newBaseIterator(cfHandle, from, to, forward, toInclusive);
}
+ @Override
+ ManagedKeyValueIterator<Bytes, byte[]> newBaseSnapshotIterator(final Bytes
from, final Bytes to,
+ final
boolean forward, final boolean toInclusive) {
+ return newBaseSnapshotIterator(cfHandle, from, to, forward,
toInclusive);
+ }
+
private ManagedKeyValueIterator<Bytes, byte[]> newBaseIterator(final
ColumnFamilyHandle cf,
final Bytes
from, final Bytes to,
final
boolean forward, final boolean toInclusive) {
final RocksIterator rocksIterator = db.newIterator(cf);
+ final ManagedKeyValueIterator<Bytes, byte[]> iter =
+ buildBaseIterator(rocksIterator, from, to, forward, toInclusive);
+ return maybeWrapRangeTombstones(iter);
+ }
+
+ private ManagedKeyValueIterator<Bytes, byte[]>
newBaseSnapshotIterator(final ColumnFamilyHandle cf,
+
final Bytes from, final Bytes to,
+
final boolean forward, final boolean toInclusive) {
+ final Snapshot snapshot = db.getSnapshot();
+ ReadOptions readOptions = null;
+ boolean released = false;
+ try {
+ readOptions = new ReadOptions();
+ readOptions.setSnapshot(snapshot);
+ final RocksIterator rocksIterator = db.newIterator(cf,
readOptions);
+ final ManagedKeyValueIterator<Bytes, byte[]> iter =
Review Comment:
we need to ensure `iter` gets closed even if line#208 fails, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]