forked from Telodendria/Cytoplasm
[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:
parent
20bb7a20ad
commit
f32cdb7d89
1 changed files with 3 additions and 1 deletions
|
@ -464,7 +464,9 @@ LMDBList(Db *d, Array *k)
|
|||
|
||||
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! */
|
||||
Log(LOG_ERR,
|
||||
|
|
Loading…
Reference in a new issue