Commit af6cbf05 authored by Andrew McDonnell's avatar Andrew McDonnell

Extend permutations tested in basic test, move edge cases to separate test,...

Extend permutations tested in basic test, move edge cases to separate test, and add regression test for bug 1195735
parent 1b4164c1
This diff is collapsed.
This diff is collapsed.
--disable_warnings
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph2;
--enable_warnings
CREATE TABLE graph2 (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
seq BIGINT UNSIGNED NULL,
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';
# Because the backing store graph_base doesnt exist yet, the select should fail
--error S42S02
SELECT * FROM graph2 WHERE latch='dijkstras' AND origid=1 AND destid=6;
DROP TABLE graph2;
# Create the backing store
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE=MyISAM;
CREATE TABLE graph (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
seq BIGINT UNSIGNED NULL,
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';
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);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5);
--echo # No Search/0 - result should return same rows as inserted for origid,destid,weight
--echo # FIXME - THIS CODE IS CURRENTLY BROKEN
SELECT * FROM graph WHERE latch='no_search';
SELECT * FROM graph WHERE latch='no_search' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='no_search' and origid=1;
SELECT * FROM graph WHERE latch='no_search' and destid=1;
SELECT * FROM graph WHERE latch='no_search' and origid=666;
SELECT * FROM graph WHERE latch='no_search' and origid=NULL;
SELECT * FROM graph WHERE latch='0' ;
SELECT * FROM graph WHERE latch='0' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='0' and origid=1;
SELECT * FROM graph WHERE latch='0' and destid=1;
SELECT * FROM graph WHERE latch='0' and origid=666;
SELECT * FROM graph WHERE latch='0' and origid=NULL;
--echo # Expect no result, because of autocast
SELECT * FROM graph WHERE latch=1 ;
SELECT * FROM graph WHERE latch=1 and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=1 and origid=1;
SELECT * FROM graph WHERE latch=1 and destid=1;
SELECT * FROM graph WHERE latch=1 and origid=666;
SELECT * FROM graph WHERE latch=1 and origid=NULL;
SELECT * FROM graph WHERE latch=2 ;
SELECT * FROM graph WHERE latch=2 and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=2 and origid=1;
SELECT * FROM graph WHERE latch=2 and destid=1;
SELECT * FROM graph WHERE latch=2 and origid=666;
SELECT * FROM graph WHERE latch=2 and origid=NULL;
--echo # Should this return an error? it seems we treat it as just another bogus latch
SELECT * FROM graph WHERE latch='ThisExceeds32Characters456789012';
--echo # Expect no result, because of invalid latch
SELECT * FROM graph WHERE latch='bogus';
SELECT * FROM graph WHERE latch='bogus' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='bogus' and origid=1;
SELECT * FROM graph WHERE latch='bogus' and destid=1;
SELECT * FROM graph WHERE latch='bogus' and origid=666;
SELECT * FROM graph WHERE latch='bogus' and origid=NULL;
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch='666';
SELECT * FROM graph WHERE latch='666' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='666' and origid=1;
SELECT * FROM graph WHERE latch='666' and destid=1;
SELECT * FROM graph WHERE latch='666' and origid=666;
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch='666' and origid=NULL;
SELECT * FROM graph WHERE latch='-1';
SELECT * FROM graph WHERE latch='-1' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='-1' and origid=1;
SELECT * FROM graph WHERE latch='-1' and destid=1;
SELECT * FROM graph WHERE latch='-1' and origid=666;
SELECT * FROM graph WHERE latch='-1' and origid=NULL;
--echo # Make sure we dont crash if someone passed in a UTF string
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄';
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=1;
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=1;
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=666;
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=NULL;
--echo # Expect no result, because of autocast and deprecated syntax
--echo # Allows 0 and NULL to have same effect
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch=0;
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=0 and origid=1;
SELECT * FROM graph WHERE latch=0 and destid=1;
SELECT * FROM graph WHERE latch=0 and origid=666;
#-- Note the next line couter-intuitively produces no warning
SELECT * FROM graph WHERE latch=0 and origid=NULL;
--echo # Expect no result, because of NULL latch
SELECT * FROM graph WHERE latch=NULL;
SELECT * FROM graph WHERE latch=NULL and destid=2 and origid=1;
SELECT * FROM graph WHERE latch=NULL and origid=1;
SELECT * FROM graph WHERE latch=NULL and destid=1;
SELECT * FROM graph WHERE latch=NULL and origid=666;
SELECT * FROM graph WHERE latch=NULL and origid=NULL;
--echo # With no latch, original data in origid and destid columns
#-- Note, weight==1 in this case
SELECT * FROM graph;
SELECT * FROM graph WHERE destid=2 and origid=1;
SELECT * FROM graph WHERE origid=1;
SELECT * FROM graph WHERE destid=1;
SELECT * FROM graph WHERE origid=666;
SELECT * FROM graph WHERE origid=NULL;
#-- what happens if we have two links the same?
--error 1062
INSERT INTO graph_base(from_id, to_id) VALUES (1,2);
DELETE FROM graph_base;
#-- Uncomment the following after fixing https://bugs.launchpad.net/oqgraph/+bug/1195735
#-- FIXME SELECT * FROM graph;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
#-- Uncomment the following after fixing https://bugs.launchpad.net/oqgraph/+bug/xxxxxxx - Causes the later select to not fail!
#-- FIXME SELECT * FROM graph;
#-- Expect error if we pull the table out from under
DROP TABLE graph_base;
--error S42S02
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
DROP TABLE graph;
# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1195735
#--reproduce bug where select * from graph after delete from graph_base hangs the server
--disable_warnings
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
--enable_warnings
# Create the backing store
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE=MyISAM;
CREATE TABLE graph (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
seq BIGINT UNSIGNED NULL,
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';
INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
--echo One select of any clauses at all on graph here caused a hang on the select after the DELETE FROM
#-- even this if it is the only one - but it doesnt hang here ... SELECT * FROM graph;
SELECT * FROM graph WHERE destid=2 and origid=1;
DELETE FROM graph_base;
#-- Bug 1195735 hangs on the next line
SELECT * from graph;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
--error S42S02
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
DROP TABLE graph;
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