summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-11-25 00:01:19 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2015-11-25 00:01:19 +1100
commit122382417b1223fbcac1220fc0b863a373bddd69 (patch)
tree2ffb4ad4ce1ee5750b10582ee856de4b20bab7bd /src
parent0a52a80a39fc47145fb755d792792ae820b266ed (diff)
downloadmongo-122382417b1223fbcac1220fc0b863a373bddd69.tar.gz
WT-2337 Avoid yields if we race allocating transaction IDs.
It had a major perf impact on parallel populate workloads including YCSB.
Diffstat (limited to 'src')
-rw-r--r--src/include/txn.i14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/include/txn.i b/src/include/txn.i
index f19cf259174..ef9d5a273cf 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -323,6 +323,7 @@ __wt_txn_id_alloc(WT_SESSION_IMPL *session, bool publish)
{
WT_TXN_GLOBAL *txn_global;
uint64_t id;
+ u_int i;
txn_global = &S2C(session)->txn_global;
@@ -353,14 +354,17 @@ __wt_txn_id_alloc(WT_SESSION_IMPL *session, bool publish)
if (publish) {
session->txn.id = id;
- WT_PUBLISH(WT_SESSION_TXN_STATE(session)->id, id);
+ WT_SESSION_TXN_STATE(session)->id = id;
}
- while (txn_global->current != id ||
- !__wt_atomic_casv64(&txn_global->current, id, id + 1))
- __wt_yield();
+ for (i = 0; txn_global->current != id; i++)
+ if (i < 100)
+ WT_PAUSE();
+ else
+ __wt_yield();
- return (id);
+ WT_PUBLISH(txn_global->current, id + 1);
+ return (id);
}
/*