From f626acb39822f905dad4ce65d03a27fd05b9fee8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Mon, 19 Nov 2018 13:30:10 +0300 Subject: [PATCH] mdbx: relax DBI-sequences for concurrent open DBI-handles for present tables. Change-Id: I7f07d2e716074bd9c2847aeb062e366f46cca214 --- src/mdbx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mdbx.c b/src/mdbx.c index be1b3e56..8dd24e8d 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -12100,19 +12100,19 @@ int mdbx_dbi_open_ex(MDBX_txn *txn, const char *table_name, unsigned user_flags, bailout: mdbx_free(namedup); } else { - txn->mt_dbiseqs[slot] = (env->me_dbiseqs[slot] += 1); txn->mt_dbflags[slot] = (uint8_t)dbflag; txn->mt_dbxs[slot].md_name.iov_base = namedup; - mdbx_compiler_barrier(); txn->mt_dbxs[slot].md_name.iov_len = len; - if (slot == txn->mt_numdbs) - txn->mt_numdbs++; + txn->mt_numdbs += (slot == txn->mt_numdbs); if ((dbflag & DB_CREAT) == 0) { env->me_dbflags[slot] = txn->mt_dbs[slot].md_flags | MDBX_VALID; mdbx_compiler_barrier(); if (env->me_numdbs <= slot) env->me_numdbs = slot + 1; + } else { + env->me_dbiseqs[slot] += 1; } + txn->mt_dbiseqs[slot] = env->me_dbiseqs[slot]; *dbi = slot; }