Commit e32dafe7 authored by Andrew McDonnell's avatar Andrew McDonnell

Hopefully finally fixes MDEV-6282, MDEV-5748 and MDEV-6345

parent f8e0f1a8
......@@ -34,7 +34,9 @@ namespace open_query
}
// Forward defs from mariadb itself!
class Field;
typedef struct TABLE TABLE;
class THD;
#endif
......@@ -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);
......
......@@ -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();
......
......@@ -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
{
......
......@@ -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,
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment