Commit 3b229393 authored by Marko Mäkelä's avatar Marko Mäkelä

Add the I_S.GLOBAL_STATUS counter innodb_instant_alter_column

parent 08e4d3fe
...@@ -18,6 +18,10 @@ SET time_zone='+03:00'; ...@@ -18,6 +18,10 @@ SET time_zone='+03:00';
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
SET @old_instant=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column');
let $format= 3; let $format= 3;
while ($format) { while ($format) {
let $engine= `SELECT CONCAT('ENGINE=InnoDB ROW_FORMAT=',CASE $format let $engine= `SELECT CONCAT('ENGINE=InnoDB ROW_FORMAT=',CASE $format
...@@ -33,7 +37,6 @@ eval CREATE TABLE t1 ...@@ -33,7 +37,6 @@ eval CREATE TABLE t1
INSERT INTO t1 (id, c2) values(1,1); INSERT INTO t1 (id, c2) values(1,1);
SELECT * FROM t1; SELECT * FROM t1;
SET GLOBAL innodb_monitor_enable = module_ddl;
--enable_info --enable_info
ALTER TABLE t1 ADD COLUMN ( ALTER TABLE t1 ADD COLUMN (
d1 INT, d2 INT UNSIGNED DEFAULT 10, d3 VARCHAR(20) NOT NULL DEFAULT 'abcde', d1 INT, d2 INT UNSIGNED DEFAULT 10, d3 VARCHAR(20) NOT NULL DEFAULT 'abcde',
...@@ -252,9 +255,7 @@ DROP TABLE t1,t2,t3,big; ...@@ -252,9 +255,7 @@ DROP TABLE t1,t2,t3,big;
dec $format; dec $format;
} }
disconnect analyze; disconnect analyze;
SET GLOBAL innodb_monitor_disable = module_ddl; SELECT variable_value-@old_instant instants
--disable_warnings FROM information_schema.global_status
SET GLOBAL innodb_monitor_enable = default; WHERE variable_name = 'innodb_instant_alter_column';
SET GLOBAL innodb_monitor_disable = default;
--enable_warnings
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
...@@ -1100,6 +1100,9 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -1100,6 +1100,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"defragment_count", {"defragment_count",
(char*) &export_vars.innodb_defragment_count, SHOW_LONG}, (char*) &export_vars.innodb_defragment_count, SHOW_LONG},
{"instant_alter_column",
(char*) &export_vars.innodb_instant_alter_column, SHOW_LONG},
/* Online alter table status variables */ /* Online alter table status variables */
{"onlineddl_rowlog_rows", {"onlineddl_rowlog_rows",
(char*) &export_vars.innodb_onlineddl_rowlog_rows, SHOW_LONG}, (char*) &export_vars.innodb_onlineddl_rowlog_rows, SHOW_LONG},
......
...@@ -50,6 +50,7 @@ Smart ALTER TABLE ...@@ -50,6 +50,7 @@ Smart ALTER TABLE
#include "trx0roll.h" #include "trx0roll.h"
#include "handler0alter.h" #include "handler0alter.h"
#include "srv0mon.h" #include "srv0mon.h"
#include "srv0srv.h"
#include "fts0priv.h" #include "fts0priv.h"
#include "fts0plugin.h" #include "fts0plugin.h"
#include "pars0pars.h" #include "pars0pars.h"
...@@ -304,6 +305,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx ...@@ -304,6 +305,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
} }
new_table = old_table; new_table = old_table;
export_vars.innodb_instant_alter_column++;
} }
/** @return whether this is instant ALTER TABLE */ /** @return whether this is instant ALTER TABLE */
......
...@@ -1007,6 +1007,9 @@ struct export_var_t{ ...@@ -1007,6 +1007,9 @@ struct export_var_t{
ulint innodb_defragment_count; /*!< Number of defragment ulint innodb_defragment_count; /*!< Number of defragment
operations*/ operations*/
/** Number of instant ALTER TABLE operations that affect columns */
ulong innodb_instant_alter_column;
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
of used row log buffer */ of used row log buffer */
......
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