~stewart/drizzle/bug720552

  • Committer: Stewart Smith
  • Date: 2011-02-17 07:04:17 UTC
  • Revision ID: stewart@flamingspork.com-20110217070417-svtla9ddt289epgc
in optimization for MIN() on indexed field, the result of Cursor::startIndexScan was not checked before calling other index functions on the Cursor. 

The optimizer has the ability to replace certain MIN() queries with a constant.

e.g.
CREATE TABLE t1 (a int, index(a));
.... insert data ...
SELECT MIN(a) FROM t1;

Will execute a lookup on the first record of the index and replace that part of the query tree with a constant.

In the code in sum.cc which executes this optimization, although the return code from startIndexScan was being saved, the variable was immediately overwritten by a subsequent call to (e.g.) index_first. This meant that if a StorageEngine did not save the error code and return it on subsequent index calls, we could (at best) crash.

At some point in the past, the InnoDB devs figured this out, and on error in getting the index, set things appropriately so that anywhere we subsequently get a row_search_for_mysql() call, we'll get back an error code again. I have not audited all index code paths to ensure this is the case everywhere. If one of the index code paths didn't call row_search_for_mysql() or do appropriate checks, we'd probably crash. The scenarios where this would be possible would possibly be around a ongoing transaction accessing a newly created/deleted table or a table protobuf message not matching the table in innodb.

MyISAM and ARCHIVE just sets a local variable and does nothing in doStartIndexScan that could possibly fail.

It looks as though this could cause a crash in PBXT and HailDB.

A way to test this is with storage_engine_api_tester injecting an error into the codepath.
Filename Latest Rev Last Changed Committer Comment Size
..
client 1 15 years ago brian clean slate Diff
config 1 15 years ago brian clean slate Diff
docs 1712.1.1 13 years ago Monty Taylor Merged libdrizzle directly into tree. Diff
drizzled 214 15 years ago Brian Aker Rename of fields (fix issue with string and decima Diff
examples 1712.1.1 13 years ago Monty Taylor Merged libdrizzle directly into tree. Diff
extra 1022.2.34 15 years ago Monty Taylor Merged Monty from lp:~mordred/drizzle/kill-malloc Diff
libdrizzle 1712.1.1 13 years ago Monty Taylor Merged libdrizzle directly into tree. Diff
m4 202.3.14 15 years ago Monty Taylor Moved m4 macros to top-level m4 dir, per GNU stand Diff
plugin 1 15 years ago brian clean slate Diff
po 202.3.1 15 years ago Monty Taylor Added very initial gettextize stuff. Diff
support-files 1 15 years ago brian clean slate Diff
tests 77.1.47 15 years ago Monty Taylor Moved test to tests... Diff
unittests 1377.8.1 14 years ago pawel primitive integration of the testing framework wit Diff
win32 1712.1.1 13 years ago Monty Taylor Merged libdrizzle directly into tree. Diff
.bzrignore 2165.1.5 13 years ago Monty Taylor And one more file. 6.7 KB Diff Download File
.quickly 2023.3.31 13 years ago Monty Taylor Updated pandora-build files to version 0.171 111 bytes Diff Download File
AUTHORS 1866.2.1 13 years ago Monty Taylor Updated AUTHORS list with everyone from bzr logs. 1.2 KB Diff Download File
configure.ac 2165.1.3 13 years ago Monty Taylor Merged in pkg-config fixes. 6.3 KB Diff Download File
COPYING 1999.6.1 13 years ago kalebral at gmail update Copyright strings to a more common format t 17.5 KB Diff Download File
COPYING.Boost 1815.1.1 13 years ago Monty Taylor Embed a modified version of parse_config_file. The 1.3 KB Diff Download File
COPYING.BSD 1799.2.2 13 years ago Monty Taylor Added BSD copying file. 1.3 KB Diff Download File
DRIZZLE.FAQ 665.1.4 15 years ago Eric Herman Added pointer to online version of the FAQ 5.8 KB Diff Download File
EXCEPTIONS-CLIENT 1 15 years ago brian clean slate 5 KB Diff Download File
Makefile.am 2165.1.5 13 years ago Monty Taylor And one more file. 4.9 KB Diff Download File
NEWS 194 15 years ago Brian Aker Documentation cleanup 41 bytes Diff Download File
README 2155.2.1 13 years ago Stewart Smith add some things to the README from the website. gi 1.5 KB Diff Download File