summaryrefslogtreecommitdiff
path: root/storage/tokudb/PerconaFT/ft/txn/txn.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-01-23 19:20:10 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-01-23 19:20:10 +0200
commitf6716cef7eb267db958ce72c597d765bb8b7923e (patch)
treecd3893f9d635908b9690479a051a35ed856cc868 /storage/tokudb/PerconaFT/ft/txn/txn.cc
parent618d8fdf37c7ee8e21fc3c9913d99a7894a46ff1 (diff)
downloadmariadb-git-f6716cef7eb267db958ce72c597d765bb8b7923e.tar.gz
5.6.38-83.0
Diffstat (limited to 'storage/tokudb/PerconaFT/ft/txn/txn.cc')
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/txn.cc119
1 files changed, 61 insertions, 58 deletions
diff --git a/storage/tokudb/PerconaFT/ft/txn/txn.cc b/storage/tokudb/PerconaFT/ft/txn/txn.cc
index a3ce6beb7b0..7327cbd9d24 100644
--- a/storage/tokudb/PerconaFT/ft/txn/txn.cc
+++ b/storage/tokudb/PerconaFT/ft/txn/txn.cc
@@ -45,8 +45,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/txn/txn_manager.h"
#include "util/status.h"
-void
-toku_txn_get_status(TXN_STATUS s) {
+toku_instr_key *txn_lock_mutex_key;
+toku_instr_key *txn_state_lock_mutex_key;
+toku_instr_key *result_state_cond_key;
+
+void toku_txn_get_status(TXN_STATUS s) {
txn_status.init();
*s = txn_status;
}
@@ -225,74 +228,74 @@ static void toku_txn_create_txn (
static txn_child_manager tcm;
- struct tokutxn new_txn = {
- .txnid = {.parent_id64 = TXNID_NONE, .child_id64 = TXNID_NONE },
- .snapshot_txnid64 = TXNID_NONE,
- .snapshot_type = for_recovery ? TXN_SNAPSHOT_NONE : snapshot_type,
- .for_recovery = for_recovery,
- .logger = logger,
- .parent = parent_tokutxn,
- .child = NULL,
- .child_manager_s = tcm,
- .child_manager = NULL,
- .container_db_txn = container_db_txn,
- .live_root_txn_list = nullptr,
- .xids = NULL,
- .snapshot_next = NULL,
- .snapshot_prev = NULL,
- .begin_was_logged = false,
- .declared_read_only = read_only,
- .do_fsync = false,
- .force_fsync_on_commit = false,
- .do_fsync_lsn = ZERO_LSN,
- .xa_xid = {0, 0, 0, ""},
- .progress_poll_fun = NULL,
- .progress_poll_fun_extra = NULL,
-
- // You cannot initialize txn_lock a TOKU_MUTEX_INITIALIZER, because we
- // will initialize it in the code below, and it cannot already
- // be initialized at that point. Also, in general, you don't
- // get to use PTHREAD_MUTEX_INITALIZER (which is what is inside
- // TOKU_MUTEX_INITIALIZER) except in static variables, and this
- // is initializing an auto variable.
- //
- // And we cannot simply avoid initializing these fields
- // because, although it avoids -Wmissing-field-initializer
- // errors under gcc, it gets other errors about non-trivial
- // designated initializers not being supported.
-
- .txn_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER
- .open_fts = open_fts,
- .roll_info = roll_info,
- .state_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER
- .state_cond = ZERO_COND_INITIALIZER, // Not TOKU_COND_INITIALIZER
- .state = TOKUTXN_LIVE,
- .num_pin = 0,
- .client_id = 0,
- .client_extra = nullptr,
- .start_time = time(NULL),
- };
+struct tokutxn new_txn = {
+ .txnid = {.parent_id64 = TXNID_NONE, .child_id64 = TXNID_NONE },
+ .snapshot_txnid64 = TXNID_NONE,
+ .snapshot_type = for_recovery ? TXN_SNAPSHOT_NONE : snapshot_type,
+ .for_recovery = for_recovery,
+ .logger = logger,
+ .parent = parent_tokutxn,
+ .child = NULL,
+ .child_manager_s = tcm,
+ .child_manager = NULL,
+ .container_db_txn = container_db_txn,
+ .live_root_txn_list = nullptr,
+ .xids = NULL,
+ .snapshot_next = NULL,
+ .snapshot_prev = NULL,
+ .begin_was_logged = false,
+ .declared_read_only = read_only,
+ .do_fsync = false,
+ .force_fsync_on_commit = false,
+ .do_fsync_lsn = ZERO_LSN,
+ .xa_xid = {0, 0, 0, ""},
+ .progress_poll_fun = NULL,
+ .progress_poll_fun_extra = NULL,
+
+ // You cannot initialize txn_lock a TOKU_MUTEX_INITIALIZER, because we
+ // will initialize it in the code below, and it cannot already
+ // be initialized at that point. Also, in general, you don't
+ // get to use PTHREAD_MUTEX_INITALIZER (which is what is inside
+ // TOKU_MUTEX_INITIALIZER) except in static variables, and this
+ // is initializing an auto variable.
+ //
+ // And we cannot simply avoid initializing these fields
+ // because, although it avoids -Wmissing-field-initializer
+ // errors under gcc, it gets other errors about non-trivial
+ // designated initializers not being supported.
+
+ .txn_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER
+ .open_fts = open_fts,
+ .roll_info = roll_info,
+ .state_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER
+ .state_cond = ZERO_COND_INITIALIZER, // Not TOKU_COND_INITIALIZER
+ .state = TOKUTXN_LIVE,
+ .num_pin = 0,
+ .client_id = 0,
+ .client_extra = nullptr,
+ .start_time = time(NULL),
+};
- TOKUTXN result = NULL;
- XMEMDUP(result, &new_txn);
- invalidate_xa_xid(&result->xa_xid);
- if (parent_tokutxn == NULL) {
- result->child_manager = &result->child_manager_s;
- result->child_manager->init(result);
+TOKUTXN result = NULL;
+XMEMDUP(result, &new_txn);
+invalidate_xa_xid(&result->xa_xid);
+if (parent_tokutxn == NULL) {
+ result->child_manager = &result->child_manager_s;
+ result->child_manager->init(result);
}
else {
result->child_manager = parent_tokutxn->child_manager;
}
- toku_mutex_init(&result->txn_lock, nullptr);
+ toku_mutex_init(*txn_lock_mutex_key, &result->txn_lock, nullptr);
toku_pthread_mutexattr_t attr;
toku_mutexattr_init(&attr);
toku_mutexattr_settype(&attr, TOKU_MUTEX_ADAPTIVE);
- toku_mutex_init(&result->state_lock, &attr);
+ toku_mutex_init(*txn_state_lock_mutex_key, &result->state_lock, &attr);
toku_mutexattr_destroy(&attr);
- toku_cond_init(&result->state_cond, nullptr);
+ toku_cond_init(*result_state_cond_key, &result->state_cond, nullptr);
*tokutxn = result;