From 4384b3d0bdeca1fa3df5bb8a7cc13cf043b8c3a6 Mon Sep 17 00:00:00 2001 From: the lemons Date: Mon, 5 Dec 2022 20:00:26 -0600 Subject: env:txn_begin(): make read-only by default this is more sensible behavior. read-write transactions are less performant, so the programmer should have to engage them explicitly. --- lmdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lmdb.c') diff --git a/lmdb.c b/lmdb.c index 1a2c27a..5bcf162 100644 --- a/lmdb.c +++ b/lmdb.c @@ -146,7 +146,7 @@ static int txn_begin(lua_State *L, bool nested) { MDB_txn *txn; reterr(mdb_txn_begin( - env, parent, lua_toboolean(L, 2) ? MDB_RDONLY : 0, &txn)); + env, parent, lua_toboolean(L, 2) || nested ? 0 : MDB_RDONLY, &txn)); struct handle *tud = lua_newuserdata(L, sizeof(struct handle)); tud->closed = false; -- cgit v1.2.3