cleanup: pass trxid by value

This commit is contained in:
Sergei Golubchik 2020-02-27 16:00:43 +01:00
parent 211421d5cc
commit cbede21d0d
16 changed files with 31 additions and 33 deletions

View file

@ -124,7 +124,7 @@
static inline struct PSI_transaction_locker *
inline_mysql_start_transaction(PSI_transaction_locker_state *state,
const void *xid,
const ulonglong *trxid,
ulonglong trxid,
int isolation_level,
my_bool read_only,
my_bool autocommit,

View file

@ -2205,7 +2205,7 @@ typedef void (*end_statement_v1_t)
*/
typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t)
(struct PSI_transaction_locker_state_v1 *state, const void *xid,
const ulonglong *trxid, int isolation_level, my_bool read_only,
ulonglong trxid, int isolation_level, my_bool read_only,
my_bool autocommit);
/**

View file

@ -602,7 +602,7 @@ typedef void (*end_statement_v1_t)
(struct PSI_statement_locker *locker, void *stmt_da);
typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t)
(struct PSI_transaction_locker_state_v1 *state, const void *xid,
const ulonglong *trxid, int isolation_level, my_bool read_only,
ulonglong trxid, int isolation_level, my_bool read_only,
my_bool autocommit);
typedef void (*start_transaction_v1_t)
(struct PSI_transaction_locker *locker,

View file

@ -35,7 +35,7 @@ C_MODE_START
PSI_transaction_locker*
pfs_get_thread_transaction_locker_v1(PSI_transaction_locker_state *state,
const void *xid,
const ulonglong *trxid,
ulonglong trxid,
int isolation_level,
my_bool read_only,
my_bool autocommit);

View file

@ -629,7 +629,7 @@ static void end_statement_noop(PSI_statement_locker *locker NNN,
static PSI_transaction_locker*
get_thread_transaction_locker_noop(PSI_transaction_locker_state *state NNN,
const void *xid NNN,
const ulonglong *trxid NNN,
ulonglong trxid NNN,
int isolation_level NNN,
my_bool read_only NNN,
my_bool autocommit NNN)

View file

@ -1236,8 +1236,7 @@ void ha_pre_shutdown()
times per transaction.
*/
void trans_register_ha(THD *thd, bool all, handlerton *ht_arg,
const ulonglong *trxid)
void trans_register_ha(THD *thd, bool all, handlerton *ht_arg, ulonglong trxid)
{
THD_TRANS *trans;
Ha_trx_info *ha_info;

View file

@ -5062,7 +5062,7 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal);
/* these are called by storage engines */
void trans_register_ha(THD *thd, bool all, handlerton *ht,
const ulonglong *trxid);
ulonglong trxid);
/*
Storage engine has to assume the transaction will end up with 2pc if

View file

@ -2212,8 +2212,8 @@ void MYSQL_BIN_LOG::set_write_error(THD *thd, bool is_transactional)
if (WSREP_EMULATE_BINLOG(thd))
{
if (is_transactional)
trans_register_ha(thd, TRUE, binlog_hton, NULL);
trans_register_ha(thd, FALSE, binlog_hton, NULL);
trans_register_ha(thd, TRUE, binlog_hton, 0);
trans_register_ha(thd, FALSE, binlog_hton, 0);
}
#endif /* WITH_WSREP */
DBUG_VOID_RETURN;
@ -5713,8 +5713,8 @@ THD::binlog_start_trans_and_stmt()
}
#endif
if (mstmt_mode)
trans_register_ha(this, TRUE, binlog_hton, NULL);
trans_register_ha(this, FALSE, binlog_hton, NULL);
trans_register_ha(this, TRUE, binlog_hton, 0);
trans_register_ha(this, FALSE, binlog_hton, 0);
/*
Mark statement transaction as read/write. We never start
a binary log transaction and keep it read-only,
@ -5758,7 +5758,7 @@ binlog_start_consistent_snapshot(handlerton *hton, THD *thd)
strmake_buf(cache_mngr->last_commit_pos_file, mysql_bin_log.last_commit_pos_file);
cache_mngr->last_commit_pos_offset= mysql_bin_log.last_commit_pos_offset;
trans_register_ha(thd, TRUE, binlog_hton, NULL);
trans_register_ha(thd, TRUE, binlog_hton, 0);
DBUG_RETURN(err);
}
@ -10748,8 +10748,8 @@ void wsrep_register_binlog_handler(THD *thd, bool trx)
Set callbacks in order to be able to call commmit or rollback.
*/
if (trx)
trans_register_ha(thd, TRUE, binlog_hton, NULL);
trans_register_ha(thd, FALSE, binlog_hton, NULL);
trans_register_ha(thd, TRUE, binlog_hton, 0);
trans_register_ha(thd, FALSE, binlog_hton, 0);
/*
Set the binary log as read/write otherwise callbacks are not called.

View file

@ -223,7 +223,7 @@ bool trans_begin(THD *thd, uint flags)
if (thd->m_transaction_psi == NULL)
{
thd->m_transaction_psi= MYSQL_START_TRANSACTION(&thd->m_transaction_state,
NULL, NULL, thd->tx_isolation,
NULL, 0, thd->tx_isolation,
thd->tx_read_only, false);
DEBUG_SYNC(thd, "after_set_transaction_psi_before_set_transaction_gtid");
//gtid_set_performance_schema_values(thd);

View file

@ -3492,7 +3492,7 @@ int ha_federatedx::start_stmt(MYSQL_THD thd, thr_lock_type lock_type)
if (!txn->in_transaction())
{
txn->stmt_begin();
trans_register_ha(thd, FALSE, ht, NULL);
trans_register_ha(thd, FALSE, ht, 0);
}
DBUG_RETURN(0);
}
@ -3515,12 +3515,12 @@ int ha_federatedx::external_lock(MYSQL_THD thd, int lock_type)
if (!thd_test_options(thd, (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
txn->stmt_begin();
trans_register_ha(thd, FALSE, ht, NULL);
trans_register_ha(thd, FALSE, ht, 0);
}
else
{
txn->txn_begin();
trans_register_ha(thd, TRUE, ht, NULL);
trans_register_ha(thd, TRUE, ht, 0);
}
}
}
@ -3538,7 +3538,7 @@ int ha_federatedx::savepoint_set(handlerton *hton, MYSQL_THD thd, void *sv)
if (txn && txn->has_connections())
{
if (txn->txn_begin())
trans_register_ha(thd, TRUE, hton, NULL);
trans_register_ha(thd, TRUE, hton, 0);
txn->sp_acquire((ulong *) sv);

View file

@ -2789,12 +2789,12 @@ innobase_register_trx(
const ulonglong trx_id = static_cast<ulonglong>(
trx_get_id_for_print(trx));
trans_register_ha(thd, FALSE, hton, &trx_id);
trans_register_ha(thd, FALSE, hton, trx_id);
if (!trx_is_registered_for_2pc(trx)
&& thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
trans_register_ha(thd, TRUE, hton, &trx_id);
trans_register_ha(thd, TRUE, hton, trx_id);
}
trx_register_for_2pc(trx);

View file

@ -5904,7 +5904,7 @@ void pfs_drop_sp_v1(uint sp_type,
PSI_transaction_locker*
pfs_get_thread_transaction_locker_v1(PSI_transaction_locker_state *state,
const void *xid,
const ulonglong *trxid,
ulonglong trxid,
int isolation_level,
my_bool read_only,
my_bool autocommit)
@ -5948,7 +5948,7 @@ pfs_get_thread_transaction_locker_v1(PSI_transaction_locker_state *state,
pfs->m_xid= *(PSI_xid *)xid;
pfs->m_xa= false;
pfs->m_xa_state= TRANS_STATE_XA_NOTR;
pfs->m_trxid= (trxid == NULL) ? 0 : *trxid;
pfs->m_trxid= trxid;
pfs->m_isolation_level= (enum_isolation_level)isolation_level;
pfs->m_read_only= read_only;
pfs->m_autocommit= autocommit;

View file

@ -90,7 +90,6 @@ PFS_prepared_stmt*
create_prepared_stmt(void *identity,
PFS_thread *thread, PFS_program *pfs_program,
PFS_events_statements *pfs_stmt, uint stmt_id,
const char* stmt_name, uint stmt_name_length,
const char* sqltext, uint sqltext_length);
const char* stmt_name, uint stmt_name_length);
void delete_prepared_stmt(PFS_prepared_stmt *pfs_ps);
#endif

View file

@ -213,7 +213,7 @@ void test_noop()
ok(metadata_locker == NULL, "no metadata_locker");
PSI_server->end_metadata_wait(NULL, 0);
transaction_locker= PSI_server->get_thread_transaction_locker(NULL, NULL, NULL, 1, false, 1);
transaction_locker= PSI_server->get_thread_transaction_locker(NULL, NULL, 0, 1, false, 1);
ok(transaction_locker == NULL, "no transaction_locker");
PSI_server->start_transaction(NULL, NULL, 0);
PSI_server->end_transaction(NULL, true);

View file

@ -4788,10 +4788,10 @@ static inline void rocksdb_register_tx(handlerton *const hton, THD *const thd,
Rdb_transaction *const tx) {
DBUG_ASSERT(tx != nullptr);
trans_register_ha(thd, FALSE, rocksdb_hton, NULL);
trans_register_ha(thd, FALSE, rocksdb_hton, 0);
if (my_core::thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
tx->start_stmt();
trans_register_ha(thd, TRUE, rocksdb_hton, NULL);
trans_register_ha(thd, TRUE, rocksdb_hton, 0);
}
}

View file

@ -1994,9 +1994,9 @@ int spider_internal_start_trx(
trx->trx_consistent_snapshot ? "TRUE" : "FALSE"));
if (!trx->trx_consistent_snapshot)
{
trans_register_ha(thd, FALSE, spider_hton_ptr, NULL);
trans_register_ha(thd, FALSE, spider_hton_ptr, 0);
if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
trans_register_ha(thd, TRUE, spider_hton_ptr, NULL);
trans_register_ha(thd, TRUE, spider_hton_ptr, 0);
}
trx->trx_start = TRUE;
trx->trx_xa_prepared = FALSE;
@ -3339,8 +3339,8 @@ int spider_start_consistent_snapshot(
trx->trx_consistent_snapshot = TRUE;
trx->use_consistent_snapshot = TRUE;
trx->internal_xa_snapshot = spider_param_internal_xa_snapshot(trx->thd);
trans_register_ha(trx->thd, FALSE, spider_hton_ptr, NULL);
trans_register_ha(trx->thd, TRUE, spider_hton_ptr, NULL);
trans_register_ha(trx->thd, FALSE, spider_hton_ptr, 0);
trans_register_ha(trx->thd, TRUE, spider_hton_ptr, 0);
if (spider_param_use_all_conns_snapshot(trx->thd))
{
trx->internal_xa = FALSE;