Commit a55f4a5d authored by sergefp@mysql.com's avatar sergefp@mysql.com

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/psergey/mysql-5.0-fix-vg1
parents 5d9b87ea 1b8e1674
...@@ -676,3 +676,6 @@ variable_name ...@@ -676,3 +676,6 @@ variable_name
character_set_database character_set_database
collation_database collation_database
skip_show_database skip_show_database
show global status like "Threads_running";
Variable_name Value
Threads_running 1
...@@ -354,3 +354,8 @@ show open tables where `table` like "user"; ...@@ -354,3 +354,8 @@ show open tables where `table` like "user";
show status variable_name where variable_name like "%database%"; show status variable_name where variable_name like "%database%";
# test for 'show variables ... where' # test for 'show variables ... where'
show variables variable_name where variable_name like "%database%"; show variables variable_name where variable_name like "%database%";
#
# Bug #7981:SHOW GLOBAL STATUS crashes server
#
show global status like "Threads_running";
...@@ -1512,4 +1512,3 @@ MgmApiSession::check_connection(Parser_t::Context &ctx, ...@@ -1512,4 +1512,3 @@ MgmApiSession::check_connection(Parser_t::Context &ctx,
template class MutexVector<int>; template class MutexVector<int>;
template class Vector<ParserRow<MgmApiSession> const*>; template class Vector<ParserRow<MgmApiSession> const*>;
template class Vector<unsigned short>;
...@@ -1112,6 +1112,47 @@ ha_ndbcluster::set_index_key(NdbOperation *op, ...@@ -1112,6 +1112,47 @@ ha_ndbcluster::set_index_key(NdbOperation *op,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
inline
int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
{
uint i;
THD *thd= current_thd;
DBUG_ENTER("define_read_attrs");
// Define attributes to read
for (i= 0; i < table->s->fields; i++)
{
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
((field->flags & PRI_KEY_FLAG)) ||
m_retrieve_all_fields)
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(op->getNdbError());
}
else
{
m_value[i].ptr= NULL;
}
}
if (table->s->primary_key == MAX_KEY)
{
DBUG_PRINT("info", ("Getting hidden key"));
// Scanning table with no primary key
int hidden_no= table->s->fields;
#ifndef DBUG_OFF
const NDBTAB *tab= (const NDBTAB *) m_table;
if (!tab->getColumn(hidden_no))
DBUG_RETURN(1);
#endif
if (get_ndb_value(op, NULL, hidden_no, NULL))
ERR_RETURN(op->getNdbError());
}
DBUG_RETURN(0);
}
/* /*
Read one record from NDB using primary key Read one record from NDB using primary key
*/ */
...@@ -1585,47 +1626,6 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, ...@@ -1585,47 +1626,6 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
inline
int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
{
uint i;
THD *thd= current_thd;
DBUG_ENTER("define_read_attrs");
// Define attributes to read
for (i= 0; i < table->s->fields; i++)
{
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
((field->flags & PRI_KEY_FLAG)) ||
m_retrieve_all_fields)
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(op->getNdbError());
}
else
{
m_value[i].ptr= NULL;
}
}
if (table->s->primary_key == MAX_KEY)
{
DBUG_PRINT("info", ("Getting hidden key"));
// Scanning table with no primary key
int hidden_no= table->s->fields;
#ifndef DBUG_OFF
const NDBTAB *tab= (const NDBTAB *) m_table;
if (!tab->getColumn(hidden_no))
DBUG_RETURN(1);
#endif
if (get_ndb_value(op, NULL, hidden_no, NULL))
ERR_RETURN(op->getNdbError());
}
DBUG_RETURN(0);
}
/* /*
Start ordered index scan in NDB Start ordered index scan in NDB
*/ */
...@@ -2487,13 +2487,13 @@ int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len) ...@@ -2487,13 +2487,13 @@ int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len)
inline inline
int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key,
const key_range *end_key, const key_range *end_key,
bool eq_range, bool sorted, bool eq_r, bool sorted,
byte* buf) byte* buf)
{ {
KEY* key_info; KEY* key_info;
int error= 1; int error= 1;
DBUG_ENTER("ha_ndbcluster::read_range_first_to_buf"); DBUG_ENTER("ha_ndbcluster::read_range_first_to_buf");
DBUG_PRINT("info", ("eq_range: %d, sorted: %d", eq_range, sorted)); DBUG_PRINT("info", ("eq_r: %d, sorted: %d", eq_r, sorted));
switch (get_index_type(active_index)){ switch (get_index_type(active_index)){
case PRIMARY_KEY_ORDERED_INDEX: case PRIMARY_KEY_ORDERED_INDEX:
...@@ -2534,14 +2534,14 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, ...@@ -2534,14 +2534,14 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key,
int ha_ndbcluster::read_range_first(const key_range *start_key, int ha_ndbcluster::read_range_first(const key_range *start_key,
const key_range *end_key, const key_range *end_key,
bool eq_range, bool sorted) bool eq_r, bool sorted)
{ {
byte* buf= table->record[0]; byte* buf= table->record[0];
DBUG_ENTER("ha_ndbcluster::read_range_first"); DBUG_ENTER("ha_ndbcluster::read_range_first");
DBUG_RETURN(read_range_first_to_buf(start_key, DBUG_RETURN(read_range_first_to_buf(start_key,
end_key, end_key,
eq_range, eq_r,
sorted, sorted,
buf)); buf));
} }
......
...@@ -1534,25 +1534,6 @@ static bool show_status_array(THD *thd, const char *wild, ...@@ -1534,25 +1534,6 @@ static bool show_status_array(THD *thd, const char *wild,
} }
bool mysqld_show(THD *thd, const char *wild, show_var_st *variables,
enum enum_var_type value_type,
pthread_mutex_t *mutex,
struct system_status_var *status_var, TABLE *table)
{
DBUG_ENTER("mysqld_show");
ha_update_statistics(); /* Export engines statistics */
pthread_mutex_lock(mutex);
if (show_status_array(thd, wild, variables, value_type, status_var, "", table))
goto err;
pthread_mutex_unlock(mutex);
DBUG_RETURN(FALSE);
err:
pthread_mutex_unlock(mutex);
DBUG_RETURN(TRUE);
}
/* collect status for all running threads */ /* collect status for all running threads */
void calc_sum_of_all_status(STATUS_VAR *to) void calc_sum_of_all_status(STATUS_VAR *to)
...@@ -2874,10 +2855,13 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2874,10 +2855,13 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond) int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
DBUG_ENTER("fill_variables"); DBUG_ENTER("fill_variables");
int res= 0;
LEX *lex= thd->lex; LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS; const char *wild= lex->wild ? lex->wild->ptr() : NullS;
int res= mysqld_show(thd, wild, init_vars, lex->option_type, pthread_mutex_lock(&LOCK_global_system_variables);
&LOCK_global_system_variables, 0, tables->table); res= show_status_array(thd, wild, init_vars,
lex->option_type, 0, "", tables->table);
pthread_mutex_unlock(&LOCK_global_system_variables);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
...@@ -2889,17 +2873,14 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2889,17 +2873,14 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
const char *wild= lex->wild ? lex->wild->ptr() : NullS; const char *wild= lex->wild ? lex->wild->ptr() : NullS;
int res= 0; int res= 0;
STATUS_VAR tmp; STATUS_VAR tmp;
ha_update_statistics(); /* Export engines statistics */
pthread_mutex_lock(&LOCK_status);
if (lex->option_type == OPT_GLOBAL) if (lex->option_type == OPT_GLOBAL)
{
pthread_mutex_lock(&LOCK_status);
calc_sum_of_all_status(&tmp); calc_sum_of_all_status(&tmp);
} res= show_status_array(thd, wild, status_vars, OPT_GLOBAL,
res= mysqld_show(thd, wild, status_vars, OPT_GLOBAL, &LOCK_status, (lex->option_type == OPT_GLOBAL ?
(lex->option_type == OPT_GLOBAL ? &tmp: &thd->status_var), "",tables->table);
&tmp: &thd->status_var), tables->table); pthread_mutex_unlock(&LOCK_status);
if (lex->option_type == OPT_GLOBAL)
pthread_mutex_unlock(&LOCK_status);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
......
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