diff options
author | Michael Widenius <monty@askmonty.org> | 2011-01-12 15:41:39 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-01-12 15:41:39 +0200 |
commit | 213321206efb1ed9b13cae8ffa2d03eababe1c2d (patch) | |
tree | 03e14946bf70f205b42da51d55adb97511f54f06 /sql | |
parent | 3e77b1dade6a93275479a93fba4272b59d366d65 (diff) | |
download | mariadb-git-213321206efb1ed9b13cae8ffa2d03eababe1c2d.tar.gz |
Fix for LP#697610 ha_index_prev(uchar*): Assertion `inited==INDEX' failed with HANDLER + InnoDB in maria-5.3
mysql-test/suite/handler/innodb.result:
Added test case
mysql-test/suite/handler/innodb.test:
Added test case
sql/handler.h:
Move setting/resetting of active_index to ha_index_init()/ha_index_end() to simplify handler functions index_init()/index_end()
Fixed that get_index() returns MAX_KEY if index is not inited (this fixed LP#697610)
storage/federated/ha_federated.cc:
Settting of active_index is not needed anymore
storage/maria/ma_pagecache.c:
Added error message if we have too little memory for Maria page cache
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/handler.h b/sql/handler.h index 52828d4f149..830af71baee 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1195,14 +1195,18 @@ public: DBUG_ENTER("ha_index_init"); DBUG_ASSERT(inited==NONE); if (!(result= index_init(idx, sorted))) - inited=INDEX; + { + inited= INDEX; + active_index= idx; + } DBUG_RETURN(result); } int ha_index_end() { DBUG_ENTER("ha_index_end"); DBUG_ASSERT(inited==INDEX); - inited=NONE; + inited= NONE; + active_index= MAX_KEY; DBUG_RETURN(index_end()); } /* This is called after index_init() if we need to do a index scan */ @@ -1371,7 +1375,12 @@ public: as there may be several calls to this routine. */ virtual void column_bitmaps_signal(); - uint get_index(void) const { return active_index; } + /* + We have to check for inited as some engines, like innodb, sets + active_index during table scan. + */ + uint get_index(void) const + { return inited == INDEX ? active_index : MAX_KEY; } virtual int close(void)=0; /** @@ -1824,8 +1833,8 @@ private: */ virtual int open(const char *name, int mode, uint test_if_locked)=0; - virtual int index_init(uint idx, bool sorted) { active_index= idx; return 0; } - virtual int index_end() { active_index= MAX_KEY; return 0; } + virtual int index_init(uint idx, bool sorted) { return 0; } + virtual int index_end() { return 0; } /** rnd_init() can be called two times without rnd_end() in between (it only makes sense if scan=1). |