Skip to content

Commit 2971626

Browse files
committed
Bug#16731538 MYSQLD CRITICAL FAILURE DURING ORDERED SELECT FROM NDBINFO.CLUSTER_OPERATIONS
- The filesort() function asks the handler implementation how many rows are expected with estimate_rows_upper_bound(). The default implementation of that function(in handler.h) is to return "stats.records+EXTRA_RECORDS" where EXTRA_RECORDS is defined as 10. Unless the handler implementation has filled in stats.records it will be 0 and thus 10 will be used for calculating size of sort buffer etc. - Implement ha_ndbinfo::estimate_rows_upper_bound() to return "many" rows
1 parent db10eef commit 2971626

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

mysql-test/suite/ndb/r/ndbinfo.result

+2
Original file line numberDiff line numberDiff line change
@@ -1336,3 +1336,5 @@ create temporary table old_count
13361336
group by counter_name;
13371337
drop table old_count;
13381338
set @@optimizer_switch=default;
1339+
1340+
select * from ndbinfo.config_params order by param_number;

mysql-test/suite/ndb/t/ndbinfo.test

+8
Original file line numberDiff line numberDiff line change
@@ -719,4 +719,12 @@ create temporary table old_count
719719
drop table old_count;
720720
set @@optimizer_switch=default;
721721

722+
#
723+
# Bug#16731538 MYSQLD CRITICAL FAILURE DURING ORDERED SELECT FROM NDBINFO.CLUSTER_OPERATIONS
724+
# - ha_ndbinfo::estimate_rows_upper_bound() returned 0 rows
725+
#
726+
--disable_result_log
727+
select * from ndbinfo.config_params order by param_number;
728+
--enable_result_log
729+
722730
--source ndbinfo_drop.inc

sql/ha_ndbinfo.h

+8
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ class ha_ndbinfo: public handler
7171
return HA_CACHE_TBL_NOCACHE;
7272
}
7373

74+
virtual ha_rows estimate_rows_upper_bound() {
75+
// Estimate "many" rows to be returned so that filesort
76+
// allocates buffers properly.
77+
// Default impl. for this function is otherwise 10 rows
78+
// in case handler hasn't filled in stats.records
79+
return HA_POS_ERROR;
80+
}
81+
7482
private:
7583
void unpack_record(uchar *dst_row);
7684

0 commit comments

Comments
 (0)