Commit 4b25110c authored by unknown's avatar unknown

ndb - imlp. show engine ndb status;

  that dump free list allocation per connection


sql/ha_ndbcluster.cc:
  imlp. show engine ndb status;
    that dump free list allocation per connection
sql/ha_ndbcluster.h:
  imlp. show engine ndb status;
    that dump free list allocation per connection
sql/mysqld.cc:
  imlp. show engine ndb status;
    that dump free list allocation per connection
sql/sql_lex.h:
  imlp. show engine ndb status;
    that dump free list allocation per connection
sql/sql_parse.cc:
  imlp. show engine ndb status;
    that dump free list allocation per connection
sql/sql_yacc.yy:
  imlp. show engine ndb status;
    that dump free list allocation per connection
parent 973c9d19
......@@ -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;
......
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