Move version entry point into MODULE_INFO

The MODULE_INFO can easily hold the version information of the
module. This removes the need for a explicit version entry point.
This commit is contained in:
Markus Mäkelä
2017-01-03 11:48:55 +02:00
parent d3907882d6
commit 7df29aa1ec
49 changed files with 127 additions and 700 deletions

View File

@ -22,15 +22,14 @@
#include <maxscale/alloc.h>
#include <maxscale/debug.h>
static char *version_str = (char*)"V1.0.0";
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"Aurora monitor"
"Aurora monitor",
"V1.0.0"
};
/*lint +e14 */
@ -42,18 +41,6 @@ typedef struct aurora_monitor
bool events[MAX_MONITOR_EVENT]; /**< Enabled monitor events */
} AURORA_MONITOR;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
/*lint -e14 */
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module is first loaded.
*/

View File

@ -40,8 +40,6 @@
static void monitorMain(void *);
static char *version_str = "V2.0.0";
/** Log a warning when a bad 'wsrep_local_index' is found */
static bool warn_erange_on_local_index = true;
@ -54,7 +52,8 @@ MODULE_INFO info =
MODULE_API_MONITOR,
MODULE_GA,
MONITOR_VERSION,
"A Galera cluster monitor"
"A Galera cluster monitor",
"V2.0.0"
};
/*lint +e14 */
@ -73,21 +72,6 @@ static MONITOR_OBJECT MyObject =
diagnostics
};
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*
* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -97,7 +81,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise the MySQL Galera Monitor module %s.", version_str);
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
}
/*lint +e14 */
@ -336,7 +320,7 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
{
mysql_free_result(result);
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE 'wsrep_local_state'\". "
"Expected 2 columns. MySQL Version: %s", version_str);
"Expected 2 columns. MySQL Version: %s", server_string);
return;
}
@ -359,7 +343,7 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
mysql_free_result(result2);
MXS_ERROR("Unexpected result for \"SHOW VARIABLES LIKE "
"'wsrep_sst_method'\". Expected 2 columns."
" MySQL Version: %s", version_str);
" MySQL Version: %s", server_string);
return;
}
while ((row = mysql_fetch_row(result2)))
@ -386,7 +370,7 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
{
mysql_free_result(result);
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE 'wsrep_local_index'\". "
"Expected 2 columns. MySQL Version: %s", version_str);
"Expected 2 columns. MySQL Version: %s", server_string);
return;
}

View File

@ -31,8 +31,6 @@
static void monitorMain(void *);
static char *version_str = "V1.1.1";
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
@ -42,7 +40,8 @@ MODULE_INFO info =
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"A Multi-Master Multi Master monitor"
"A Multi-Master Multi Master monitor",
"V1.1.1"
};
/*lint +e14 */
@ -60,21 +59,6 @@ static MONITOR_OBJECT MyObject =
diagnostics
};
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*
* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -82,7 +66,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise the Multi-Master Monitor module %s.", version_str);
MXS_NOTICE("Initialise the Multi-Master Monitor module.");
}
/**
@ -304,7 +288,7 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
{
mysql_free_result(result);
MXS_ERROR("Unexpected result for 'SELECT @@server_id'. Expected 1 column."
" MySQL Version: %s", version_str);
" MySQL Version: %s", server_string);
return;
}
@ -340,7 +324,7 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
mysql_free_result(result);
MXS_ERROR("\"SHOW ALL SLAVES STATUS\" returned less than the expected"
" amount of columns. Expected 42 columns MySQL Version: %s",
version_str);
server_string);
return;
}
@ -404,7 +388,7 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
MXS_ERROR("\"SHOW SLAVE STATUS\" "
" for versions less than 5.5 does not have master_server_id, "
"replication tree cannot be resolved for server %s."
" MySQL Version: %s", database->server->unique_name, version_str);
" MySQL Version: %s", database->server->unique_name, server_string);
database->log_version_err = false;
}
}
@ -412,7 +396,7 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
{
MXS_ERROR("\"SHOW SLAVE STATUS\" "
"returned less than the expected amount of columns. "
"Expected 40 columns. MySQL Version: %s", version_str);
"Expected 40 columns. MySQL Version: %s", server_string);
}
return;
}
@ -456,7 +440,7 @@ monitorDatabase(MONITOR* mon, MONITOR_SERVERS *database)
{
mysql_free_result(result);
MXS_ERROR("Unexpected result for \"SHOW GLOBAL VARIABLES LIKE 'read_only'\". "
"Expected 2 columns. MySQL Version: %s", version_str);
"Expected 2 columns. MySQL Version: %s", server_string);
return;
}

View File

@ -72,8 +72,6 @@
static void monitorMain(void *);
static char *version_str = "V1.5.0";
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
@ -83,7 +81,8 @@ MODULE_INFO info =
MODULE_API_MONITOR,
MODULE_GA,
MONITOR_VERSION,
"A MySQL Master/Slave replication monitor"
"A MySQL Master/Slave replication monitor",
"V1.5.0"
};
/*lint +e14 */
@ -108,21 +107,6 @@ static MONITOR_OBJECT MyObject =
diagnostics
};
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*
* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -130,7 +114,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise the MySQL Monitor module %s.", version_str);
MXS_NOTICE("Initialise the MySQL Monitor module.");
}
/**
@ -479,7 +463,7 @@ static inline void monitor_mysql_db(MONITOR_SERVERS* database, MYSQL_SERVER_INFO
{
mysql_free_result(result);
MXS_ERROR("\"%s\" returned less than the expected amount of columns. "
"Expected %d columns. MySQL Version: %s", query, columns, version_str);
"Expected %d columns.", query, columns);
return;
}
@ -590,7 +574,7 @@ static MONITOR_SERVERS *build_mysql51_replication_tree(MONITOR *mon)
mysql_free_result(result);
MXS_ERROR("\"SHOW SLAVE HOSTS\" "
"returned less than the expected amount of columns. "
"Expected 4 columns. MySQL Version: %s", version_str);
"Expected 4 columns.");
return NULL;
}
@ -755,7 +739,7 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
{
mysql_free_result(result);
MXS_ERROR("Unexpected result for 'SELECT @@server_id, @@read_only'. Expected 2 columns."
" MySQL Version: %s", version_str);
" MySQL Version: %s", server_string);
return;
}

View File

@ -31,8 +31,6 @@
static void monitorMain(void *);
static char *version_str = "V2.1.0";
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
@ -42,7 +40,8 @@ MODULE_INFO info =
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"A MySQL cluster SQL node monitor"
"A MySQL cluster SQL node monitor",
"V2.1.0"
};
/*lint +e14 */
@ -58,21 +57,6 @@ static MONITOR_OBJECT MyObject =
diagnostics
};
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*
* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
@ -80,7 +64,7 @@ version()
void
ModuleInit()
{
MXS_NOTICE("Initialise the MySQL Cluster Monitor module %s.", version_str);
MXS_NOTICE("Initialise the MySQL Cluster Monitor module.");
}
/**
@ -270,7 +254,7 @@ monitorDatabase(MONITOR_SERVERS *database, char *defaultUser, char *defaultPassw
mysql_free_result(result);
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE "
"'Ndb_number_of_ready_data_nodes'\". Expected 2 columns."
" MySQL Version: %s", version_str);
" MySQL Version: %s", server_string);
return;
}
@ -293,7 +277,7 @@ monitorDatabase(MONITOR_SERVERS *database, char *defaultUser, char *defaultPassw
mysql_free_result(result);
MXS_ERROR("Unexpected result for \"SHOW STATUS LIKE 'Ndb_cluster_node_id'\". "
"Expected 2 columns."
" MySQL Version: %s", version_str);
" MySQL Version: %s", server_string);
return;
}