Commit 2560ce00 authored by Andrew McDonnell's avatar Andrew McDonnell

MOre fixes related to merge of lp:maria/10.0

parent c43058d0
......@@ -66,7 +66,7 @@ DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( 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='backing',ORIGID='bogus', DESTID='id2';
# Expect Invalid OQGRAPH backing store ('/oqtable'.origid attribute not set to a valid column of 'backing')'
DESCRIBE oqtable;
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('/oqtable'.origid attribute not set to a valid column of 'backing')' from OQGRAPH
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.origid' attribute not set to a valid column of 'backing')' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( 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='backing',ORIGID='not_id_type', DESTID='id2';
# Expect 'Column 'backing.not_id_type' is not a not-null integer type'
......@@ -86,7 +86,7 @@ DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( 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='backing',ORIGID='id',DESTID='bogus';
# Expect Invalid OQGRAPH backing store ('/oqtable'.destid attribute not set to a valid column of 'backing')'
DESCRIBE oqtable;
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('/oqtable'.destid attribute not set to a valid column of 'backing')' from OQGRAPH
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.destid' attribute not set to a valid column of 'backing')' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( 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='backing',ORIGID='id',DESTID='not_id_type';
# Expect 'Column 'backing.not_id_type' is not a not-null integer type'
......@@ -96,17 +96,17 @@ DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( 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='backing',ORIGID='id',DESTID='id';
# Expect 'Invalid OQGRAPH backing store ('/oqtable'.destid attribute set to same column as origid attribute)'
DESCRIBE oqtable;
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('/oqtable'.destid attribute set to same column as origid attribute)' from OQGRAPH
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.destid' attribute set to same column as origid attribute)' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL 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='backing',ORIGID='id',DESTID='id2',WEIGHT='';
# Expect 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')'
DESCRIBE oqtable;
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')' from OQGRAPH
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.weight' attribute not set to a valid column of 'backing')' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL 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='backing',ORIGID='id',DESTID='id2',WEIGHT='bogus';
# Expect 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')'
DESCRIBE oqtable;
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')' from OQGRAPH
ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.weight' attribute not set to a valid column of 'backing')' from OQGRAPH
DROP TABLE IF EXISTS oqtable;
CREATE TABLE oqtable ( latch varchar(32) NULL 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='backing',ORIGID='id',DESTID='id2',WEIGHT='not_weight_type';
# Expect 'Column 'backing.not_weight_type' is not a not-null real type'
......
......@@ -75,8 +75,10 @@ DROP TABLE IF EXISTS oqtable;
--enable_warnings
CREATE TABLE oqtable ( 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='bogus', ORIGID='id', DESTID='id2';
--echo # Expect: 'Table 'test.bogus' doesn't exist''
--disable_warnings
--error 1146
DESCRIBE oqtable;
--enable_warnings
# Table exists but no orig or dest specified
--disable_warnings
......
......@@ -36,9 +36,9 @@ 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: Table storage engine for 'graph' doesn't have this option
ERROR HY000: Storage engine OQGRAPH of the table `test`.`graph` doesn't have this option
alter table graph ORIGID = 'something_else';
ERROR HY000: Table storage engine for 'graph' doesn't have this option
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;
......
......@@ -505,23 +505,24 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
reinterpret_cast<oqgraph_table_option_struct*>(table->s->option_struct);
// Catch cases where table was not constructed properly
// Note - need to return -1 so our error text gets reported
if (!options) {
fprint_error("Invalid OQGRAPH backing store (null attributes)");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
DBUG_RETURN(-1);
}
if (!options->table_name || !*options->table_name) {
fprint_error("Invalid OQGRAPH backing store (unspecified or empty data_table attribute)");
// if table_name if present but doesnt actually exist, we will fail out below
// when we call open_table_def(). same probably applies for the id fields
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
DBUG_RETURN(-1);
}
if (!options->origid || !*options->origid) {
fprint_error("Invalid OQGRAPH backing store (unspecified or empty origid attribute)");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
DBUG_RETURN(-1);
}
if (!options->destid || !*options->destid) {
fprint_error("Invalid OQGRAPH backing store (unspecified or empty destid attribute)");
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
DBUG_RETURN(-1);
}
// weight is optional
......@@ -566,13 +567,13 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
// Lets try without this, and see if all the tests pass...
while (open_table_def(thd, share, open_def_flags))
{
#if MYSQL_VERSION_ID < 100002
if (thd->is_error() && thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE)
{
free_table_share(share);
DBUG_RETURN(thd->get_stmt_da()->sql_errno());
}
#if MYSQL_VERSION_ID < 100002
if (ha_create_table_from_engine(thd, table->s->db.str, options->table_name))
{
free_table_share(share);
......@@ -582,10 +583,11 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
thd->clear_error();
continue;
#else
open_table_error(share, OPEN_FRM_OPEN_ERROR, EMFILE);
open_table_error(share, OPEN_FRM_OPEN_ERROR, ENOENT);
free_table_share(share);
fprint_error("Problem opening OQGRPAPH backing store, maybe introduced by MariaDB v10.0.2.");
DBUG_RETURN(-1);
if (thd->is_error())
DBUG_RETURN(thd->get_stmt_da()->sql_errno());
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
#endif
}
......@@ -599,7 +601,6 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (share->is_view)
{
open_table_error(share, OPEN_FRM_OPEN_ERROR, EMFILE);
free_table_share(share);
fprint_error("VIEWs are not supported for an OQGRAPH backing store.");
DBUG_RETURN(-1);
......@@ -611,7 +612,15 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
thd->open_options, edges, FALSE))
{
open_table_error(share, err, EMFILE);
open_table_error(share, err, EMFILE); // NOTE - EMFILE is probably bogus, it reports as too many open files (!)
free_table_share(share);
DBUG_RETURN(-1);
}
if (!edges->file)
{
fprint_error("Some error occurred opening table '%s'", options->table_name);
free_table_share(share);
DBUG_RETURN(-1);
}
......@@ -630,13 +639,6 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
// We expect fields origid, destid and optionally weight
origid= destid= weight= 0;
if (!edges->file)
{
fprint_error("Some error occurred opening table '%s'", options->table_name);
free_table_share(share);
DBUG_RETURN(-1);
}
for (Field **field= edges->field; *field; ++field)
{
if (strcmp(options->origid, (*field)->field_name))
......@@ -712,7 +714,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
}
if (!weight && options->weight) {
fprint_error("Invalid OQGRAPH backing store ('%s.weight' attribute not set to a valid column of '%s')", p, options->table_name);
fprint_error("Invalid OQGRAPH backing store ('%s.weight' attribute not set to a valid column of '%s')", p+1, options->table_name);
closefrm(edges, 0);
free_table_share(share);
DBUG_RETURN(-1);
......
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