Commit d09aec7a authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-19940 Clean up INFORMATION_SCHEMA.INNODB_ tables

Shorten some VARCHAR attributes to a more reasonable length.

INNODB_METRICS: Rename the column STATUS to ENABLED, and make it Boolean.

Replace with INT(1) many Boolean attributes that were declared as VARCHAR
containing 'NO','YES','disabled','enabled','Uninitialized','Initialized'.

Replace some VARCHAR attributes with ENUM.

Replace some BIGINT with INT when 32 bits are sufficient.

Remove INNODB_SYS_TABLESPACES.SPACE_TYPE. The type of a tablespace
can be derived from the tablespace ID. A fixed number is used for
the system tablespace and the temporary tablespace. All other tablespaces
are single-table or single-partition tablespaces.

i_s_locks_row_t::lock_type, lock_get_type_str(): Remove.
This is a redundant field. Table and record locks can be
distinguished by whether i_s_locks_row_t::lock_index is NULL.

fill_trx_row(): Do not unnecessarily copy the constant strings that
trx->op_info is pointing to.

i_s_locks_row_t::lock_mode: Replace string with integer.

lock_get_mode_str(), lock_get_trx_id(), lock_get_trx(): Remove.

field_store_ulint(): Remove.
parent d8b8f55a
......@@ -8,8 +8,7 @@ SELECT t.name 'Table Name',
t.flag 'Table Flags',
t.n_cols 'Columns',
t.row_format 'Row Format',
t.zip_page_size 'Zip Size',
t.space_type 'Space Type'
t.zip_page_size 'Zip Size'
FROM information_schema.innodb_sys_tables t LEFT JOIN
information_schema.innodb_sys_tablespaces s
ON t.space = s.space
......
......@@ -6,7 +6,6 @@
--replace_regex /#P#/#p#/ /#SP#/#sp#/
--replace_result ./ MYSQLD_DATADIR/ $MYSQLD_DATADIR/ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR/ $MYSQL_TMP_DIR MYSQL_TMP_DIR $INNODB_PAGE_SIZE DEFAULT
SELECT s.name 'Space_Name',
s.space_type 'Space_Type',
s.page_size 'Page_Size',
s.zip_page_size 'Zip_Size',
s.row_format 'Formats_Permitted',
......
......@@ -2,19 +2,19 @@ set global innodb_stats_auto_recalc=off;
CREATE TABLE t1 (i int) ENGINE=InnoDB;
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
test/t1 Initialized 0 0
test/t1 1 0 0
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
test/t1 Initialized 2 2
test/t1 1 2 2
DELETE FROM t1 WHERE i = 1;
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
test/t1 Initialized 1 3
test/t1 1 1 3
UPDATE t1 SET i = 4 WHERE i = 2;
SELECT NAME, STATS_INITIALIZED, NUM_ROWS, MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
NAME STATS_INITIALIZED NUM_ROWS MODIFIED_COUNTER
test/t1 Initialized 1 4
test/t1 1 1 4
DROP TABLE t1;
set global innodb_stats_auto_recalc=default;
......@@ -22,7 +22,7 @@ lock_table COUNT(*)
"test"."t_min" 2
"test"."`t'\""_str" 10
Field Type Null Key Default Extra
trx_id varchar(18) NO
trx_id bigint(21) unsigned NO 0
trx_state varchar(13) NO
trx_started datetime NO 0000-00-00 00:00:00
trx_requested_lock_id varchar(81) YES NULL
......@@ -38,7 +38,7 @@ trx_lock_memory_bytes bigint(21) unsigned NO 0
trx_rows_locked bigint(21) unsigned NO 0
trx_rows_modified bigint(21) unsigned NO 0
trx_concurrency_tickets bigint(21) unsigned NO 0
trx_isolation_level varchar(16) NO
trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO
trx_unique_checks int(1) NO 0
trx_foreign_key_checks int(1) NO 0
trx_last_foreign_key_error varchar(256) YES NULL
......
This diff is collapsed.
This diff is collapsed.
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
Table Create Table
INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
`POOL_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
`BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`SPACE` bigint(21) unsigned NOT NULL DEFAULT 0,
`PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT 0,
`SPACE` int(11) unsigned NOT NULL DEFAULT 0,
`PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0,
`PAGE_TYPE` varchar(64) DEFAULT NULL,
`FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT 0,
`FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT 0,
`IS_HASHED` varchar(3) DEFAULT NULL,
`FLUSH_TYPE` int(11) unsigned NOT NULL DEFAULT 0,
`FIX_COUNT` int(11) unsigned NOT NULL DEFAULT 0,
`IS_HASHED` int(1) NOT NULL DEFAULT 0,
`NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
`OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
`ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT 0,
`TABLE_NAME` varchar(1024) DEFAULT NULL,
`INDEX_NAME` varchar(1024) DEFAULT NULL,
`INDEX_NAME` varchar(64) DEFAULT NULL,
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0,
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`PAGE_STATE` varchar(64) DEFAULT NULL,
`IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') DEFAULT NULL,
`IS_OLD` varchar(3) DEFAULT NULL,
`PAGE_STATE` enum('NOT_USED','READY_FOR_USE','FILE_PAGE','MEMORY','REMOVE_HASH') NOT NULL DEFAULT '',
`IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL DEFAULT '',
`IS_OLD` int(1) NOT NULL DEFAULT 0,
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
Table Create Table
INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
`POOL_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
`LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT 0,
`SPACE` bigint(21) unsigned NOT NULL DEFAULT 0,
`PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT 0,
`SPACE` int(11) unsigned NOT NULL DEFAULT 0,
`PAGE_NUMBER` int(11) unsigned NOT NULL DEFAULT 0,
`PAGE_TYPE` varchar(64) DEFAULT NULL,
`FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT 0,
`FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT 0,
`IS_HASHED` varchar(3) DEFAULT NULL,
`FIX_COUNT` int(11) unsigned NOT NULL DEFAULT 0,
`IS_HASHED` int(1) NOT NULL DEFAULT 0,
`NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
`OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT 0,
`ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT 0,
`TABLE_NAME` varchar(1024) DEFAULT NULL,
`INDEX_NAME` varchar(1024) DEFAULT NULL,
`INDEX_NAME` varchar(64) DEFAULT NULL,
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0,
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`COMPRESSED` varchar(3) DEFAULT NULL,
`IO_FIX` varchar(64) DEFAULT NULL,
`IS_OLD` varchar(3) DEFAULT NULL,
`COMPRESSED` int(1) NOT NULL DEFAULT 0,
`IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL DEFAULT '',
`IS_OLD` int(1) DEFAULT NULL,
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
Table Create Table
INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` (
`POOL_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`POOL_ID` int(11) unsigned NOT NULL DEFAULT 0,
`POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT 0,
`DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT 0,
......
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX;
Table Create Table
INNODB_CMP_PER_INDEX CREATE TEMPORARY TABLE `INNODB_CMP_PER_INDEX` (
`database_name` varchar(192) NOT NULL DEFAULT '',
`table_name` varchar(192) NOT NULL DEFAULT '',
`index_name` varchar(192) NOT NULL DEFAULT '',
`database_name` varchar(64) NOT NULL DEFAULT '',
`table_name` varchar(64) NOT NULL DEFAULT '',
`index_name` varchar(64) NOT NULL DEFAULT '',
`compress_ops` int(11) NOT NULL DEFAULT 0,
`compress_ops_ok` int(11) NOT NULL DEFAULT 0,
`compress_time` int(11) NOT NULL DEFAULT 0,
......
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET;
Table Create Table
INNODB_CMP_PER_INDEX_RESET CREATE TEMPORARY TABLE `INNODB_CMP_PER_INDEX_RESET` (
`database_name` varchar(192) NOT NULL DEFAULT '',
`table_name` varchar(192) NOT NULL DEFAULT '',
`index_name` varchar(192) NOT NULL DEFAULT '',
`database_name` varchar(64) NOT NULL DEFAULT '',
`table_name` varchar(64) NOT NULL DEFAULT '',
`index_name` varchar(64) NOT NULL DEFAULT '',
`compress_ops` int(11) NOT NULL DEFAULT 0,
`compress_ops_ok` int(11) NOT NULL DEFAULT 0,
`compress_time` int(11) NOT NULL DEFAULT 0,
......
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
Table Create Table
INNODB_LOCK_WAITS CREATE TEMPORARY TABLE `INNODB_LOCK_WAITS` (
`requesting_trx_id` varchar(18) NOT NULL DEFAULT '',
`requesting_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
`requested_lock_id` varchar(81) NOT NULL DEFAULT '',
`blocking_trx_id` varchar(18) NOT NULL DEFAULT '',
`blocking_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
`blocking_lock_id` varchar(81) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
......@@ -2,13 +2,13 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCKS;
Table Create Table
INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` (
`lock_id` varchar(81) NOT NULL DEFAULT '',
`lock_trx_id` varchar(18) NOT NULL DEFAULT '',
`lock_mode` varchar(32) NOT NULL DEFAULT '',
`lock_type` varchar(32) NOT NULL DEFAULT '',
`lock_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
`lock_mode` enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NOT NULL DEFAULT '',
`lock_type` enum('RECORD','TABLE') NOT NULL DEFAULT '',
`lock_table` varchar(1024) NOT NULL DEFAULT '',
`lock_index` varchar(1024) DEFAULT NULL,
`lock_space` bigint(21) unsigned DEFAULT NULL,
`lock_page` bigint(21) unsigned DEFAULT NULL,
`lock_rec` bigint(21) unsigned DEFAULT NULL,
`lock_space` int(11) unsigned DEFAULT NULL,
`lock_page` int(11) unsigned DEFAULT NULL,
`lock_rec` int(11) unsigned DEFAULT NULL,
`lock_data` varchar(8192) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
......@@ -15,7 +15,7 @@ INNODB_METRICS CREATE TEMPORARY TABLE `INNODB_METRICS` (
`TIME_DISABLED` datetime DEFAULT NULL,
`TIME_ELAPSED` bigint(21) DEFAULT NULL,
`TIME_RESET` datetime DEFAULT NULL,
`STATUS` varchar(193) NOT NULL DEFAULT '',
`TYPE` varchar(193) NOT NULL DEFAULT '',
`ENABLED` int(1) NOT NULL DEFAULT 0,
`TYPE` enum('value','status_counter','set_owner','set_member','counter') NOT NULL DEFAULT '',
`COMMENT` varchar(193) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
......@@ -2,7 +2,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
Table Create Table
INNODB_SYS_COLUMNS CREATE TEMPORARY TABLE `INNODB_SYS_COLUMNS` (
`TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`NAME` varchar(193) NOT NULL DEFAULT '',
`NAME` varchar(64) NOT NULL DEFAULT '',
`POS` bigint(21) unsigned NOT NULL DEFAULT 0,
`MTYPE` int(11) NOT NULL DEFAULT 0,
`PRTYPE` int(11) NOT NULL DEFAULT 0,
......
......@@ -2,6 +2,6 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
Table Create Table
INNODB_SYS_FIELDS CREATE TEMPORARY TABLE `INNODB_SYS_FIELDS` (
`INDEX_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`NAME` varchar(193) NOT NULL DEFAULT '',
`NAME` varchar(64) NOT NULL DEFAULT '',
`POS` int(11) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
......@@ -2,7 +2,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
Table Create Table
INNODB_SYS_FOREIGN_COLS CREATE TEMPORARY TABLE `INNODB_SYS_FOREIGN_COLS` (
`ID` varchar(193) NOT NULL DEFAULT '',
`FOR_COL_NAME` varchar(193) NOT NULL DEFAULT '',
`REF_COL_NAME` varchar(193) NOT NULL DEFAULT '',
`FOR_COL_NAME` varchar(64) NOT NULL DEFAULT '',
`REF_COL_NAME` varchar(64) NOT NULL DEFAULT '',
`POS` int(11) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
......@@ -2,7 +2,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
Table Create Table
INNODB_SYS_INDEXES CREATE TEMPORARY TABLE `INNODB_SYS_INDEXES` (
`INDEX_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`NAME` varchar(193) NOT NULL DEFAULT '',
`NAME` varchar(64) NOT NULL DEFAULT '',
`TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`TYPE` int(11) NOT NULL DEFAULT 0,
`N_FIELDS` int(11) NOT NULL DEFAULT 0,
......
......@@ -4,9 +4,9 @@ INNODB_SYS_TABLES CREATE TEMPORARY TABLE `INNODB_SYS_TABLES` (
`TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`NAME` varchar(655) NOT NULL DEFAULT '',
`FLAG` int(11) NOT NULL DEFAULT 0,
`N_COLS` int(11) NOT NULL DEFAULT 0,
`SPACE` int(11) NOT NULL DEFAULT 0,
`ROW_FORMAT` varchar(12) DEFAULT NULL,
`N_COLS` int(11) unsigned NOT NULL DEFAULT 0,
`SPACE` int(11) unsigned NOT NULL DEFAULT 0,
`ROW_FORMAT` enum('Redundant','Compact','Compressed','Dynamic') DEFAULT NULL,
`ZIP_PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
`SPACE_TYPE` varchar(10) DEFAULT NULL
`SPACE_TYPE` enum('Single','System') DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
......@@ -7,7 +7,6 @@ INNODB_SYS_TABLESPACES CREATE TEMPORARY TABLE `INNODB_SYS_TABLESPACES` (
`ROW_FORMAT` varchar(22) DEFAULT NULL,
`PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
`ZIP_PAGE_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
`SPACE_TYPE` varchar(10) DEFAULT NULL,
`FS_BLOCK_SIZE` int(11) unsigned NOT NULL DEFAULT 0,
`FILE_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`ALLOCATED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0
......
......@@ -2,8 +2,8 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
Table Create Table
INNODB_SYS_TABLESTATS CREATE TEMPORARY TABLE `INNODB_SYS_TABLESTATS` (
`TABLE_ID` bigint(21) unsigned NOT NULL DEFAULT 0,
`NAME` varchar(193) NOT NULL DEFAULT '',
`STATS_INITIALIZED` varchar(193) NOT NULL DEFAULT '',
`NAME` varchar(64) NOT NULL DEFAULT '',
`STATS_INITIALIZED` int(1) NOT NULL DEFAULT 0,
`NUM_ROWS` bigint(21) unsigned NOT NULL DEFAULT 0,
`CLUST_INDEX_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`OTHER_INDEX_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
......
......@@ -10,5 +10,5 @@ INNODB_TABLESPACES_ENCRYPTION CREATE TEMPORARY TABLE `INNODB_TABLESPACES_ENCRYPT
`KEY_ROTATION_PAGE_NUMBER` bigint(21) unsigned DEFAULT NULL,
`KEY_ROTATION_MAX_PAGE_NUMBER` bigint(21) unsigned DEFAULT NULL,
`CURRENT_KEY_ID` int(11) unsigned NOT NULL DEFAULT 0,
`ROTATING_OR_FLUSHING` int(1) unsigned NOT NULL DEFAULT 0
`ROTATING_OR_FLUSHING` int(1) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TRX;
Table Create Table
INNODB_TRX CREATE TEMPORARY TABLE `INNODB_TRX` (
`trx_id` varchar(18) NOT NULL DEFAULT '',
`trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_state` varchar(13) NOT NULL DEFAULT '',
`trx_started` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`trx_requested_lock_id` varchar(81) DEFAULT NULL,
......@@ -17,7 +17,7 @@ INNODB_TRX CREATE TEMPORARY TABLE `INNODB_TRX` (
`trx_rows_locked` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_rows_modified` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_concurrency_tickets` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_isolation_level` varchar(16) NOT NULL DEFAULT '',
`trx_isolation_level` enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NOT NULL DEFAULT '',
`trx_unique_checks` int(1) NOT NULL DEFAULT 0,
`trx_foreign_key_checks` int(1) NOT NULL DEFAULT 0,
`trx_last_foreign_key_error` varchar(256) DEFAULT NULL,
......
......@@ -3,14 +3,14 @@
@@ -41,10 +41,10 @@
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
-test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
-test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
+test/t1 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
+test/t2 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
-test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
+test/t4 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
Space_Name Page_Size Zip_Size Formats_Permitted Path
-test/t1 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
-test/t2 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
+test/t1 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
+test/t2 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
test/t3 DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
-test/t4 DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
+test/t4 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 8123, Compact: 8126.
......@@ -3,14 +3,14 @@
@@ -41,10 +41,10 @@
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
-test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
-test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
+test/t1 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
+test/t2 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
-test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
+test/t4 Single DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
Space_Name Page_Size Zip_Size Formats_Permitted Path
-test/t1 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
-test/t2 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
+test/t1 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t1.ibd
+test/t2 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t2.ibd
test/t3 DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
-test/t4 DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
+test/t4 DEFAULT DEFAULT NULL MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 8123, Compact: 8126.
......@@ -40,11 +40,11 @@ test/t2 5 1 PRIMARY 3 3 1 50
test/t3 5 41 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t1 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
test/t3 Single DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
Space_Name Page_Size Zip_Size Formats_Permitted Path
test/t1 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
test/t3 DEFAULT 8192 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 8123, Compact: 8126.
......
......@@ -6948,7 +6948,7 @@ void
buf_stats_get_pool_info(
/*====================*/
buf_pool_t* buf_pool, /*!< in: buffer pool */
ulint pool_id, /*!< in: buffer pool ID */
uint pool_id, /*!< in: buffer pool ID */
buf_pool_info_t* all_pool_info) /*!< in/out: buffer pool info
to fill */
{
......
......@@ -675,18 +675,13 @@ dict_process_sys_tablespaces(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_TABLESPACES rec */
ulint* space, /*!< out: space id */
uint32_t* space, /*!< out: tablespace identifier */
const char** name, /*!< out: tablespace name */
ulint* flags) /*!< out: tablespace flags */
{
ulint len;
const byte* field;
/* Initialize the output values */
*space = ULINT_UNDEFINED;
*name = NULL;
*flags = ULINT_UNDEFINED;
if (rec_get_deleted_flag(rec, 0)) {
return("delete-marked record in SYS_TABLESPACES");
}
......@@ -741,7 +736,7 @@ dict_process_sys_datafiles(
/*=======================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_DATAFILES rec */
ulint* space, /*!< out: space id */
uint32_t* space, /*!< out: space id */
const char** path) /*!< out: datafile paths */
{
ulint len;
......
......@@ -859,7 +859,7 @@ innodb_tmpdir_validate(
Maps a MySQL trx isolation level code to the InnoDB isolation level code
@return InnoDB isolation level */
static inline
ulint
uint
innobase_map_isolation_level(
/*=========================*/
enum_tx_isolation iso); /*!< in: MySQL isolation level code */
......@@ -14322,7 +14322,6 @@ ha_innobase::check(
ulint n_rows;
ulint n_rows_in_table = ULINT_UNDEFINED;
bool is_ok = true;
ulint old_isolation_level;
dberr_t ret;
DBUG_ENTER("ha_innobase::check");
......@@ -14385,7 +14384,7 @@ ha_innobase::check(
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
old_isolation_level = m_prebuilt->trx->isolation_level;
uint old_isolation_level = m_prebuilt->trx->isolation_level;
/* We must run the index record counts at an isolation level
>= READ COMMITTED, because a dirty read can see a wrong number
......@@ -15331,7 +15330,7 @@ ha_innobase::start_stmt(
Maps a MySQL trx isolation level code to the InnoDB isolation level code
@return InnoDB isolation level */
static inline
ulint
uint
innobase_map_isolation_level(
/*=========================*/
enum_tx_isolation iso) /*!< in: MySQL isolation level code */
......
This diff is collapsed.
......@@ -135,16 +135,6 @@ HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */
#define SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE 18
#define SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 19
/*******************************************************************//**
Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field.
If the value is ULINT_UNDEFINED then the field it set to NULL.
@return 0 on success */
int
field_store_ulint(
/*==============*/
Field* field, /*!< in/out: target field for storage */
ulint n); /*!< in: value to store */
/*******************************************************************//**
Auxiliary function to store char* value in MYSQL_TYPE_STRING field.
@return 0 on success */
......
......@@ -137,7 +137,7 @@ enum buf_page_state {
will be used to print table IO stats */
struct buf_pool_info_t{
/* General buffer pool info */
ulint pool_unique_id; /*!< Buffer Pool ID */
uint pool_unique_id; /*!< Buffer Pool ID */
ulint pool_size; /*!< Buffer Pool size in pages */
ulint lru_len; /*!< Length of buf_pool->LRU */
ulint old_lru_len; /*!< buf_pool->LRU_old_len */
......@@ -828,7 +828,7 @@ void
buf_stats_get_pool_info(
/*====================*/
buf_pool_t* buf_pool, /*!< in: buffer pool */
ulint pool_id, /*!< in: buffer pool ID */
uint pool_id, /*!< in: buffer pool ID */
buf_pool_info_t* all_pool_info); /*!< in/out: buffer pool info
to fill */
/** Return the ratio in percents of modified pages in the buffer pool /
......
......@@ -281,7 +281,7 @@ dict_process_sys_tablespaces(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_TABLESPACES rec */
ulint* space, /*!< out: pace id */
uint32_t* space, /*!< out: tablespace identifier */
const char** name, /*!< out: tablespace name */
ulint* flags); /*!< out: tablespace flags */
/********************************************************************//**
......@@ -293,7 +293,7 @@ dict_process_sys_datafiles(
/*=======================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_DATAFILES rec */
ulint* space, /*!< out: pace id */
uint32_t* space, /*!< out: tablespace identifier */
const char** path); /*!< out: datafile path */
/** Update the record for space_id in SYS_TABLESPACES to this filepath.
......
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2019, 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
......@@ -609,42 +609,6 @@ lock_get_type(
/*==========*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
Gets the trx of the lock. Non-inline version for using outside of the
lock module.
@return trx_t* */
UNIV_INTERN
trx_t*
lock_get_trx(
/*=========*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
Gets the id of the transaction owning a lock.
@return transaction id */
trx_id_t
lock_get_trx_id(
/*============*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
Gets the mode of a lock in a human readable string.
The string should not be free()'d or modified.
@return lock mode */
const char*
lock_get_mode_str(
/*==============*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
Gets the type of a lock in a human readable string.
The string should not be free()'d or modified.
@return lock type */
const char*
lock_get_type_str(
/*==============*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
Gets the id of the table on which the lock is.
@return id of the table */
......@@ -678,21 +642,6 @@ lock_rec_get_index_name(
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
For a record lock, gets the tablespace number on which the lock is.
@return tablespace number */
ulint
lock_rec_get_space_id(
/*==================*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
For a record lock, gets the page number on which the lock is.
@return page number */
ulint
lock_rec_get_page_no(
/*=================*/
const lock_t* lock); /*!< in: lock */
/*******************************************************************//**
Check if there are any locks (table or rec) against table.
@return TRUE if locks exist */
bool
......
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2019, 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
......@@ -44,18 +44,10 @@ i_s_locks_row_t::lock_data */
i_s_trx_row_t::trx_query */
#define TRX_I_S_TRX_QUERY_MAX_LEN 1024
/** The maximum length of a string that can be stored in
i_s_trx_row_t::trx_operation_state */
#define TRX_I_S_TRX_OP_STATE_MAX_LEN 64
/** The maximum length of a string that can be stored in
i_s_trx_row_t::trx_foreign_key_error */
#define TRX_I_S_TRX_FK_ERROR_MAX_LEN 256
/** The maximum length of a string that can be stored in
i_s_trx_row_t::trx_isolation_level */
#define TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN 16
/** Safely copy strings in to the INNODB_TRX table's
string based columns */
#define TRX_I_S_STRING_COPY(data, field, constraint, tcache) \
......@@ -94,23 +86,21 @@ struct i_s_hash_chain_t {
/** This structure represents INFORMATION_SCHEMA.innodb_locks row */
struct i_s_locks_row_t {
trx_id_t lock_trx_id; /*!< transaction identifier */
const char* lock_mode; /*!< lock mode from
lock_get_mode_str() */
const char* lock_type; /*!< lock type from
lock_get_type_str() */
const char* lock_table; /*!< table name from
lock_get_table_name() */
const char* lock_index; /*!< index name from
lock_rec_get_index_name() */
/** Information for record locks. All these are
ULINT_UNDEFINED for table locks. */
/* @{ */
ulint lock_space; /*!< tablespace identifier */
ulint lock_page; /*!< page number within the_space */
ulint lock_rec; /*!< heap number of the record
on the page */
const char* lock_data; /*!< (some) content of the record */
/* @} */
/** index name of a record lock; NULL for table locks */
const char* lock_index;
/** tablespace identifier of the record; 0 if !lock_index */
uint32_t lock_space;
/** page number of the record; 0 if !lock_index */
uint32_t lock_page;
/** heap number of the record; 0 if !lock_index */
uint16_t lock_rec;
/** lock mode corresponding to lock_mode_values_typelib */
uint8_t lock_mode;
/** (some) content of the record, if available in the buffer pool;
NULL if !lock_index */
const char* lock_data;
/** The following are auxiliary and not included in the table */
/* @{ */
......@@ -154,17 +144,17 @@ struct i_s_trx_row_t {
ulint trx_concurrency_tickets;
/*!< n_tickets_to_enter_innodb in
trx_t */
const char* trx_isolation_level;
/*!< isolation_level in trx_t */
ibool trx_unique_checks;
uint trx_isolation_level;
/*!< trx_t::isolation_level */
bool trx_unique_checks;
/*!< check_unique_secondary in trx_t*/
ibool trx_foreign_key_checks;
bool trx_foreign_key_checks;
/*!< check_foreigns in trx_t */
const char* trx_foreign_key_error;
/*!< detailed_error in trx_t */
ulint trx_is_read_only;
bool trx_is_read_only;
/*!< trx_t::read_only */
ulint trx_is_autocommit_non_locking;
bool trx_is_autocommit_non_locking;
/*!< trx_is_autocommit_non_locking(trx)
*/
};
......
......@@ -871,7 +871,7 @@ struct trx_t {
const char* op_info; /*!< English text describing the
current operation, or an empty
string */
ulint isolation_level;/*!< TRX_ISO_REPEATABLE_READ, ... */
uint isolation_level;/*!< TRX_ISO_REPEATABLE_READ, ... */
bool check_foreigns; /*!< normally TRUE, but if the user
wants to suppress foreign key checks,
(in table imports, for example) we
......
......@@ -6006,71 +6006,6 @@ lock_get_trx_id(
return(trx_get_id_for_print(lock->trx));
}
/*******************************************************************//**
Gets the mode of a lock in a human readable string.
The string should not be free()'d or modified.
@return lock mode */
const char*
lock_get_mode_str(
/*==============*/
const lock_t* lock) /*!< in: lock */
{
ibool is_gap_lock;
is_gap_lock = lock_get_type_low(lock) == LOCK_REC
&& lock_rec_get_gap(lock);
switch (lock_get_mode(lock)) {
case LOCK_S:
if (is_gap_lock) {
return("S,GAP");
} else {
return("S");
}
case LOCK_X:
if (is_gap_lock) {
return("X,GAP");
} else {
return("X");
}
case LOCK_IS:
if (is_gap_lock) {
return("IS,GAP");
} else {
return("IS");
}
case LOCK_IX:
if (is_gap_lock) {
return("IX,GAP");
} else {
return("IX");
}
case LOCK_AUTO_INC:
return("AUTO_INC");
default:
return("UNKNOWN");
}
}
/*******************************************************************//**
Gets the type of a lock in a human readable string.
The string should not be free()'d or modified.
@return lock type */
const char*
lock_get_type_str(
/*==============*/
const lock_t* lock) /*!< in: lock */
{
switch (lock_get_type_low(lock)) {
case LOCK_REC:
return("RECORD");
case LOCK_TABLE:
return("TABLE");
default:
return("UNKNOWN");
}
}
/*******************************************************************//**
Gets the table on which the lock is.
@return table */
......@@ -6147,32 +6082,6 @@ lock_rec_get_index_name(
return(lock->index->name);
}
/*******************************************************************//**
For a record lock, gets the tablespace number on which the lock is.
@return tablespace number */
ulint
lock_rec_get_space_id(
/*==================*/
const lock_t* lock) /*!< in: lock */
{
ut_a(lock_get_type_low(lock) == LOCK_REC);
return(lock->un_member.rec_lock.space);
}
/*******************************************************************//**
For a record lock, gets the page number on which the lock is.
@return page number */
ulint
lock_rec_get_page_no(
/*=================*/
const lock_t* lock) /*!< in: lock */
{
ut_a(lock_get_type_low(lock) == LOCK_REC);
return(lock->un_member.rec_lock.page_no);
}
/*********************************************************************//**
Cancels a waiting lock request and releases possible other transactions
waiting behind it. */
......
......@@ -1308,13 +1308,15 @@ sync_arr_fill_sys_semphore_waits_table(
WaitMutex* mutex;
type = cell->request_type;
/* JAN: FIXME
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_THREAD_ID],
(longlong)os_thread_pf(cell->thread)));
OK(fields[SYS_SEMAPHORE_WAITS_THREAD_ID]->store(,
(longlong)os_thread_pf(cell->thread), true));
*/
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_FILE], innobase_basename(cell->file)));
OK(fields[SYS_SEMAPHORE_WAITS_LINE]->store(cell->line, true));
fields[SYS_SEMAPHORE_WAITS_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (ulint)difftime(time(NULL), cell->reservation_time)));
OK(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME]->store(
difftime(time(NULL),
cell->reservation_time)));
if (type == SYNC_MUTEX) {
mutex = static_cast<WaitMutex*>(cell->latch.mutex);
......@@ -1322,21 +1324,21 @@ sync_arr_fill_sys_semphore_waits_table(
if (mutex) {
// JAN: FIXME
// OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_OBJECT_NAME], mutex->cmutex_name));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT], (longlong)mutex));
OK(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT]->store((longlong)mutex, true));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_WAIT_TYPE], "MUTEX"));
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)mutex->thread_id));
//OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID]->store(mutex->thread_id, true));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(mutex->file_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(mutex->line, true));
//fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_CREATED_FILE], innobase_basename(mutex->cfile_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->store(mutex->cline, true));
//fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->set_notnull();
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)mutex->waiters));
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)mutex->lock_word));
//OK(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG]->store(mutex->waiters, true));
//OK(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD]->store(mutex->lock_word, true));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(mutex->file_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(mutex->line, true));
//fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], mutex->count_os_wait));
//OK(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT]->store(mutex->count_os_wait, true));
}
} else if (type == RW_LOCK_X_WAIT
|| type == RW_LOCK_X
......@@ -1349,7 +1351,7 @@ sync_arr_fill_sys_semphore_waits_table(
if (rwlock) {
ulint writer = rw_lock_get_writer(rwlock);
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT], (longlong)rwlock));
OK(fields[SYS_SEMAPHORE_WAITS_WAIT_OBJECT]->store((longlong)rwlock, true));
if (type == RW_LOCK_X) {
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_WAIT_TYPE], "RW_LOCK_X"));
} else if (type == RW_LOCK_X_WAIT) {
......@@ -1363,7 +1365,7 @@ sync_arr_fill_sys_semphore_waits_table(
if (writer != RW_LOCK_NOT_LOCKED) {
// JAN: FIXME
// OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_OBJECT_NAME], rwlock->lock_name));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WRITER_THREAD], (longlong)os_thread_pf(rwlock->writer_thread)));
OK(fields[SYS_SEMAPHORE_WAITS_WRITER_THREAD]->store(os_thread_pf(rwlock->writer_thread), true));
if (writer == RW_LOCK_X) {
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_RESERVATION_MODE], "RW_LOCK_X"));
......@@ -1373,19 +1375,21 @@ sync_arr_fill_sys_semphore_waits_table(
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_RESERVATION_MODE], "RW_LOCK_SX"));
}
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)rwlock->thread_id));
//OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID]->store(rwlock->thread_id, true));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(rwlock->file_name)));
//OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(rwlock->line, true));
//fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_READERS], rw_lock_get_reader_count(rwlock)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG],
rwlock->waiters.load(std::memory_order_relaxed)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD],
rwlock->lock_word.load(std::memory_order_relaxed)));
OK(fields[SYS_SEMAPHORE_WAITS_READERS]->store(rw_lock_get_reader_count(rwlock), true));
OK(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG]->store(
rwlock->waiters.load(std::memory_order_relaxed),
true));
OK(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD]->store(
rwlock->lock_word.load(std::memory_order_relaxed),
true));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name)));
OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true));
fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], rwlock->count_os_wait));
OK(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT]->store(rwlock->count_os_wait, true));
}
}
}
......
......@@ -179,31 +179,13 @@ INFORMATION SCHEMA tables is fetched and later retrieved by the C++
code in handler/i_s.cc. */
trx_i_s_cache_t* trx_i_s_cache = &trx_i_s_cache_static;
/*******************************************************************//**
For a record lock that is in waiting state retrieves the only bit that
is set, for a table lock returns ULINT_UNDEFINED.
@return record number within the heap */
static
ulint
wait_lock_get_heap_no(
/*==================*/
const lock_t* lock) /*!< in: lock */
/** @return the heap number of a record lock
@retval 0 for table locks */
static uint16_t wait_lock_get_heap_no(const lock_t* lock)
{
ulint ret;
switch (lock_get_type(lock)) {
case LOCK_REC:
ret = lock_rec_find_set_bit(lock);
ut_a(ret != ULINT_UNDEFINED);
break;
case LOCK_TABLE:
ret = ULINT_UNDEFINED;
break;
default:
ut_error;
}
return(ret);
return lock_get_type(lock) == LOCK_REC
? static_cast<uint16_t>(lock_rec_find_set_bit(lock))
: 0;
}
/*******************************************************************//**
......@@ -405,25 +387,20 @@ i_s_locks_row_validate(
/*===================*/
const i_s_locks_row_t* row) /*!< in: row to validate */
{
ut_ad(row->lock_mode != NULL);
ut_ad(row->lock_type != NULL);
ut_ad(row->lock_mode);
ut_ad(row->lock_table != NULL);
ut_ad(row->lock_table_id != 0);
if (row->lock_space == ULINT_UNDEFINED) {
if (!row->lock_index) {
/* table lock */
ut_ad(!strcmp("TABLE", row->lock_type));
ut_ad(row->lock_index == NULL);
ut_ad(row->lock_data == NULL);
ut_ad(row->lock_page == ULINT_UNDEFINED);
ut_ad(row->lock_rec == ULINT_UNDEFINED);
ut_ad(!row->lock_data);
ut_ad(!row->lock_space);
ut_ad(!row->lock_page);
ut_ad(!row->lock_rec);
} else {
/* record lock */
ut_ad(!strcmp("RECORD", row->lock_type));
ut_ad(row->lock_index != NULL);
/* row->lock_data == NULL if buf_page_try_get() == NULL */
ut_ad(row->lock_page != ULINT_UNDEFINED);
ut_ad(row->lock_rec != ULINT_UNDEFINED);
ut_ad(row->lock_page);
}
return(TRUE);
......@@ -507,21 +484,7 @@ fill_trx_row(
}
thd_done:
s = trx->op_info;
if (s != NULL && s[0] != '\0') {
TRX_I_S_STRING_COPY(s, row->trx_operation_state,
TRX_I_S_TRX_OP_STATE_MAX_LEN, cache);
if (row->trx_operation_state == NULL) {
return(FALSE);
}
} else {
row->trx_operation_state = NULL;
}
row->trx_operation_state = trx->op_info;
row->trx_tables_in_use = trx->n_mysql_tables_in_use;
......@@ -541,23 +504,7 @@ fill_trx_row(
row->trx_concurrency_tickets = trx->n_tickets_to_enter_innodb;
switch (trx->isolation_level) {
case TRX_ISO_READ_UNCOMMITTED:
row->trx_isolation_level = "READ UNCOMMITTED";
break;
case TRX_ISO_READ_COMMITTED:
row->trx_isolation_level = "READ COMMITTED";
break;
case TRX_ISO_REPEATABLE_READ:
row->trx_isolation_level = "REPEATABLE READ";
break;
case TRX_ISO_SERIALIZABLE:
row->trx_isolation_level = "SERIALIZABLE";
break;
/* Should not happen as TRX_ISO_READ_COMMITTED is default */
default:
row->trx_isolation_level = "UNKNOWN";
}
row->trx_isolation_level = trx->isolation_level;
row->trx_unique_checks = (ibool) trx->check_unique_secondary;
......@@ -689,8 +636,8 @@ fill_lock_data(
mtr_start(&mtr);
block = buf_page_try_get(page_id_t(lock_rec_get_space_id(lock),
lock_rec_get_page_no(lock)),
block = buf_page_try_get(page_id_t(lock->un_member.rec_lock.space,
lock->un_member.rec_lock.page_no),
&mtr);
if (block == NULL) {
......@@ -754,22 +701,42 @@ fill_lock_data(
/*******************************************************************//**
Fills i_s_locks_row_t object. Returns its first argument.
If memory can not be allocated then FALSE is returned.
@return FALSE if allocation fails */
static
ibool
fill_locks_row(
/*===========*/
@return false if allocation fails */
static bool fill_locks_row(
i_s_locks_row_t* row, /*!< out: result object that's filled */
const lock_t* lock, /*!< in: lock to get data from */
ulint heap_no,/*!< in: lock's record number
or ULINT_UNDEFINED if the lock
uint16_t heap_no,/*!< in: lock's record number
or 0 if the lock
is a table lock */
trx_i_s_cache_t* cache) /*!< in/out: cache into which to copy
volatile strings */
{
row->lock_trx_id = lock_get_trx_id(lock);
row->lock_mode = lock_get_mode_str(lock);
row->lock_type = lock_get_type_str(lock);
row->lock_trx_id = lock->trx->id;
const auto lock_type = lock_get_type(lock);
ut_ad(lock_type == LOCK_REC || lock_type == LOCK_TABLE);
const bool is_gap_lock = lock_type == LOCK_REC
&& (lock->type_mode & LOCK_GAP);
switch (lock->type_mode & LOCK_MODE_MASK) {
case LOCK_S:
row->lock_mode = 1 + is_gap_lock;
break;
case LOCK_X:
row->lock_mode = 3 + is_gap_lock;
break;
case LOCK_IS:
row->lock_mode = 5 + is_gap_lock;
break;
case LOCK_IX:
row->lock_mode = 7 + is_gap_lock;
break;
case LOCK_AUTO_INC:
row->lock_mode = 9;
break;
default:
ut_ad(!"unknown lock mode");
row->lock_mode = 0;
}
row->lock_table = ha_storage_put_str_memlim(
cache->storage, lock_get_table_name(lock).m_name,
......@@ -778,11 +745,10 @@ fill_locks_row(
/* memory could not be allocated */
if (row->lock_table == NULL) {
return(FALSE);
return false;
}
switch (lock_get_type(lock)) {
case LOCK_REC:
if (lock_type == LOCK_REC) {
row->lock_index = ha_storage_put_str_memlim(
cache->storage, lock_rec_get_index_name(lock),
MAX_ALLOWED_FOR_STORAGE(cache));
......@@ -790,32 +756,26 @@ fill_locks_row(
/* memory could not be allocated */
if (row->lock_index == NULL) {
return(FALSE);
return false;
}
row->lock_space = lock_rec_get_space_id(lock);
row->lock_page = lock_rec_get_page_no(lock);
row->lock_space = lock->un_member.rec_lock.space;
row->lock_page = lock->un_member.rec_lock.page_no;
row->lock_rec = heap_no;
if (!fill_lock_data(&row->lock_data, lock, heap_no, cache)) {
/* memory could not be allocated */
return(FALSE);
return false;
}
break;
case LOCK_TABLE:
} else {
row->lock_index = NULL;
row->lock_space = ULINT_UNDEFINED;
row->lock_page = ULINT_UNDEFINED;
row->lock_rec = ULINT_UNDEFINED;
row->lock_space = 0;
row->lock_page = 0;
row->lock_rec = 0;
row->lock_data = NULL;
break;
default:
ut_error;
}
row->lock_table_id = lock_get_table_id(lock);
......@@ -823,7 +783,7 @@ fill_locks_row(
row->hash_chain.value = row;
ut_ad(i_s_locks_row_validate(row));
return(TRUE);
return true;
}
/*******************************************************************//**
......@@ -877,11 +837,11 @@ fold_lock(
case LOCK_REC:
ut_a(heap_no != ULINT_UNDEFINED);
ret = ut_fold_ulint_pair((ulint) lock_get_trx_id(lock),
lock_rec_get_space_id(lock));
ret = ut_fold_ulint_pair((ulint) lock->trx->id,
lock->un_member.rec_lock.space);
ret = ut_fold_ulint_pair(ret,
lock_rec_get_page_no(lock));
lock->un_member.rec_lock.page_no);
ret = ut_fold_ulint_pair(ret, heap_no);
......@@ -924,9 +884,9 @@ locks_row_eq_lock(
case LOCK_REC:
ut_a(heap_no != ULINT_UNDEFINED);
return(row->lock_trx_id == lock_get_trx_id(lock)
&& row->lock_space == lock_rec_get_space_id(lock)
&& row->lock_page == lock_rec_get_page_no(lock)
return(row->lock_trx_id == lock->trx->id
&& row->lock_space == lock->un_member.rec_lock.space
&& row->lock_page == lock->un_member.rec_lock.page_no
&& row->lock_rec == heap_no);
case LOCK_TABLE:
......@@ -935,7 +895,7 @@ locks_row_eq_lock(
it fails. */
ut_a(heap_no == ULINT_UNDEFINED);
return(row->lock_trx_id == lock_get_trx_id(lock)
return(row->lock_trx_id == lock->trx->id
&& row->lock_table_id == lock_get_table_id(lock));
default:
......@@ -956,7 +916,7 @@ search_innodb_locks(
/*================*/
trx_i_s_cache_t* cache, /*!< in: cache */
const lock_t* lock, /*!< in: lock to search for */
ulint heap_no)/*!< in: lock's record number
uint16_t heap_no)/*!< in: lock's record number
or ULINT_UNDEFINED if the lock
is a table lock */
{
......@@ -999,8 +959,8 @@ add_lock_to_cache(
/*==============*/
trx_i_s_cache_t* cache, /*!< in/out: cache */
const lock_t* lock, /*!< in: the element to add */
ulint heap_no)/*!< in: lock's record number
or ULINT_UNDEFINED if the lock
uint16_t heap_no)/*!< in: lock's record number
or 0 if the lock
is a table lock */
{
i_s_locks_row_t* dst_row;
......@@ -1114,13 +1074,12 @@ add_trx_relevant_locks_to_cache(
if (trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
const lock_t* curr_lock;
ulint wait_lock_heap_no;
i_s_locks_row_t* blocking_lock_row;
lock_queue_iterator_t iter;
ut_a(trx->lock.wait_lock != NULL);
wait_lock_heap_no
uint16_t wait_lock_heap_no
= wait_lock_get_heap_no(trx->lock.wait_lock);
/* add the requested lock */
......@@ -1539,11 +1498,11 @@ trx_i_s_create_lock_id(
/* please adjust TRX_I_S_LOCK_ID_MAX_LEN if you change this */
if (row->lock_space != ULINT_UNDEFINED) {
if (row->lock_index) {
/* record lock */
res_len = snprintf(lock_id, lock_id_size,
TRX_ID_FMT
":" ULINTPF ":" ULINTPF ":" ULINTPF,
":%u:%u:%u",
row->lock_trx_id, row->lock_space,
row->lock_page, row->lock_rec);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment