uhliarik commented on code in PR #49:
URL: https://github.com/apache/apr/pull/49#discussion_r1370095013
##########
dbm/apr_dbm_lmdb.c:
##########
@@ -216,9 +230,14 @@ static apr_status_t vt_lmdb_store(apr_dbm_t *dbm,
apr_datum_t key,
if ((rv = mdb_put(f->txn, f->dbi, &ckey, &cvalue, 0)) == 0) {
/* commit transaction */
- if (((rv = mdb_txn_commit(f->txn)) == MDB_SUCCESS)
- && ((rv = mdb_txn_begin(f->env, NULL, 0, &f->txn)) ==
MDB_SUCCESS)) {
+ if ((rv = mdb_txn_commit(f->txn)) == MDB_SUCCESS){
f->cursor = NULL;
Review Comment:
I'm not sure about this. In the documentation[0] is said that after
`mdb_txn_commit()`, cursor must not be used again. Therefore I thought that
invalidating pointer is enough.
On the other hand, in the documentation is said: `Earlier documentation
incorrectly said all cursors would be freed. Only write-transactions free
cursors.`. So if I understand it correctly, read-only transaction would leave
cursor not freed and so we must free it using `mdb_cursor_close(f->cursor);`?
But in `mdb_txn_commit` function, there is `mdb_cursors_close()` [1] which
looks like it closes all cursors [2].
[0]
http://www.lmdb.tech/doc/group__mdb.html#ga846fbd6f46105617ac9f4d76476f6597
[1]
https://github.com/LMDB/lmdb/blob/mdb.master/libraries/liblmdb/mdb.c#L4089C2-L4089C19
[2]
https://github.com/LMDB/lmdb/blob/mdb.master/libraries/liblmdb/mdb.c#L2927C1-L2927C18
--
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]