From dd094efe16b3717c5349294c04dfbdaad9132b1e Mon Sep 17 00:00:00 2001 From: Andrew McDonnell Date: Sat, 28 Feb 2015 23:15:17 +1030 Subject: [PATCH 1/3] Added regression test for MDEV_5871 --- storage/oqgraph/ha_oqgraph.cc | 1 + .../oqgraph/mysql-test/oqgraph/general.inc | 2 +- .../oqgraph/regression_mdev5871.result | 86 +++++++++++++ .../oqgraph/regression_mdev5871.test | 121 ++++++++++++++++++ 4 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result create mode 100644 storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc index b81ca3d221088..2a6234c4e9d0b 100644 --- a/storage/oqgraph/ha_oqgraph.cc +++ b/storage/oqgraph/ha_oqgraph.cc @@ -1,4 +1,5 @@ /* Copyright (C) 2007-2013 Arjen G Lentz & Antony T Curtis for Open Query + Copyright (C) 2014 Sergei Golubchik Portions of this file copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify diff --git a/storage/oqgraph/mysql-test/oqgraph/general.inc b/storage/oqgraph/mysql-test/oqgraph/general.inc index 357a8c786ee02..a4afcd4efbd02 100644 --- a/storage/oqgraph/mysql-test/oqgraph/general.inc +++ b/storage/oqgraph/mysql-test/oqgraph/general.inc @@ -14,7 +14,7 @@ eval CREATE TABLE graph_base ( INDEX (to_id) ) ENGINE= $oqgraph_use_table_type ; - +# Since late June 2014 OQGraph supoprts 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; # Regression for MDEV-5891 diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result new file mode 100644 index 0000000000000..d2dfc46d5ffc5 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result @@ -0,0 +1,86 @@ +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 DOUBLE NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id'; +DESCRIBE graph; +Field Type Null Key Default Extra +latch varchar(32) YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight'; +DESCRIBE graph; +Field Type Null Key Default Extra +latch varchar(32) YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base_xxx' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +# Expect 'Table 'test.graph_base_xxx' doesn't exist' +DESCRIBE graph; +ERROR 42S02: Table 'test.graph_base_xxx' doesn't exist +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight_xxx'; +# Expect 'Invalid OQGRAPH backing store description ('graph.weight' attribute not set to a valid column of 'graph_base')' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('graph.weight' attribute not set to a valid column of 'graph_base')' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +# Expect 'Invalid OQGRAPH backing store description ('graph.destid' attribute not set to a valid column of 'graph_base')' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('graph.destid' attribute not set to a valid column of 'graph_base')' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id_xxx' DESTID='to_id' WEIGHT='weight'; +# Expect 'Invalid OQGRAPH backing store description ('graph.origid' attribute not set to a valid column of 'graph_base')' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('graph.origid' attribute not set to a valid column of 'graph_base')' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' DESTID='to_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DESTID='to_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id', DESTID='to_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph_base; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test new file mode 100644 index 0000000000000..016dc89923d77 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test @@ -0,0 +1,121 @@ +--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, + weight DOUBLE NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + +# Since late June 2014 OQGraph supoprts 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id'; +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight'; +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base_xxx' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +--echo # Expect 'Table 'test.graph_base_xxx' doesn't exist' +--error 1146 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight_xxx'; +--echo # Expect 'Invalid OQGRAPH backing store description ('graph.weight' attribute not set to a valid column of 'graph_base')' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +--echo # Expect 'Invalid OQGRAPH backing store description ('graph.destid' attribute not set to a valid column of 'graph_base')' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id_xxx' DESTID='to_id' WEIGHT='weight'; +--echo # Expect 'Invalid OQGRAPH backing store description ('graph.origid' attribute not set to a valid column of 'graph_base')' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +# The following combinations should be invalid +CREATE TABLE graph ENGINE=OQGRAPH; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' DESTID='to_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DESTID='to_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id', DESTID='to_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +--disable_warnings +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph_base; +--enable_warnings + From 116d4010576b2f782aeb68e9315c0e53a24c667d Mon Sep 17 00:00:00 2001 From: Andrew McDonnell Date: Tue, 17 Mar 2015 20:23:05 +1030 Subject: [PATCH 2/3] Forgot my own name... --- storage/oqgraph/ha_oqgraph.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc index 2a6234c4e9d0b..1197be504989c 100644 --- a/storage/oqgraph/ha_oqgraph.cc +++ b/storage/oqgraph/ha_oqgraph.cc @@ -1,4 +1,5 @@ /* Copyright (C) 2007-2013 Arjen G Lentz & Antony T Curtis for Open Query + Copyright (C) 2013-2015 Andrew McDonnell Copyright (C) 2014 Sergei Golubchik Portions of this file copyright (C) 2000-2006 MySQL AB From e65337e9cb568faa4e32f04cc96be85117c19a70 Mon Sep 17 00:00:00 2001 From: Andrew McDonnell Date: Tue, 17 Mar 2015 20:23:31 +1030 Subject: [PATCH 3/3] Fix minor spelling typos from prior commits --- storage/oqgraph/mysql-test/oqgraph/general.inc | 2 +- storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/oqgraph/mysql-test/oqgraph/general.inc b/storage/oqgraph/mysql-test/oqgraph/general.inc index a4afcd4efbd02..f27b7585dd774 100644 --- a/storage/oqgraph/mysql-test/oqgraph/general.inc +++ b/storage/oqgraph/mysql-test/oqgraph/general.inc @@ -14,7 +14,7 @@ eval CREATE TABLE graph_base ( INDEX (to_id) ) ENGINE= $oqgraph_use_table_type ; -# Since late June 2014 OQGraph supoprts 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 +# Since late June 2014 OQGraph supports 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; # Regression for MDEV-5891 diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test index 016dc89923d77..15d1eff0142b8 100644 --- a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test @@ -11,7 +11,7 @@ CREATE TABLE graph_base ( INDEX (to_id) ) ENGINE=MyISAM; -# Since late June 2014 OQGraph supoprts 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 +# Since late June 2014 OQGraph supports 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id'; DESCRIBE graph;