summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorstewart@willster.(none) <>2006-09-28 23:41:37 +1000
committerstewart@willster.(none) <>2006-09-28 23:41:37 +1000
commit57a97f53bc13488d702ee3478aba83ffa4de5f7a (patch)
treeeb9ad699c3a5035d182101ae8e8082d97593b767 /sql
parent3ecc09e0e4671431d7caeab1760faccf0636fe41 (diff)
downloadmariadb-git-57a97f53bc13488d702ee3478aba83ffa4de5f7a.tar.gz
BUG#19914 SELECT COUNT(*) sometimes returns MAX_INT on cluster tables
post-review fixes as indicated by Serg. manual testing of error cases done in 5.0 due to support for DBUG_EXECUTE_IF to insert errors. Unable to write test case for mysql-test until 5.1 due to support for setting debug options at runtime.
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_blackhole.cc4
-rw-r--r--sql/ha_blackhole.h2
-rw-r--r--sql/ha_isam.cc3
-rw-r--r--sql/ha_isam.h2
-rw-r--r--sql/ha_isammrg.cc3
-rw-r--r--sql/ha_isammrg.h2
-rw-r--r--sql/item_sum.cc10
-rw-r--r--sql/sql_delete.cc7
-rw-r--r--sql/sql_select.cc7
-rw-r--r--sql/sql_union.cc7
10 files changed, 36 insertions, 11 deletions
diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc
index 9ac4ba2da15..8c76b860e50 100644
--- a/sql/ha_blackhole.cc
+++ b/sql/ha_blackhole.cc
@@ -100,7 +100,7 @@ void ha_blackhole::position(const byte *record)
}
-void ha_blackhole::info(uint flag)
+int ha_blackhole::info(uint flag)
{
DBUG_ENTER("ha_blackhole::info");
@@ -114,7 +114,7 @@ void ha_blackhole::info(uint flag)
delete_length= 0;
if (flag & HA_STATUS_AUTO)
auto_increment_value= 1;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(0);
}
int ha_blackhole::external_lock(THD *thd, int lock_type)
diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h
index 88715c62408..177b59fa970 100644
--- a/sql/ha_blackhole.h
+++ b/sql/ha_blackhole.h
@@ -78,7 +78,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/sql/ha_isam.cc b/sql/ha_isam.cc
index afa7dffa5f4..34d5440a0f8 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -178,7 +178,7 @@ void ha_isam::position(const byte *record)
ha_store_ptr(ref, ref_length, position);
}
-void ha_isam::info(uint flag)
+int ha_isam::info(uint flag)
{
N_ISAMINFO info;
(void) nisam_info(file,&info,flag);
@@ -224,6 +224,7 @@ void ha_isam::info(uint flag)
}
if (flag & HA_STATUS_TIME)
update_time = info.update_time;
+ return 0;
}
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index 1f9b8eb28fe..b94377c8e3d 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -67,7 +67,7 @@ class ha_isam: public handler
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 external_lock(THD *thd, int lock_type);
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
diff --git a/sql/ha_isammrg.cc b/sql/ha_isammrg.cc
index c0e6f665f08..8a03e09bcec 100644
--- a/sql/ha_isammrg.cc
+++ b/sql/ha_isammrg.cc
@@ -149,7 +149,7 @@ void ha_isammrg::position(const byte *record)
}
-void ha_isammrg::info(uint flag)
+int ha_isammrg::info(uint flag)
{
MERGE_INFO info;
(void) mrg_info(file,&info,flag);
@@ -163,6 +163,7 @@ void ha_isammrg::info(uint flag)
block_size=0;
update_time=0;
ref_length=4; // Should be big enough
+ return 0;
}
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index 82a2e312ca3..a0fcee8f5a6 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -58,7 +58,7 @@ class ha_isammrg: public handler
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 external_lock(THD *thd, int lock_type);
uint lock_count(void) const;
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 0b9b10d05d4..1cd5f81afcd 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1410,12 +1410,20 @@ 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);
if (use_tree)
return tree->elements_in_tree;
- 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->records;
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index b085d37be78..017e9596b14 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -43,7 +43,12 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if ((open_and_lock_tables(thd, table_list)))
DBUG_RETURN(-1);
table= table_list->table;
- 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));
+ DBUG_RETURN(error);
+ }
thd->proc_info="init";
table->map=1;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 36959ee1d0f..d36a6252adc 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1786,7 +1786,12 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
s->checked_keys.init();
s->needed_reg.init();
table_vector[i]=s->table=table=tables->table;
- 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 0948602bbb4..f3f814831f5 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -492,7 +492,12 @@ int 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)
{