diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-03-13 23:09:25 +0200 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-03-13 23:09:25 +0200 |
commit | f927267680b5a369101b625efe95c857d6bb854b (patch) | |
tree | 7a299fdbc03a8e6c052fd9202fc58c0bea84280a /sql/ha_innodb.cc | |
parent | 5a667a50a8f29b86e9482ee84ec4fb1cdc78d576 (diff) | |
download | mariadb-git-f927267680b5a369101b625efe95c857d6bb854b.tar.gz |
ha_innodb.cc:
Fix bug: MySQL could erroneously return Empty set if InnoDB estimated index range size to 0 records though the range was not empty; MySQL also failed to do the next-key locking in the case of an empty index range
sql/ha_innodb.cc:
Fix bug: MySQL could erroneously return Empty set if InnoDB estimated index range size to 0 records though the range was not empty; MySQL also failed to do the next-key locking in the case of an empty index range
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 0af1fb7b50a..ea8eaf6653e 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -3486,6 +3486,16 @@ ha_innobase::records_in_range( prebuilt->trx->op_info = (char*)""; + /* The MySQL optimizer seems to believe an estimate of 0 rows is + always accurate and may return the result 'Empty set' based on that. + The accuracy is not guaranteed, and even if it were, for a locking + read we should anyway perform the search to set the next-key lock. + Add 1 to the value to make sure MySQL does not make the assumption! */ + + if (n_rows == 0) { + n_rows = 1; + } + DBUG_RETURN((ha_rows) n_rows); } |