On 30. mai 2016 13:51, Hallvard Breien Furuseth wrote:
Copied from a private mail:
> Maybe a good way in between could be to memcpy txn->mt_env->me_dbflags.
> (...) memcpy uses SSE instructions for x86_64.
Yes. If we make MDB_txn.mt_dbflags an uint16_t*, we can memcpy to it.
That costs <maxdbs> bytes/txn + one more reserved env flag bit in
PERSISTENT_FLAGS: Reserve DB_UNUSED, and keep it always set in
me_dbflags so the memcpy will set it in mt_dbflags.
Oops, that was too clever. Then a bunch of code which assumes a DBI
is valid if various txn flags are set, must also check DB_UNUSED.
Or invert that to DB_USED which might be easier - (flags & DB_DIRTY)
becomes F_ISSET(flags, DB_DIRTY|DB_USED) which checks if both are set.
Maybe the simple solution using 2*<maxdbs> bytes/txn would be better.