Commit 323d4582 authored by Andrew McDonnell's avatar Andrew McDonnell

Ensure we have an up to date count of edges of backing table

parent 2560ce00
......@@ -17,7 +17,7 @@ linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
ERROR HY000: Can't create table 'test.graph' (errno: 140 "Wrong create options")
ERROR HY000: Can't create table `test`.`graph` (errno: 140 "Wrong create options")
SET GLOBAL oqgraph_allow_create_integer_latch=true;
The next warning 1287 is expected
CREATE TABLE graph (
......@@ -44,7 +44,7 @@ linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
ERROR HY000: Can't create table 'test.graph_again' (errno: 140 "Wrong create options")
ERROR HY000: Can't create table `test`.`graph_again` (errno: 140 "Wrong create options")
# Populating base table
INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
......
......@@ -1050,6 +1050,7 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
int ha_oqgraph::rnd_init(bool scan)
{
edges->file->info(HA_STATUS_VARIABLE); // Fix for bug 1195735 - ensure we operate with up to date count!
edges->prepare_for_position();
return error_code(graph->random(scan));
}
......@@ -1057,7 +1058,15 @@ int ha_oqgraph::rnd_init(bool scan)
int ha_oqgraph::rnd_next(byte *buf)
{
int res;
open_query::row row;
open_query::row row = {};
// Problem: bug 1195735 - mysqld hang if we delete * from the underlying table, we get an infinite loop through here
// fetch_row() --> fetch_row() --> num_edges() --> _table->file->stats->records
// _table is actually a handle on the backing table we just deleted everything from. so the statistics are out of date.
// so we really need to force a refresh on the backing store statistics, when starting a new query
// So we probably need to fix this bug in rnd_init
// Note, close() never called in between; this would otherwise clean things up
if (!(res= graph->fetch_row(row))) // FIXME - this called after DELETE FROM graph_base; hangs...
res= fill_record(buf, row);
table->status= res ? STATUS_NOT_FOUND: 0;
......
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