diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index b53d44c9889..5e5595aeef8 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -182,6 +182,8 @@ static my_bool innobase_adaptive_hash_index = TRUE; static char* internal_innobase_data_file_path = NULL; +static char* innodb_version_str = (char*) INNODB_VERSION_STR; + /* The following counter is used to convey information to InnoDB about server activity: in selects it is not sensible to call srv_active_wake_master_thread after each fetch or search, we only do @@ -9077,6 +9079,10 @@ static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode, AUTOINC_OLD_STYLE_LOCKING, /* Minimum value */ AUTOINC_NO_LOCKING, 0); /* Maximum value */ +static MYSQL_SYSVAR_STR(version, innodb_version_str, + PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, + "InnoDB version", NULL, NULL, INNODB_VERSION_STR); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), @@ -9120,6 +9126,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(thread_concurrency), MYSQL_SYSVAR(thread_sleep_delay), MYSQL_SYSVAR(autoinc_lock_mode), + MYSQL_SYSVAR(version), NULL }; @@ -9255,7 +9262,7 @@ mysql_declare_plugin(innobase) PLUGIN_LICENSE_GPL, innobase_init, /* Plugin Init */ NULL, /* Plugin Deinit */ - 0x0100 /* 1.0 */, + INNODB_VERSION_SHORT, innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ NULL /* reserved */ diff --git a/handler/i_s.cc b/handler/i_s.cc index 65503e622ff..081abce8198 100644 --- a/handler/i_s.cc +++ b/handler/i_s.cc @@ -423,7 +423,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), @@ -698,7 +698,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), @@ -881,7 +881,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), @@ -1213,7 +1213,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), @@ -1263,7 +1263,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), @@ -1479,7 +1479,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), @@ -1529,7 +1529,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = /* plugin version (for SHOW PLUGINS) */ /* unsigned int */ - STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(version, INNODB_VERSION_SHORT), /* struct st_mysql_show_var* */ STRUCT_FLD(status_vars, NULL), diff --git a/include/univ.i b/include/univ.i index b1c273096e5..86327a518b9 100644 --- a/include/univ.i +++ b/include/univ.i @@ -9,6 +9,28 @@ Created 1/20/1994 Heikki Tuuri #ifndef univ_i #define univ_i +#define INNODB_VERSION_MAJOR 1 +#define INNODB_VERSION_MINOR 0 +#define INNODB_VERSION_BUGFIX 1 + +/* The following is the InnoDB version as shown in +SELECT plugin_version FROM information_schema.plugins; +calculated in in make_version_string() in sql/sql_show.cc like this: +"version >> 8" . "version & 0xff" +because the version is shown with only one dot, we skip the last +component, i.e. we show M.N.P as M.N */ +#define INNODB_VERSION_SHORT \ + (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) + +/* auxiliary macros to help creating the version as string */ +#define __INNODB_VERSION(a, b, c) (#a "." #b "." #c) +#define _INNODB_VERSION(a, b, c) __INNODB_VERSION(a, b, c) + +#define INNODB_VERSION_STR \ + _INNODB_VERSION(INNODB_VERSION_MAJOR, \ + INNODB_VERSION_MINOR, \ + INNODB_VERSION_BUGFIX) + #ifdef MYSQL_DYNAMIC_PLUGIN /* In the dynamic plugin, redefine some externally visible symbols in order not to conflict with the symbols of a builtin InnoDB. */ diff --git a/srv/srv0start.c b/srv/srv0start.c index 0f3709c8ace..a464432d52c 100644 --- a/srv/srv0start.c +++ b/srv/srv0start.c @@ -1662,8 +1662,9 @@ innobase_start_or_create_for_mysql(void) if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Started; log sequence number %llu\n", - srv_start_lsn); + " InnoDB Plugin %s started; " + "log sequence number %llu\n", + INNODB_VERSION_STR, srv_start_lsn); } if (srv_force_recovery > 0) {