Cleanup: Remove trx_get_id_for_print()

Any transaction that has requested a lock must have trx->id!=0.

trx_print_low(): Distinguish non-locking or inactive transaction
objects by displaying the pointer in parentheses.

fill_trx_row(): Do not try to map trx->id to a pointer-based value.
This commit is contained in:
Marko Mäkelä 2021-01-26 08:39:11 +02:00
commit 469da6c34d
6 changed files with 11 additions and 67 deletions

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation.
Copyright (c) 2016, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -106,42 +106,6 @@ trx_get_que_state_str(
}
}
/** Retreieves the transaction ID.
In a given point in time it is guaranteed that IDs of the running
transactions are unique. The values returned by this function for readonly
transactions may be reused, so a subsequent RO transaction may get the same ID
as a RO transaction that existed in the past. The values returned by this
function should be used for printing purposes only.
@param[in] trx transaction whose id to retrieve
@return transaction id */
UNIV_INLINE
trx_id_t
trx_get_id_for_print(
const trx_t* trx)
{
/* Readonly and transactions whose intentions are unknown (whether
they will eventually do a WRITE) don't have trx_t::id assigned (it is
0 for those transactions). Transaction IDs in
innodb_trx.trx_id,
innodb_locks.lock_id,
innodb_locks.lock_trx_id,
innodb_lock_waits.requesting_trx_id,
innodb_lock_waits.blocking_trx_id should match because those tables
could be used in an SQL JOIN on those columns. Also trx_t::id is
printed by SHOW ENGINE INNODB STATUS, and in logs, so we must have the
same value printed everywhere consistently. */
/* DATA_TRX_ID_LEN is the storage size in bytes. */
static const trx_id_t max_trx_id
= (1ULL << (DATA_TRX_ID_LEN * CHAR_BIT)) - 1;
ut_ad(trx->id <= max_trx_id);
return(trx->id != 0
? trx->id
: reinterpret_cast<trx_id_t>(trx) | (max_trx_id + 1));
}
/**********************************************************************//**
Determine if a transaction is a dictionary operation.
@return dictionary operation mode */