summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/ha_ndbcluster.cc25
-rw-r--r--sql/ha_ndbcluster.h4
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item_sum.cc10
-rw-r--r--sql/opt_sum.cc7
-rw-r--r--sql/sql_select.cc9
-rw-r--r--sql/sql_union.cc7
-rw-r--r--storage/archive/ha_archive.cc4
-rw-r--r--storage/archive/ha_archive.h2
-rw-r--r--storage/blackhole/ha_blackhole.cc4
-rw-r--r--storage/blackhole/ha_blackhole.h2
-rw-r--r--storage/csv/ha_tina.cc4
-rw-r--r--storage/csv/ha_tina.h2
-rw-r--r--storage/example/ha_example.cc4
-rw-r--r--storage/example/ha_example.h2
-rw-r--r--storage/federated/ha_federated.cc6
-rw-r--r--storage/federated/ha_federated.h2
-rw-r--r--storage/heap/ha_heap.cc3
-rw-r--r--storage/heap/ha_heap.h2
-rw-r--r--storage/innobase/handler/ha_innodb.cc6
-rw-r--r--storage/innobase/handler/ha_innodb.h2
-rw-r--r--storage/myisam/ha_myisam.cc4
-rw-r--r--storage/myisam/ha_myisam.h2
-rw-r--r--storage/myisammrg/ha_myisammrg.cc3
-rw-r--r--storage/myisammrg/ha_myisammrg.h2
-rw-r--r--storage/ndb/include/ndb_version.h.in1
26 files changed, 79 insertions, 42 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 636486a8b3f..630bc184c84 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -469,11 +469,13 @@ ha_rows ha_ndbcluster::records()
DBUG_RETURN(retval + info->no_uncommitted_rows_count);
}
-void ha_ndbcluster::records_update()
+int ha_ndbcluster::records_update()
{
if (m_ha_not_exact_count)
- return;
+ return 0;
DBUG_ENTER("ha_ndbcluster::records_update");
+ int result= 0;
+
struct Ndb_local_table_statistics *info= m_table_info;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
@@ -483,7 +485,7 @@ void ha_ndbcluster::records_update()
Ndb *ndb= get_ndb();
struct Ndb_statistics stat;
ndb->setDatabaseName(m_dbname);
- if (ndb_get_table_statistics(ndb, m_table, &stat) == 0)
+ if ((result= ndb_get_table_statistics(ndb, m_table, &stat)) == 0)
{
stats.mean_rec_length= stat.row_size;
stats.data_file_length= stat.fragment_memory;
@@ -496,7 +498,7 @@ void ha_ndbcluster::records_update()
info->no_uncommitted_rows_count= 0;
}
stats.records= info->records+ info->no_uncommitted_rows_count;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(result);
}
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
@@ -3635,8 +3637,9 @@ void ha_ndbcluster::position(const byte *record)
}
-void ha_ndbcluster::info(uint flag)
+int ha_ndbcluster::info(uint flag)
{
+ int result= 0;
DBUG_ENTER("info");
DBUG_PRINT("enter", ("flag: %d", flag));
@@ -3654,18 +3657,18 @@ void ha_ndbcluster::info(uint flag)
if (m_ha_not_exact_count)
stats.records= 100;
else
- records_update();
+ result= records_update();
}
else
{
if ((my_errno= check_ndb_connection()))
- DBUG_VOID_RETURN;
+ DBUG_RETURN(my_errno);
Ndb *ndb= get_ndb();
ndb->setDatabaseName(m_dbname);
struct Ndb_statistics stat;
ndb->setDatabaseName(m_dbname);
if (current_thd->variables.ndb_use_exact_count &&
- ndb_get_table_statistics(ndb, m_table, &stat) == 0)
+ (result= ndb_get_table_statistics(ndb, m_table, &stat)) == 0)
{
stats.mean_rec_length= stat.row_size;
stats.data_file_length= stat.fragment_memory;
@@ -3709,7 +3712,11 @@ void ha_ndbcluster::info(uint flag)
stats.auto_increment_value= (ulonglong)auto_increment_value64;
}
}
- DBUG_VOID_RETURN;
+
+ if(result == -1)
+ result= HA_ERR_NO_CONNECTION;
+
+ DBUG_RETURN(result);
}
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 19ff513f9b1..cffc7dcdd47 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -673,7 +673,7 @@ class ha_ndbcluster: public handler
bool get_error_message(int error, String *buf);
ha_rows records();
- void info(uint);
+ int info(uint);
void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
@@ -878,7 +878,7 @@ private:
int check_ndb_connection(THD* thd= current_thd);
void set_rec_per_key();
- void records_update();
+ int records_update();
void no_uncommitted_rows_execute_failure();
void no_uncommitted_rows_update(int);
void no_uncommitted_rows_reset(THD *);
diff --git a/sql/handler.h b/sql/handler.h
index 5e26d9c7b63..0cfd6da23d7 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1243,7 +1243,7 @@ public:
key_range *max_key)
{ return (ha_rows) 10; }
virtual void position(const byte *record)=0;
- virtual void info(uint)=0; // see my_base.h for full description
+ virtual int info(uint)=0; // see my_base.h for full description
virtual void get_dynamic_partition_info(PARTITION_INFO *stat_info,
uint part_id);
virtual int extra(enum ha_extra_function operation)
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 73e2c5e6935..c656faa7c49 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2693,6 +2693,7 @@ bool Item_sum_count_distinct::add()
longlong Item_sum_count_distinct::val_int()
{
+ int error;
DBUG_ASSERT(fixed == 1);
if (!table) // Empty query
return LL(0);
@@ -2706,7 +2707,14 @@ longlong Item_sum_count_distinct::val_int()
tree->walk(count_distinct_walk, (void*) &count);
return (longlong) count;
}
- table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+
+ error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+
+ if(error)
+ {
+ table->file->print_error(error, MYF(0));
+ }
+
return table->file->stats.records;
}
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 7d6305594fd..cb8b53ac6a7 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -167,7 +167,12 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
else
{
- tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+ error= tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+ if(error)
+ {
+ tl->table->file->print_error(error, MYF(0));
+ return error;
+ }
count*= tl->table->file->stats.records;
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ed91719fd46..cb83002a0fe 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -676,6 +676,8 @@ JOIN::optimize()
{
if (res > 1)
{
+ thd->fatal_error();
+ error= res;
DBUG_PRINT("error",("Error from opt_sum_query"));
DBUG_RETURN(1);
}
@@ -2119,7 +2121,12 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
s->needed_reg.init();
table_vector[i]=s->table=table=tables->table;
table->pos_in_table_list= tables;
- table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);// record count
+ error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+ if(error)
+ {
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(1);
+ }
table->quick_keys.clear_all();
table->reginfo.join_tab=s;
table->reginfo.not_exists_optimize=0;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 3e6a3944093..cfaf21fa957 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -496,7 +496,12 @@ bool st_select_lex_unit::exec()
DBUG_RETURN(res);
}
/* Needed for the following test and for records_at_start in next loop */
- table->file->info(HA_STATUS_VARIABLE);
+ int error= table->file->info(HA_STATUS_VARIABLE);
+ if(error)
+ {
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(1);
+ }
if (found_rows_for_union && !sl->braces &&
select_limit_cnt != HA_POS_ERROR)
{
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index b7673fc96ea..b2b07981bdb 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1433,7 +1433,7 @@ void ha_archive::update_create_info(HA_CREATE_INFO *create_info)
/*
Hints for optimizer, see ha_tina for more information
*/
-void ha_archive::info(uint flag)
+int ha_archive::info(uint flag)
{
DBUG_ENTER("ha_archive::info");
/*
@@ -1461,7 +1461,7 @@ void ha_archive::info(uint flag)
if (flag & HA_STATUS_AUTO)
stats.auto_increment_value= share->auto_increment_value;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 1a601c8451a..75ca29e640a 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -121,7 +121,7 @@ public:
int read_data_header(azio_stream *file_to_read);
int write_data_header(azio_stream *file_to_write);
void position(const byte *record);
- void info(uint);
+ int info(uint);
void update_create_info(HA_CREATE_INFO *create_info);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 2515f059e02..64e716584a7 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -120,14 +120,14 @@ void ha_blackhole::position(const byte *record)
}
-void ha_blackhole::info(uint flag)
+int ha_blackhole::info(uint flag)
{
DBUG_ENTER("ha_blackhole::info");
bzero((char*) &stats, sizeof(stats));
if (flag & HA_STATUS_AUTO)
stats.auto_increment_value= 1;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
int ha_blackhole::external_lock(THD *thd, int lock_type)
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index 54cec41fd26..667c18a594b 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -75,7 +75,7 @@ public:
int index_first(byte * buf);
int index_last(byte * buf);
void position(const byte *record);
- void info(uint flag);
+ int info(uint flag);
int external_lock(THD *thd, int lock_type);
uint lock_count(void) const;
int create(const char *name, TABLE *table_arg,
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index dad28a74af6..26eed928964 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1128,13 +1128,13 @@ int ha_tina::rnd_pos(byte * buf, byte *pos)
Currently this table handler doesn't implement most of the fields
really needed. SHOW also makes use of this data
*/
-void ha_tina::info(uint flag)
+int ha_tina::info(uint flag)
{
DBUG_ENTER("ha_tina::info");
/* This is a lie, but you don't want the optimizer to see zero or 1 */
if (!records_is_known && stats.records < 2)
stats.records= 2;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
/*
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index f408e8f4a7d..def88e8c471 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -189,7 +189,7 @@ public:
/* This is required for SQL layer to know that we support autorepair */
bool auto_repair() const { return 1; }
void position(const byte *record);
- void info(uint);
+ int info(uint);
int extra(enum ha_extra_function operation);
int delete_all_rows(void);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 212def8c18e..6d199d4391f 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -530,10 +530,10 @@ int ha_example::rnd_pos(byte * buf, byte *pos)
sql_update.cc
*/
-void ha_example::info(uint flag)
+int ha_example::info(uint flag)
{
DBUG_ENTER("ha_example::info");
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index 2f5dbc29c56..f98377ee157 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -136,7 +136,7 @@ public:
int rnd_next(byte *buf); //required
int rnd_pos(byte * buf, byte *pos); //required
void position(const byte *record); //required
- void info(uint); //required
+ int info(uint); //required
int extra(enum ha_extra_function operation);
int reset(void);
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 00b2ac87cd4..51c9f4c192e 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -2490,7 +2490,7 @@ int ha_federated::rnd_pos(byte *buf, byte *pos)
*/
-void ha_federated::info(uint flag)
+int ha_federated::info(uint flag)
{
char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
char status_buf[FEDERATED_QUERY_BUFFER_SIZE];
@@ -2571,7 +2571,7 @@ void ha_federated::info(uint flag)
if (result)
mysql_free_result(result);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
error:
if (result)
@@ -2580,7 +2580,7 @@ error:
my_sprintf(error_buffer, (error_buffer, ": %d : %s",
mysql_errno(mysql), mysql_error(mysql)));
my_error(error_code, MYF(0), error_buffer);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error_code);
}
diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h
index ade1e5b181e..d1b485d63e2 100644
--- a/storage/federated/ha_federated.h
+++ b/storage/federated/ha_federated.h
@@ -206,7 +206,7 @@ public:
int rnd_next(byte *buf); //required
int rnd_pos(byte *buf, byte *pos); //required
void position(const byte *record); //required
- void info(uint); //required
+ int info(uint); //required
void update_auto_increment(void);
int repair(THD* thd, HA_CHECK_OPT* check_opt);
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 8e8744c2d34..dc49e8978c0 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -342,7 +342,7 @@ void ha_heap::position(const byte *record)
*(HEAP_PTR*) ref= heap_position(file); // Ref is aligned
}
-void ha_heap::info(uint flag)
+int ha_heap::info(uint flag)
{
HEAPINFO info;
(void) heap_info(file,&info,flag);
@@ -364,6 +364,7 @@ void ha_heap::info(uint flag)
*/
if (key_stat_version != file->s->key_stat_version)
update_key_stats();
+ return 0;
}
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index 0f6386655cb..f0c01d5e3a5 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -89,7 +89,7 @@ public:
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
- void info(uint);
+ int info(uint);
int extra(enum ha_extra_function operation);
int reset();
int external_lock(THD *thd, int lock_type);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 066c0ce48d4..3434cf6b8ba 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -5485,7 +5485,7 @@ ha_innobase::read_time(
Returns statistics information of the table to the MySQL interpreter,
in various fields of the handle object. */
-void
+int
ha_innobase::info(
/*==============*/
uint flag) /* in: what information MySQL requests */
@@ -5508,7 +5508,7 @@ ha_innobase::info(
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
- DBUG_VOID_RETURN;
+ DBUG_RETURN(HA_ERR_CRASHED);
}
/* We do not know if MySQL can call this function before calling
@@ -5700,7 +5700,7 @@ ha_innobase::info(
prebuilt->trx->op_info = (char*)"";
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
/**************************************************************************
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index d6c9b8a0d9f..ea1cf7a32af 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -143,7 +143,7 @@ class ha_innobase: public handler
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
- void info(uint);
+ int info(uint);
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int optimize(THD* thd,HA_CHECK_OPT* check_opt);
int discard_or_import_tablespace(my_bool discard);
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 03065b43dd5..e4da7652860 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1325,7 +1325,7 @@ void ha_myisam::position(const byte* record)
my_store_ptr(ref, ref_length, position);
}
-void ha_myisam::info(uint flag)
+int ha_myisam::info(uint flag)
{
MI_ISAMINFO info;
char name_buff[FN_REFLEN];
@@ -1386,6 +1386,8 @@ void ha_myisam::info(uint flag)
stats.update_time = info.update_time;
if (flag & HA_STATUS_AUTO)
stats.auto_increment_value= info.auto_increment;
+
+ return 0;
}
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 85abcdca8b2..7ad938c06a7 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -99,7 +99,7 @@ class ha_myisam: public handler
int rnd_pos(byte * buf, byte *pos);
int restart_rnd_next(byte *buf, byte *pos);
void position(const byte *record);
- void info(uint);
+ int info(uint);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
int reset(void);
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 5c8a05f0dde..57ef1dad6f7 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -262,7 +262,7 @@ ha_rows ha_myisammrg::records_in_range(uint inx, key_range *min_key,
}
-void ha_myisammrg::info(uint flag)
+int ha_myisammrg::info(uint flag)
{
MYMERGE_INFO info;
(void) myrg_status(file,&info,flag);
@@ -329,6 +329,7 @@ void ha_myisammrg::info(uint flag)
min(file->keys, table->s->key_parts));
}
}
+ return 0;
}
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index faa3ae73c59..ae3cb0aea42 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -72,7 +72,7 @@ class ha_myisammrg: public handler
int rnd_pos(byte * buf, byte *pos);
void position(const byte *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
- void info(uint);
+ int info(uint);
int reset(void);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
diff --git a/storage/ndb/include/ndb_version.h.in b/storage/ndb/include/ndb_version.h.in
index 6a1b1f5292c..9eb609e3830 100644
--- a/storage/ndb/include/ndb_version.h.in
+++ b/storage/ndb/include/ndb_version.h.in
@@ -71,5 +71,6 @@ char ndb_version_string_buf[NDB_VERSION_STRING_BUF_SZ];
#define NDBD_UPDATE_FRAG_DIST_KEY_51 MAKE_VERSION(5,1,12)
#define NDBD_QMGR_SINGLEUSER_VERSION_5 MAKE_VERSION(5,0,25)
+
#endif