Commit af2129f9 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-5319 - Request for merge of Oqgraph v3 functionality storage/oqgraph

            into 10.0
parents 03f6778d 01c514fc
This diff is collapsed.
This diff is collapsed.
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph2;
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';
SELECT * FROM graph2 WHERE latch='dijkstras' AND origid=1 AND destid=6;
ERROR 42S02: Table 'test.graph_base' doesn't exist
DROP TABLE graph2;
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);
# Expect no result, because of autocast
SELECT * FROM graph WHERE latch=0 ;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=0 and origid is NULL;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 ;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 and destid=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 and origid is NULL;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=2 ;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=2 and destid=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=2 and origid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=2 and destid=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=2 and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=2 and origid is NULL;
latch origid destid weight seq linkid
# Should this return an error? it seems we treat it as just another bogus latch
SELECT * FROM graph WHERE latch='ThisExceeds32Characters456789012';
latch origid destid weight seq linkid
# Expect no result, because of invalid latch
SELECT * FROM graph WHERE latch='bogus';
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='bogus' and destid=2 and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='bogus' and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='bogus' and destid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='bogus' and origid=666;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='bogus' and origid is NULL;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='666';
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='666' and destid=2 and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='666' and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='666' and destid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='666' and origid=666;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='666' and origid is NULL;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='-1';
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='-1' and destid=2 and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='-1' and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='-1' and destid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='-1' and origid=666;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='-1' and origid is NULL;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
# Make sure we dont crash if someone passed in a UTF string
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄';
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=2 and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=1;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=666;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid is NULL;
latch origid destid weight seq linkid
Warnings:
Warning 1210 Incorrect arguments to OQGRAPH latch
# Return all edges when latch is NULL
SELECT * FROM graph WHERE latch is NULL;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
NULL 5 6 1 NULL NULL
NULL 6 5 1 NULL NULL
SELECT * FROM graph WHERE latch is NULL and destid=2 and origid=1;
latch origid destid weight seq linkid
NULL 1 2 1 3 1
NULL 1 2 1 2 3
NULL 1 2 1 1 2
SELECT * FROM graph WHERE latch is NULL and origid=1;
latch origid destid weight seq linkid
NULL 1 NULL 1 2 3
NULL 1 NULL 1 1 2
SELECT * FROM graph WHERE latch is NULL and destid=1;
latch origid destid weight seq linkid
NULL NULL 1 1 2 3
NULL NULL 1 1 1 2
SELECT * FROM graph WHERE latch is NULL and origid=666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch is NULL and origid is NULL;
latch origid destid weight seq linkid
NULL NULL NULL NULL NULL 1
NULL NULL NULL NULL NULL 2
NULL NULL NULL NULL NULL 3
NULL NULL NULL NULL NULL 4
NULL NULL NULL NULL NULL 5
NULL NULL NULL NULL NULL 6
INSERT INTO graph_base(from_id, to_id) VALUES (1,2);
ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY'
DELETE FROM graph_base;
SELECT * FROM graph;
latch origid destid weight seq linkid
FLUSH TABLES;
TRUNCATE TABLE graph_base;
SELECT * FROM graph;
latch origid destid weight seq linkid
DROP TABLE graph_base;
FLUSH TABLES;
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
ERROR 42S02: Table 'test.graph_base' doesn't exist
DROP TABLE graph;
--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 # Expect no result, because of autocast
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 is 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 is 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 is 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 is 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 is 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 is 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 is NULL;
#--echo # Expect no result, because of NULL latch
#-- FIXME - in v2 according to http://openquery.com/graph/doc NULL latch should
#-- FIXME - return same as select * from graph;
#--https://bugs.launchpad.net/oqgraph/+bug/1196021
--echo # Return all edges when latch is NULL
SELECT * FROM graph WHERE latch is NULL;
SELECT * FROM graph WHERE latch is NULL and destid=2 and origid=1;
SELECT * FROM graph WHERE latch is NULL and origid=1;
SELECT * FROM graph WHERE latch is NULL and destid=1;
SELECT * FROM graph WHERE latch is NULL and origid=666;
SELECT * FROM graph WHERE latch is NULL and origid is NULL;
#-- what happens if we have two links the same? primay key violation...
--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
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!
#-- For now dont report a separate bug as it may be a manifestation of https://bugs.launchpad.net/oqgraph/+bug/1195735
SELECT * FROM graph;
#-- Expect error if we pull the table out from under
DROP TABLE graph_base;
FLUSH TABLES;
--error S42S02
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
DROP TABLE graph;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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 (3,2), (2,3);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
insert into graph values (NULL, 1, 2, 3.0, NULL, NULL);
ERROR HY000: Table 'graph' is read only
delete from graph;
ERROR HY000: Table 'graph' is read only
truncate graph;
ERROR HY000: Table 'graph' is read only
update graph set origid=123;
ERROR HY000: Table 'graph' is read only
DROP TABLE graph_base;
DROP TABLE graph;
--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);
INSERT INTO graph_base(from_id, to_id) VALUES (3,2), (2,3);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
# -- check readonly'ness
--error 1036
insert into graph values (NULL, 1, 2, 3.0, NULL, NULL);
--error 1036
delete from graph;
--error 1036
truncate graph;
# This was hitting bug https://bugs.launchpad.net/oqgraph/+bug/1233113
--error 1036
update graph set origid=123;
DROP TABLE graph_base;
DROP TABLE graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph2;
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);
select * from graph where latch is null;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
NULL 5 6 1 NULL NULL
NULL 6 5 1 NULL NULL
select * from graph where latch is null and origid=1;
latch origid destid weight seq linkid
NULL 1 NULL 1 2 3
NULL 1 NULL 1 1 2
select * from graph where latch is null and destid=2;
latch origid destid weight seq linkid
NULL NULL 2 1 1 1
DROP TABLE graph_base;
DROP TABLE graph;
--disable_warnings
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph2;
--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);
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);
select * from graph where latch is null;
select * from graph where latch is null and origid=1;
select * from graph where latch is null and destid=2;
DROP TABLE graph_base;
DROP TABLE graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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;
The next error 140 + 1005 is expected
CREATE TABLE graph (
latch SMALLINT UNSIGNED 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';
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 (
latch SMALLINT UNSIGNED 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';
Warnings:
Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead
SET GLOBAL oqgraph_allow_create_integer_latch=false;
The next error 140 + 1005 is expected
CREATE TABLE graph_again (
latch SMALLINT UNSIGNED 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';
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);
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);
# Exercising latch==2
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1;
latch origid destid weight seq linkid
2 1 NULL 1 3 3
2 1 NULL 1 2 2
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2;
latch origid destid weight seq linkid
2 1 NULL 2 4 4
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND (weight = 1 OR weight = 2);
latch origid destid weight seq linkid
2 1 NULL 2 4 4
2 1 NULL 1 3 3
2 1 NULL 1 2 2
# Exercising latch==1
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4;
latch origid destid weight seq linkid
1 1 4 NULL 0 1
1 1 4 1 1 3
1 1 4 1 2 4
SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1;
latch origid destid weight seq linkid
1 4 1 NULL 0 4
1 4 1 1 1 3
1 4 1 1 2 1
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
latch origid destid weight seq linkid
0 1 2 1 3 1
0 1 2 1 2 3
0 1 2 1 1 2
# Adding new row to base table
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
# Deleting rows from base table
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
# Execising latch==1 on new data
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
latch origid destid weight seq linkid
1 1 6 NULL 0 1
1 1 6 1 1 3
1 1 6 1 2 4
1 1 6 1 3 6
SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1;
latch origid destid weight seq linkid
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph_base;
--disable_warnings
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
--enable_warnings
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;
# Backwards compatibility test
# First we ensure the scaffolding is disabled (default situation)
# and check we cant create a table with an integer latch
# Assume this is the default, so dont explicity set false yet:
# SET GLOBAL oqgraph_allow_create_integer_latch=false;
--echo The next error 140 + 1005 is expected
--error 140
--error 1005
CREATE TABLE graph (
latch SMALLINT UNSIGNED 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';
# Here we enable scaffolding to let us create a deprecated table
# so we can check that the new code will still allow queries to be performed
# on a legacy database
# It should still generate a warning (1287) - but I dont know how to test for that
#
# latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future
# release. Please use 'latch VARCHAR(32) NULL' instead
#
SET GLOBAL oqgraph_allow_create_integer_latch=true;
--echo The next warning 1287 is expected
CREATE TABLE graph (
latch SMALLINT UNSIGNED 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';
# Prevent further tables being create this way again
# and make sure the set is effective ...
SET GLOBAL oqgraph_allow_create_integer_latch=false;
--echo The next error 140 + 1005 is expected
--error 140
--error 1005
CREATE TABLE graph_again (
latch SMALLINT UNSIGNED 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';
# Regression test expected v2 behaviour in this situation
--echo # 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);
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 # Exercising latch==2
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1;
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2;
SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND (weight = 1 OR weight = 2);
--echo # Exercising latch==1
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4;
SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1;
SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1;
--echo # Adding new row to base table
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
--echo # Deleting rows from base table
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
--echo # Execising latch==1 on new data
SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6;
SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1;
# FIXME - if the following DROPs are missing then mysql will segfault on exit
# indicating an ordering dependency on destruction somewhere...
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph_base;
drop table if exists graph;
Warnings:
Note 1051 Unknown table 'test.graph'
CREATE TABLE graph (
latch SMALLINT UNSIGNED 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;
delete from graph;
insert into graph(origid, destid) values (1,2), (2,1);
insert into graph(origid, destid) values (1,3), (3,1);
insert into graph(origid, destid) values (3,4), (4,3);
insert into graph(origid, destid) values (3,5), (5,3);
insert into graph(origid, destid) values (5,6), (6,5);
select * from graph where latch = 2 and origid = 1 and weight = 1;
latch origid destid weight seq linkid
2 1 NULL 1 3 3
2 1 NULL 1 2 2
select * from graph where latch = 2 and origid = 1 and weight = 2;
latch origid destid weight seq linkid
2 1 NULL 2 5 5
2 1 NULL 2 4 4
select * from graph
where latch = 2 and origid = 1 and (weight = 1 or weight = 2);
latch origid destid weight seq linkid
2 1 NULL 2 5 5
2 1 NULL 2 4 4
2 1 NULL 1 3 3
2 1 NULL 1 2 2
select * from graph where latch=1 and origid=1 and destid=6;
latch origid destid weight seq linkid
1 1 6 NULL 0 1
1 1 6 1 1 3
1 1 6 1 2 5
1 1 6 1 3 6
select * from graph where latch=1 and origid=1 and destid=4;
latch origid destid weight seq linkid
1 1 4 NULL 0 1
1 1 4 1 1 3
1 1 4 1 2 4
select * from graph where latch=1 and origid=4 and destid=1;
latch origid destid weight seq linkid
1 4 1 NULL 0 4
1 4 1 1 1 3
1 4 1 1 2 1
insert into graph (origid,destid) values (4,6);
delete from graph where origid=5;
delete from graph where origid=3 and destid=5;
select * from graph where latch=1 and origid=1 and destid=6;
latch origid destid weight seq linkid
1 1 6 NULL 0 1
1 1 6 1 1 3
1 1 6 1 2 4
1 1 6 1 3 6
select * from graph where latch=1 and origid=6 and destid=1;
latch origid destid weight seq linkid
truncate table graph;
drop table graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
another_id INT UNSIGNED NOT NULL DEFAULT 1,
w DOUBLE NOT NULL DEFAULT 1,
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', WEIGHT='w';
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 (1,4), (4,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
SELECT * from graph;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 1 4 1 NULL NULL
NULL 4 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1;
latch origid destid weight seq linkid
1 1 2 NULL 0 1
1 1 2 1 1 2
SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1 order by seq;
latch origid destid weight seq linkid
1 1 2 NULL 0 1
1 1 2 1 1 2
DROP TABLE graph;
DROP TABLE graph_base;
# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1133093
# Reproduce bug where order by seq crashes
--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,
another_id INT UNSIGNED NOT NULL DEFAULT 1,
w DOUBLE NOT NULL DEFAULT 1,
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', WEIGHT='w';
# -- do some stuff
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 (1,4), (4,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
SELECT * from graph;
SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1 order by seq;
DROP TABLE graph;
DROP TABLE graph_base;
# Probably a separate issue: if the test is exited without dropping the tables at all
# then there is a memory leak reported
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
another_id INT UNSIGNED NOT NULL DEFAULT 1,
w DOUBLE NOT NULL DEFAULT 1,
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', WEIGHT='w';
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 (1,4), (4,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
SELECT * from graph;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 1 4 1 NULL NULL
NULL 4 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
SELECT * FROM graph WHERE destid=2 and origid=1;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
alter table graph ORIGID = 'another_id';
ERROR HY000: Storage engine OQGRAPH of the table `test`.`graph` doesn't have this option
alter table graph ORIGID = 'something_else';
ERROR HY000: Storage engine OQGRAPH of the table `test`.`graph` doesn't have this option
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1134355
#--reproduce bug where renaming a column in the graph crashes instead of returning an error
--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,
another_id INT UNSIGNED NOT NULL DEFAULT 1,
w DOUBLE NOT NULL DEFAULT 1,
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', WEIGHT='w';
# -- do some stuff
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 (1,4), (4,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
SELECT * from graph;
SELECT * FROM graph WHERE destid=2 and origid=1;
# We cant do this anyway because of read onlyness of table.... 1036 == read only
# In any case I changed the flags to make alter unsupported; later we can try and work out why the core doesnt help us clean up properly
# --error 1036
--error 1031
alter table graph ORIGID = 'another_id';
# But we need that to hold even in an invalid situation!
# -- bug was: the following alter table would crash, instead of returning error 1296
# -- currently following may not crash, but does with the previous error 1036 causing statement present
# 'attribute not set to a valid column of 'xxx' - note currently truncating to graph_b instead of graph_base for some reason...
#--error 1296
--error 1031
alter table graph ORIGID = 'something_else';
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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);
One select of any clauses at all on graph here caused a hang on the select after the DELETE FROM
SELECT * FROM graph WHERE destid=2 and origid=1;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
DELETE FROM graph_base;
SELECT * from graph;
latch origid destid weight seq linkid
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6;
ERROR 42S02: Table 'test.graph_base' doesn't exist
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;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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);
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '1' AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '1' AND destid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND origid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '1' AND origid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '1' AND destid = 666 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '' AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '0' AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch is NULL AND origid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '' AND destid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '0' AND destid = 666;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch is NULL AND destid = 666;
latch origid destid weight seq linkid
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1196020
#-- bug where select blah with origid = X where X does not exist, returns a row
#-- bug where select blah with destid = X where X does not exist, returns a row
--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);
# All the following should return no result because no vertex 666 exists in the graph
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666;
SELECT * FROM graph WHERE latch = '2' AND origid = 666;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666;
SELECT * FROM graph WHERE latch = '1' AND origid = 666;
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666;
SELECT * FROM graph WHERE latch = '2' AND destid = 666;
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666;
SELECT * FROM graph WHERE latch = '1' AND destid = 666;
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = '2' AND origid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = '1' AND origid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = '2' AND destid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666 and weight = 1;
SELECT * FROM graph WHERE latch = '1' AND destid = 666 and weight = 1;
# Sanity check for no-search
SELECT * FROM graph WHERE latch = '' AND origid = 666;
SELECT * FROM graph WHERE latch = '0' AND origid = 666;
SELECT * FROM graph WHERE latch is NULL AND origid = 666;
SELECT * FROM graph WHERE latch = '' AND destid = 666;
SELECT * FROM graph WHERE latch = '0' AND destid = 666;
SELECT * FROM graph WHERE latch is NULL AND destid = 666;
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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);
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1;
latch origid destid weight seq linkid
breadth_first NULL 1 1 2 2
breadth_first NULL 1 0 1 1
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2;
latch origid destid weight seq linkid
breadth_first NULL 2 1 2 1
breadth_first NULL 2 0 1 2
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1;
latch origid destid weight seq linkid
breadth_first 1 NULL 1 2 2
breadth_first 1 NULL 0 1 1
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2;
latch origid destid weight seq linkid
breadth_first 2 NULL 1 2 1
breadth_first 2 NULL 0 1 2
SELECT * FROM graph WHERE latch = '2' AND destid = 1;
latch origid destid weight seq linkid
2 NULL 1 1 2 2
2 NULL 1 0 1 1
SELECT * FROM graph WHERE latch = '2' AND destid = 2;
latch origid destid weight seq linkid
2 NULL 2 1 2 1
2 NULL 2 0 1 2
SELECT * FROM graph WHERE latch = '2' AND origid = 1;
latch origid destid weight seq linkid
2 1 NULL 1 2 2
2 1 NULL 0 1 1
SELECT * FROM graph WHERE latch = '2' AND origid = 2;
latch origid destid weight seq linkid
2 2 NULL 1 2 1
2 2 NULL 0 1 2
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1196027
#-- These were returning NULL which is incorrect
#-- https://bugs.launchpad.net/oqgraph/+bug/1196027
--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);
# All the following should return no result because no vertex 666 exists in the graph
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1;
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2;
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1;
SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2;
SELECT * FROM graph WHERE latch = '2' AND destid = 1;
SELECT * FROM graph WHERE latch = '2' AND destid = 2;
SELECT * FROM graph WHERE latch = '2' AND origid = 1;
SELECT * FROM graph WHERE latch = '2' AND origid = 2;
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
weight FLOAT 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', WEIGHT='weight';
INSERT INTO graph_base(from_id, to_id, weight) VALUES (1,2,16), (2,1,16);
INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,3,256), (3,2,256);
INSERT INTO graph_base(from_id, to_id, weight) VALUES (3,4,65536), (4,3,65536);
INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,4,768);
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1;
latch origid destid weight seq linkid
dijkstras 1 NULL 784 4 4
dijkstras 1 NULL 272 3 3
dijkstras 1 NULL 16 2 2
dijkstras 1 NULL 0 1 1
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2;
latch origid destid weight seq linkid
dijkstras 2 NULL 768 4 4
dijkstras 2 NULL 256 3 3
dijkstras 2 NULL 16 2 1
dijkstras 2 NULL 0 1 2
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3;
latch origid destid weight seq linkid
dijkstras 3 NULL 1024 4 4
dijkstras 3 NULL 272 3 1
dijkstras 3 NULL 256 2 2
dijkstras 3 NULL 0 1 3
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 1;
latch origid destid weight seq linkid
dijkstras NULL 1 784 4 4
dijkstras NULL 1 272 3 3
dijkstras NULL 1 16 2 2
dijkstras NULL 1 0 1 1
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 2;
latch origid destid weight seq linkid
dijkstras NULL 2 768 4 4
dijkstras NULL 2 256 3 3
dijkstras NULL 2 16 2 1
dijkstras NULL 2 0 1 2
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 3;
latch origid destid weight seq linkid
dijkstras NULL 3 1024 4 4
dijkstras NULL 3 272 3 1
dijkstras NULL 3 256 2 2
dijkstras NULL 3 0 1 3
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=3;
latch origid destid weight seq linkid
dijkstras 1 3 NULL 0 1
dijkstras 1 3 16 1 2
dijkstras 1 3 256 2 3
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=4;
latch origid destid weight seq linkid
dijkstras 1 4 NULL 0 1
dijkstras 1 4 16 1 2
dijkstras 1 4 768 2 4
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=16;
latch origid destid weight seq linkid
dijkstras 1 NULL 16 2 2
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=16;
latch origid destid weight seq linkid
dijkstras 2 NULL 16 2 1
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=16;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=784;
latch origid destid weight seq linkid
dijkstras 1 NULL 784 4 4
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=784;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=784;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=256;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=256;
latch origid destid weight seq linkid
dijkstras 2 NULL 256 3 3
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=256;
latch origid destid weight seq linkid
dijkstras 3 NULL 256 2 2
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1196036
#-- bug with Djikstras algorithm - find reachable vertices (origid=X) returns weight=0 instead of weight=count of hops
--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,
weight FLOAT 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', WEIGHT='weight';
INSERT INTO graph_base(from_id, to_id, weight) VALUES (1,2,16), (2,1,16);
INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,3,256), (3,2,256);
INSERT INTO graph_base(from_id, to_id, weight) VALUES (3,4,65536), (4,3,65536);
INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,4,768);
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3;
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 1;
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 2;
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 3;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=3;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=4;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=1; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=1; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=1; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=16;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=16;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=16; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=784;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=784; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=784; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=256; # <-- should return nothing
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=256;
SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=256;
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
This diff is collapsed.
This diff is collapsed.
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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 (3,2), (2,3);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
update graph set origid=123;
ERROR HY000: Table 'graph' is read only
DROP TABLE graph_base;
DROP TABLE graph;
--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);
INSERT INTO graph_base(from_id, to_id) VALUES (3,2), (2,3);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
# The following line crashes when MTR run with --gdb, see bug https://bugs.launchpad.net/oqgraph/+bug/1233113
--error 1036
update graph set origid=123;
# Otherwise, MTR hangs on the next line
DROP TABLE graph_base;
DROP TABLE graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
CREATE TABLE graph_base (
von INT NOT NULL,
nach INT NOT NULL,
weight DOUBLE NOT NULL,
PRIMARY KEY (von,nach),
INDEX (von)
) 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='von' DESTID='nach' WEIGHT='weight';
INSERT INTO graph_base(von,nach,weight) VALUES (3,5,2), (5,4,1), (5,6,1);
SELECT * FROM graph_base;
von nach weight
3 5 2
5 4 1
5 6 1
SELECT * FROM graph;
latch origid destid weight seq linkid
NULL 3 5 2 NULL NULL
NULL 5 4 1 NULL NULL
NULL 5 6 1 NULL NULL
INSERT INTO graph_base(von,nach,weight) VALUES (6,3,1);
SELECT * FROM graph;
latch origid destid weight seq linkid
NULL 3 5 2 NULL NULL
NULL 5 4 1 NULL NULL
NULL 5 6 1 NULL NULL
NULL 6 3 1 NULL NULL
FLUSH TABLES;
DROP TABLE graph_base;
DROP TABLE graph;
-- source include/have_log_bin.inc
--disable_warnings
drop table if exists graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
--enable_warnings
# Create the backing store
CREATE TABLE graph_base (
von INT NOT NULL,
nach INT NOT NULL,
weight DOUBLE NOT NULL,
PRIMARY KEY (von,nach),
INDEX (von)
) ENGINE=MyISAM;
CREATE TABLE graph (
latch SMALLINT UNSIGNED NULL,
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
......@@ -13,15 +23,21 @@ CREATE TABLE graph (
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH;
# MBug#524625: OQGraph error with binary logging enabled
# Test that OQGraph works with different binlogging modes.
SET binlog_format = row;
insert into graph(origid, destid) values (1,3), (3,1);
SET binlog_format = statement;
insert into graph(origid, destid) values (3,4), (4,3);
SET binlog_format = mixed;
insert into graph(origid, destid) values (3,5), (5,3);
drop table graph;
) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='von' DESTID='nach' WEIGHT='weight';
INSERT INTO graph_base(von,nach,weight) VALUES (3,5,2), (5,4,1), (5,6,1);
SELECT * FROM graph_base;
SELECT * FROM graph;
INSERT INTO graph_base(von,nach,weight) VALUES (6,3,1);
SELECT * FROM graph;
FLUSH TABLES;
DROP TABLE graph_base;
DROP TABLE graph;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
drop table if exists graph;
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
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 SMALLINT UNSIGNED NULL,
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
......@@ -8,11 +15,14 @@ seq BIGINT UNSIGNED NULL,
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH;
SET binlog_format = row;
insert into graph(origid, destid) values (1,3), (3,1);
SET binlog_format = statement;
insert into graph(origid, destid) values (3,4), (4,3);
SET binlog_format = mixed;
insert into graph(origid, destid) values (3,5), (5,3);
drop table graph;
) 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);
SELECT * FROM graph;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
DROP TABLE graph_base;
FLUSH TABLES;
SELECT * FROM graph;
ERROR 42S02: Table 'test.graph_base' doesn't exist
DROP TABLE graph;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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