MDEV-34223 Innodb - add status variable for number of bulk inserts

- Added a counter innodb_num_bulk_insert_operation in
INFORMATION_SCHEMA.GLOBAL_STATUS. This counter is incremented
whenever a InnoDB undergoes bulk insert operation.

- Change the innodb_instant_alter_column to atomic variable.
parent f2302a62
...@@ -124,3 +124,4 @@ INNODB_ENCRYPTION_N_ROWLOG_BLOCKS_DECRYPTED ...@@ -124,3 +124,4 @@ INNODB_ENCRYPTION_N_ROWLOG_BLOCKS_DECRYPTED
INNODB_ENCRYPTION_N_TEMP_BLOCKS_ENCRYPTED INNODB_ENCRYPTION_N_TEMP_BLOCKS_ENCRYPTED
INNODB_ENCRYPTION_N_TEMP_BLOCKS_DECRYPTED INNODB_ENCRYPTION_N_TEMP_BLOCKS_DECRYPTED
INNODB_ENCRYPTION_NUM_KEY_REQUESTS INNODB_ENCRYPTION_NUM_KEY_REQUESTS
INNODB_BULK_OPERATIONS
...@@ -20,9 +20,17 @@ DROP TEMPORARY TABLE t; ...@@ -20,9 +20,17 @@ DROP TEMPORARY TABLE t;
SET @save_ahi = @@global.innodb_adaptive_hash_index; SET @save_ahi = @@global.innodb_adaptive_hash_index;
SET GLOBAL innodb_adaptive_hash_index = 1; SET GLOBAL innodb_adaptive_hash_index = 1;
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
SET @old_bulk_op=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_bulk_operations');
BEGIN; BEGIN;
INSERT INTO t1 SELECT * FROM seq_1_to_65536; INSERT INTO t1 SELECT * FROM seq_1_to_65536;
ROLLBACK; ROLLBACK;
SELECT variable_value-@old_bulk_op bulk_operations
FROM information_schema.global_status
WHERE variable_name = 'innodb_bulk_operations';
bulk_operations
1
CHECK TABLE t1; CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
......
...@@ -26,9 +26,19 @@ DROP TEMPORARY TABLE t; ...@@ -26,9 +26,19 @@ DROP TEMPORARY TABLE t;
SET @save_ahi = @@global.innodb_adaptive_hash_index; SET @save_ahi = @@global.innodb_adaptive_hash_index;
SET GLOBAL innodb_adaptive_hash_index = 1; SET GLOBAL innodb_adaptive_hash_index = 1;
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
SET @old_bulk_op=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_bulk_operations');
BEGIN; BEGIN;
INSERT INTO t1 SELECT * FROM seq_1_to_65536; INSERT INTO t1 SELECT * FROM seq_1_to_65536;
ROLLBACK; ROLLBACK;
SELECT variable_value-@old_bulk_op bulk_operations
FROM information_schema.global_status
WHERE variable_name = 'innodb_bulk_operations';
CHECK TABLE t1; CHECK TABLE t1;
--echo # --echo #
--echo # MDEV-24832 Root page AHI Removal fails fails during --echo # MDEV-24832 Root page AHI Removal fails fails during
......
...@@ -1061,7 +1061,7 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -1061,7 +1061,7 @@ static SHOW_VAR innodb_status_variables[]= {
{"defragment_count", &export_vars.innodb_defragment_count, SHOW_SIZE_T}, {"defragment_count", &export_vars.innodb_defragment_count, SHOW_SIZE_T},
{"instant_alter_column", {"instant_alter_column",
&export_vars.innodb_instant_alter_column, SHOW_ULONG}, &export_vars.innodb_instant_alter_column, SHOW_SIZE_T},
/* Online alter table status variables */ /* Online alter table status variables */
{"onlineddl_rowlog_rows", {"onlineddl_rowlog_rows",
...@@ -1104,6 +1104,9 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -1104,6 +1104,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"encryption_num_key_requests", &export_vars.innodb_encryption_key_requests, {"encryption_num_key_requests", &export_vars.innodb_encryption_key_requests,
SHOW_LONGLONG}, SHOW_LONGLONG},
/* InnoDB bulk operations */
{"bulk_operations", &export_vars.innodb_bulk_operations, SHOW_SIZE_T},
{NullS, NullS, SHOW_LONG} {NullS, NullS, SHOW_LONG}
}; };
......
...@@ -7355,6 +7355,7 @@ prepare_inplace_alter_table_dict( ...@@ -7355,6 +7355,7 @@ prepare_inplace_alter_table_dict(
ut_d(dict_table_check_for_dup_indexes(user_table, ut_d(dict_table_check_for_dup_indexes(user_table,
CHECK_PARTIAL_OK)); CHECK_PARTIAL_OK));
if (ctx->need_rebuild()) { if (ctx->need_rebuild()) {
export_vars.innodb_bulk_operations++;
ctx->new_table->acquire(); ctx->new_table->acquire();
} }
......
...@@ -713,7 +713,10 @@ struct export_var_t{ ...@@ -713,7 +713,10 @@ struct export_var_t{
operations*/ operations*/
/** Number of instant ALTER TABLE operations that affect columns */ /** Number of instant ALTER TABLE operations that affect columns */
ulong innodb_instant_alter_column; Atomic_counter<ulint> innodb_instant_alter_column;
/* Number of InnoDB bulk operations */
Atomic_counter<ulint> innodb_bulk_operations;
ulint innodb_onlineddl_rowlog_rows; /*!< Online alter rows */ ulint innodb_onlineddl_rowlog_rows; /*!< Online alter rows */
ulint innodb_onlineddl_rowlog_pct_used; /*!< Online alter percentage ulint innodb_onlineddl_rowlog_pct_used; /*!< Online alter percentage
......
...@@ -2749,6 +2749,7 @@ row_ins_clust_index_entry_low( ...@@ -2749,6 +2749,7 @@ row_ins_clust_index_entry_low(
#else /* BTR_CUR_HASH_ADAPT */ #else /* BTR_CUR_HASH_ADAPT */
index->table->bulk_trx_id = trx->id; index->table->bulk_trx_id = trx->id;
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
export_vars.innodb_bulk_operations++;
} }
trx->bulk_insert = true; trx->bulk_insert = true;
......
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