summaryrefslogtreecommitdiff
path: root/storage/oqgraph/ha_oqgraph.cc
diff options
context:
space:
mode:
authorAndrew McDonnell <bugs@andrewmcdonnell.net>2013-09-10 22:44:45 +0930
committerAndrew McDonnell <bugs@andrewmcdonnell.net>2013-09-10 22:44:45 +0930
commitc43058d0e71a60ef046eec557d4017ddc6c00d7a (patch)
treedaf25456fd2737d3c783a1604156a6527cf1d3e8 /storage/oqgraph/ha_oqgraph.cc
parent174fc2a8f31d9fcf5df762c7acf16432e466384f (diff)
downloadmariadb-git-c43058d0e71a60ef046eec557d4017ddc6c00d7a.tar.gz
Fix for order by crash, release dangling cursor when unlocking table.
Diffstat (limited to 'storage/oqgraph/ha_oqgraph.cc')
-rw-r--r--storage/oqgraph/ha_oqgraph.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 537d5b49205..49e0df0fc86 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -795,7 +795,8 @@ int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
- graph->row_ref((void*) ref); // reset before we have a cursor, so the memory is inited, avoiding the sefgault in position() when select with order by (bug #1133093)
+ // reset before we have a cursor, so the memory is not junk, avoiding the sefgault in position() when select with order by (bug #1133093)
+ graph->init_row_ref(ref);
return index_read_idx(buf, active_index, key, key_len, find_flag);
}
@@ -1107,6 +1108,15 @@ int ha_oqgraph::delete_all_rows()
int ha_oqgraph::external_lock(THD *thd, int lock_type)
{
+ // This method is also called to _unlock_ (lock_type == F_UNLCK)
+ // Which means we need to release things before we let the underlying backing table lock go...
+ if (lock_type == F_UNLCK) {
+ // If we have an index open on the backing table, we need to close it out here
+ // this means destroying any open cursor first.
+ // Then we can let the unlock go through to the backing table
+ graph->release_cursor();
+ }
+
return edges->file->ha_external_lock(thd, lock_type);
}