mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
ndb - imlp. show engine ndb status;
that dump free list allocation per connection
This commit is contained in:
@ -5096,4 +5096,50 @@ int ha_ndbcluster::write_ndb_file()
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
int
|
||||
ndbcluster_show_status(THD* thd)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
||||
DBUG_ENTER("ndbcluster_show_status");
|
||||
|
||||
if (have_ndbcluster != SHOW_OPTION_YES)
|
||||
{
|
||||
my_message(ER_NOT_SUPPORTED_YET,
|
||||
"Cannot call SHOW NDBCLUSTER STATUS because skip-ndbcluster is defined",
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
List<Item> field_list;
|
||||
field_list.push_back(new Item_empty_string("free_list", 255));
|
||||
field_list.push_back(new Item_return_int("created", 10,MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("free", 10,MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("sizeof", 10,MYSQL_TYPE_LONG));
|
||||
|
||||
if (protocol->send_fields(&field_list, 1))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (thd->transaction.thd_ndb &&
|
||||
((Thd_ndb*)thd->transaction.thd_ndb)->ndb)
|
||||
{
|
||||
Ndb* ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb;
|
||||
Ndb::Free_list_usage tmp; tmp.m_name= 0;
|
||||
while (ndb->get_free_list_usage(&tmp))
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
|
||||
protocol->store(tmp.m_name, &my_charset_bin);
|
||||
protocol->store((uint)tmp.m_created);
|
||||
protocol->store((uint)tmp.m_free);
|
||||
protocol->store((uint)tmp.m_sizeof);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
send_eof(thd);
|
||||
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
#endif /* HAVE_NDBCLUSTER_DB */
|
||||
|
@ -279,3 +279,5 @@ int ndbcluster_table_exists_in_engine(THD* thd,
|
||||
int ndbcluster_drop_database(const char* path);
|
||||
|
||||
void ndbcluster_print_error(int error, const NdbOperation *error_op);
|
||||
|
||||
int ndbcluster_show_status(THD*);
|
||||
|
@ -5492,6 +5492,7 @@ struct show_var_st status_vars[]= {
|
||||
{"Com_show_fields", (char*) (com_stat+(uint) SQLCOM_SHOW_FIELDS),SHOW_LONG},
|
||||
{"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG},
|
||||
{"Com_show_innodb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_INNODB_STATUS),SHOW_LONG},
|
||||
{"Com_show_ndb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_NDBCLUSTER_STATUS),SHOW_LONG},
|
||||
{"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG},
|
||||
{"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG},
|
||||
{"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG},
|
||||
|
@ -49,7 +49,7 @@ enum enum_sql_command {
|
||||
|
||||
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
|
||||
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
|
||||
SQLCOM_SHOW_INNODB_STATUS,
|
||||
SQLCOM_SHOW_INNODB_STATUS,SQLCOM_SHOW_NDBCLUSTER_STATUS,
|
||||
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
|
||||
SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
|
||||
SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB,
|
||||
|
@ -25,6 +25,10 @@
|
||||
#include "ha_innodb.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#include "ha_ndbcluster.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
/*
|
||||
Without SSL the handshake consists of one packet. This packet
|
||||
@ -2386,6 +2390,13 @@ mysql_execute_command(THD *thd)
|
||||
res = load_master_data(thd);
|
||||
break;
|
||||
#endif /* HAVE_REPLICATION */
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
case SQLCOM_SHOW_NDBCLUSTER_STATUS:
|
||||
{
|
||||
res = ndbcluster_show_status(thd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
case SQLCOM_SHOW_INNODB_STATUS:
|
||||
{
|
||||
|
@ -4533,6 +4533,9 @@ show_engine_param:
|
||||
STATUS_SYM
|
||||
{
|
||||
switch (Lex->create_info.db_type) {
|
||||
case DB_TYPE_NDBCLUSTER:
|
||||
Lex->sql_command = SQLCOM_SHOW_NDBCLUSTER_STATUS;
|
||||
break;
|
||||
case DB_TYPE_INNODB:
|
||||
Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user