summaryrefslogtreecommitdiff
path: root/storage/oqgraph
diff options
context:
space:
mode:
authorAndrew McDonnell <bugs@andrewmcdonnell.net>2013-09-13 22:42:09 +0930
committerAndrew McDonnell <bugs@andrewmcdonnell.net>2013-09-13 22:42:09 +0930
commit078cf03304eeed26ae5b04a362b10ceb5970d220 (patch)
tree488fcdfcaf592f94b008fc9e0c79553d5bb54da2 /storage/oqgraph
parent323d45826f946afb01eafb8e9851059b5ca4b48b (diff)
downloadmariadb-git-078cf03304eeed26ae5b04a362b10ceb5970d220.tar.gz
Partial for for lp bug 796647 - handle DELETED records in ha_rnd_next of backing table
Diffstat (limited to 'storage/oqgraph')
-rw-r--r--storage/oqgraph/graphcore.cc14
-rw-r--r--storage/oqgraph/ha_oqgraph.cc11
-rw-r--r--storage/oqgraph/oqgraph_thunk.cc12
3 files changed, 22 insertions, 15 deletions
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index ce785b205c3..0b6be1da6af 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -1111,8 +1111,18 @@ int edges_cursor::fetch_row(const row &row_info, row &result,
{
result= row_info;
result.orig_indicator= result.dest_indicator= result.weight_indicator= 1;
- result.orig= get(boost::vertex_index, share->g, source( *edge, share->g ) );
- result.dest= get(boost::vertex_index, share->g, target( *edge, share->g ) );
+
+ oqgraph3::vertex_id orig = get(boost::vertex_index, share->g, source( *edge, share->g ) );
+ oqgraph3::vertex_id dest = get(boost::vertex_index, share->g, target( *edge, share->g ) );
+
+ // bug 796647c - may be symptomatic of a bigger problem with representation
+ // but origid and destid can be -1 indicating no such record, NULL? but oqgraph3::vertex_id
+ // seems to resolve to VertexID (unsigned) in row
+ // in any case we should check for errors (-1) in origid... because all edges have at least one vertex by definition
+ assert( ! ((size_t)orig == (size_t)-1 && (size_t)dest == (size_t)-1)); // indicates we havent handle a HA_ERR_RECORD_DELETED somewhere
+
+ result.orig= orig;
+ result.dest= dest;
result.weight= get(boost::edge_weight, share->g, *edge);
return oqgraph::OK;
}
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 8cd15dec2e8..5251d1600eb 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -1050,7 +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->file->info(HA_STATUS_VARIABLE); // Fix for bug 1195735, hang after truncate table - ensure we operate with up to date count
edges->prepare_for_position();
return error_code(graph->random(scan));
}
@@ -1060,14 +1060,7 @@ int ha_oqgraph::rnd_next(byte *buf)
int res;
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...
+ if (!(res= graph->fetch_row(row)))
res= fill_record(buf, row);
table->status= res ? STATUS_NOT_FOUND: 0;
return error_code(res);
diff --git a/storage/oqgraph/oqgraph_thunk.cc b/storage/oqgraph/oqgraph_thunk.cc
index d8e05f04af1..8e5cf2f0de7 100644
--- a/storage/oqgraph/oqgraph_thunk.cc
+++ b/storage/oqgraph/oqgraph_thunk.cc
@@ -235,7 +235,7 @@ int oqgraph3::cursor::restore_position()
}
oqgraph3::vertex_id oqgraph3::cursor::get_origid()
-{
+{
if (_origid)
return *_origid;
@@ -509,10 +509,14 @@ int oqgraph3::cursor::seek_to(
}
else
{
- if (int rc= table.file->ha_rnd_init(true))
+ int rc;
+ if ((rc= table.file->ha_rnd_init(true)))
return clear_position(rc);
- if (int rc= table.file->ha_rnd_next(table.record[0]))
- {
+
+ // We need to skip over any deleted records we encounter. Bug 796647
+ while ( ((rc= table.file->ha_rnd_next(table.record[0]))) != 0) {
+ if (rc == HA_ERR_RECORD_DELETED)
+ continue;
table.file->ha_rnd_end();
return clear_position(rc);
}