summaryrefslogtreecommitdiff
path: root/storage/oqgraph
diff options
context:
space:
mode:
authorAndrew McDonnell <bugs@andrewmcdonnell.net>2014-10-30 22:47:48 +1030
committerAndrew McDonnell <bugs@andrewmcdonnell.net>2015-02-28 22:37:06 +1030
commite32dafe77870ae8d4da2aae2321f3e03fa1d1f98 (patch)
tree7b9863b312e2b9a4f1d36a0148e5f99777f130cc /storage/oqgraph
parentf8e0f1a823a32266572bfe12363db68ab67f08ee (diff)
downloadmariadb-git-e32dafe77870ae8d4da2aae2321f3e03fa1d1f98.tar.gz
Hopefully finally fixes MDEV-6282, MDEV-5748 and MDEV-6345
Diffstat (limited to 'storage/oqgraph')
-rw-r--r--storage/oqgraph/graphcore-types.h2
-rw-r--r--storage/oqgraph/graphcore.cc3
-rw-r--r--storage/oqgraph/graphcore.h3
-rw-r--r--storage/oqgraph/ha_oqgraph.cc10
-rw-r--r--storage/oqgraph/oqgraph_thunk.cc3
-rw-r--r--storage/oqgraph/oqgraph_thunk.h3
6 files changed, 24 insertions, 0 deletions
diff --git a/storage/oqgraph/graphcore-types.h b/storage/oqgraph/graphcore-types.h
index 3ff32d0e233..2f182341b39 100644
--- a/storage/oqgraph/graphcore-types.h
+++ b/storage/oqgraph/graphcore-types.h
@@ -34,7 +34,9 @@ namespace open_query
}
+// Forward defs from mariadb itself!
class Field;
typedef struct TABLE TABLE;
+class THD;
#endif
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index de575c9da65..73433fc8219 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -443,6 +443,9 @@ namespace open_query
return num_vertices(share->g);
}
+ THD* oqgraph::get_thd() { return share->g.get_table_thd(); }
+ void oqgraph::set_thd(THD* thd) { share->g.set_table_thd(thd); }
+
oqgraph* oqgraph::create(oqgraph_share *share) throw()
{
assert(share != NULL);
diff --git a/storage/oqgraph/graphcore.h b/storage/oqgraph/graphcore.h
index f7eff77d8b1..b1560552fcf 100644
--- a/storage/oqgraph/graphcore.h
+++ b/storage/oqgraph/graphcore.h
@@ -126,6 +126,9 @@ namespace open_query
static oqgraph* create(oqgraph_share*) throw();
static oqgraph_share *create(TABLE*,Field*,Field*,Field*) throw();
+ THD* get_thd();
+ void set_thd(THD*);
+
static void free(oqgraph*) throw();
static void free(oqgraph_share*) throw();
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 833143dd57c..7ff9e6a41d4 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -842,6 +842,11 @@ static int parse_latch_string_to_legacy_int(const String& value, int &latch)
int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
+
Field **field= table->field;
KEY *key_info= table->key_info + index;
int res;
@@ -1129,6 +1134,11 @@ int ha_oqgraph::rename_table(const char *, const char *)
ha_rows ha_oqgraph::records_in_range(uint inx, key_range *min_key,
key_range *max_key)
{
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
+
KEY *key=table->key_info+inx;
#ifdef VERBOSE_DEBUG
{
diff --git a/storage/oqgraph/oqgraph_thunk.cc b/storage/oqgraph/oqgraph_thunk.cc
index 0e7b1f2b8ed..0ffd5cca414 100644
--- a/storage/oqgraph/oqgraph_thunk.cc
+++ b/storage/oqgraph/oqgraph_thunk.cc
@@ -547,6 +547,9 @@ bool oqgraph3::cursor::operator!=(const cursor& x) const
return record_position() != x._position;
}
+::THD* oqgraph3::graph::get_table_thd() { return _table->in_use; }
+void oqgraph3::graph::set_table_thd(::THD* thd) { _table->in_use = thd; }
+
oqgraph3::graph::graph(
::TABLE* table,
::Field* source,
diff --git a/storage/oqgraph/oqgraph_thunk.h b/storage/oqgraph/oqgraph_thunk.h
index 11e2723af14..7930e2d6c69 100644
--- a/storage/oqgraph/oqgraph_thunk.h
+++ b/storage/oqgraph/oqgraph_thunk.h
@@ -146,6 +146,9 @@ namespace oqgraph3
::Field* _target;
::Field* _weight;
+ ::THD* get_table_thd();
+ void set_table_thd(::THD* thd);
+
graph(
::TABLE* table,
::Field* source,