diff options
author | Mithun C Y <mithun.c.y@oracle.com> | 2015-02-25 11:44:19 +0530 |
---|---|---|
committer | Mithun C Y <mithun.c.y@oracle.com> | 2015-02-25 11:44:19 +0530 |
commit | 2e3c2cd3625598d6de940b51675dd6a979676ed9 (patch) | |
tree | 5352b7e97fc2c84261c0ca33f643b516f99e43a9 /storage | |
parent | cd81a719430d493bdffc8c2132fdad4c351c0f02 (diff) | |
download | mariadb-git-2e3c2cd3625598d6de940b51675dd6a979676ed9.tar.gz |
Bug #20049521: CRASH IN MERGE_BUFFERS FILESORT.C WHEN INNODB WITH ORDER BY.
ISSUE:
------
There can be up to MERGEBUFF2 number of sorted merge chunks,
We need enough buffer space for at least one record from
each merge chunks. If estimates are wrong(very low) and we
allocate buffer space for less than MERGEBUFF2, then we will
have issue in merge_buffers, if actual number of rows to be
sorted is bigger than estimate and external filesort is
chosen.
SOLUTION:
---------
Set number of rows to sort to be at least MERGEBUFF2.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 676a20fa372..6ec7586779a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. @@ -7906,6 +7906,13 @@ ha_innobase::estimate_rows_upper_bound(void) estimate = 2 * local_data_file_length / dict_index_calc_min_rec_len(index); + /* Set num_rows less than MERGEBUFF to simulate the case where we do + not have enough space to merge the externally sorted file blocks. */ + DBUG_EXECUTE_IF("set_num_rows_lt_MERGEBUFF", + estimate = 2; + DBUG_SET("-d,set_num_rows_lt_MERGEBUFF"); + ); + prebuilt->trx->op_info = (char*)""; DBUG_RETURN((ha_rows) estimate); |