[MOD/WIP] Mark listing transactions as readonly

May want to sprinkle in "hinting" on the nature of operations done the
database, which could allow LMDB to deal with those far more efficiently
(for example, a read-only transaction can just be done as soon as the
JSON itself is parsed out, as we don't really need the former anymore!)
This commit is contained in:
LDA 2024-08-10 23:58:41 +02:00
parent 20bb7a20ad
commit f32cdb7d89

View file

@ -464,7 +464,9 @@ LMDBList(Db *d, Array *k)
pthread_mutex_lock(&d->lock); pthread_mutex_lock(&d->lock);
if ((code = mdb_txn_begin(db->environ, NULL, 0, &txn)) != 0) /* Marked as read-only, as we just don't need to write anything
* when listing */
if ((code = mdb_txn_begin(db->environ, NULL, MDB_RDONLY, &txn)) != 0)
{ {
/* Very bad! */ /* Very bad! */
Log(LOG_ERR, Log(LOG_ERR,