Skip to content

Commit 50f9fda

Browse files
author
Philip Stutz
committed
Only renew txn if txn has changed.
1 parent 2132503 commit 50f9fda

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/lmdbjava/Cursor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ public void renew(final Txn<T> newTxn) {
279279
newTxn.checkReadOnly();
280280
newTxn.checkReady();
281281
}
282-
checkRc(LIB.mdb_cursor_renew(newTxn.pointer(), ptrCursor));
283-
this.txn = newTxn;
282+
if (this.txn != newTxn) {
283+
checkRc(LIB.mdb_cursor_renew(newTxn.pointer(), ptrCursor));
284+
this.txn = newTxn;
285+
}
284286
}
285287

286288
/**

0 commit comments

Comments
 (0)