Commit 281cd0f3 authored by unknown's avatar unknown

Bug #17559 ndb_gis test failure

- test tables use blobs without PK, and was not handled correctly

parent 55815835
SET storage_engine=ndbcluster; SET storage_engine=ndbcluster;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE gis_point (fid INTEGER, g POINT); CREATE TABLE gis_point (fid INTEGER, g POINT);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_line (fid INTEGER, g LINESTRING); CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_polygon (fid INTEGER, g POLYGON); CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT); CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING); CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON); CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION); CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY); CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
SHOW CREATE TABLE gis_point; SHOW CREATE TABLE gis_point;
Table Create Table Table Create Table
gis_point CREATE TABLE `gis_point` ( gis_point CREATE TABLE `gis_point` (
...@@ -416,6 +432,8 @@ mpg multipolygon, ...@@ -416,6 +432,8 @@ mpg multipolygon,
gc geometrycollection, gc geometrycollection,
gm geometry gm geometry
); );
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
gp point YES NULL gp point YES NULL
...@@ -427,6 +445,8 @@ mpg multipolygon YES NULL ...@@ -427,6 +445,8 @@ mpg multipolygon YES NULL
gc geometrycollection YES NULL gc geometrycollection YES NULL
gm geometry YES NULL gm geometry YES NULL
ALTER TABLE t1 ADD fid INT; ALTER TABLE t1 ADD fid INT;
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
gp point YES NULL gp point YES NULL
...@@ -440,6 +460,8 @@ gm geometry YES NULL ...@@ -440,6 +460,8 @@ gm geometry YES NULL
fid int(11) YES NULL fid int(11) YES NULL
DROP TABLE t1; DROP TABLE t1;
create table t1 (a geometry not null); create table t1 (a geometry not null);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
insert into t1 values (GeomFromText('Point(1 2)')); insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage'); insert into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
...@@ -447,6 +469,8 @@ insert IGNORE into t1 values ('Garbage'); ...@@ -447,6 +469,8 @@ insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1; drop table t1;
create table t1 (fl geometry); create table t1 (fl geometry);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
insert into t1 values (1); insert into t1 values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11); insert into t1 values (1.11);
...@@ -459,13 +483,29 @@ drop table t1; ...@@ -459,13 +483,29 @@ drop table t1;
set engine_condition_pushdown = on; set engine_condition_pushdown = on;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE gis_point (fid INTEGER, g POINT); CREATE TABLE gis_point (fid INTEGER, g POINT);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_line (fid INTEGER, g LINESTRING); CREATE TABLE gis_line (fid INTEGER, g LINESTRING);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_polygon (fid INTEGER, g POLYGON); CREATE TABLE gis_polygon (fid INTEGER, g POLYGON);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT); CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING); CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON); CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION); CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY); CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
SHOW CREATE TABLE gis_point; SHOW CREATE TABLE gis_point;
Table Create Table Table Create Table
gis_point CREATE TABLE `gis_point` ( gis_point CREATE TABLE `gis_point` (
...@@ -874,6 +914,8 @@ mpg multipolygon, ...@@ -874,6 +914,8 @@ mpg multipolygon,
gc geometrycollection, gc geometrycollection,
gm geometry gm geometry
); );
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
gp point YES NULL gp point YES NULL
...@@ -885,6 +927,8 @@ mpg multipolygon YES NULL ...@@ -885,6 +927,8 @@ mpg multipolygon YES NULL
gc geometrycollection YES NULL gc geometrycollection YES NULL
gm geometry YES NULL gm geometry YES NULL
ALTER TABLE t1 ADD fid INT; ALTER TABLE t1 ADD fid INT;
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
gp point YES NULL gp point YES NULL
...@@ -898,6 +942,8 @@ gm geometry YES NULL ...@@ -898,6 +942,8 @@ gm geometry YES NULL
fid int(11) YES NULL fid int(11) YES NULL
DROP TABLE t1; DROP TABLE t1;
create table t1 (a geometry not null); create table t1 (a geometry not null);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
insert into t1 values (GeomFromText('Point(1 2)')); insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage'); insert into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
...@@ -905,6 +951,8 @@ insert IGNORE into t1 values ('Garbage'); ...@@ -905,6 +951,8 @@ insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1; drop table t1;
create table t1 (fl geometry); create table t1 (fl geometry);
Warnings:
Error 1538 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
insert into t1 values (1); insert into t1 values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11); insert into t1 values (1.11);
......
...@@ -4430,29 +4430,24 @@ int ha_ndbcluster::create(const char *name, ...@@ -4430,29 +4430,24 @@ int ha_ndbcluster::create(const char *name,
Always create an event for the table, as other mysql servers Always create an event for the table, as other mysql servers
expect it to be there. expect it to be there.
*/ */
if (ndbcluster_create_event(ndb, t, event_name.c_ptr(), share) < 0) if (!ndbcluster_create_event(ndb, t, event_name.c_ptr(), share,
share && do_event_op /* push warning */))
{ {
/* this is only a serious error if the binlog is on */ if (ndb_extra_logging)
if (share && do_event_op) sql_print_information("NDB Binlog: CREATE TABLE Event: %s",
{ event_name.c_ptr());
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, if (share && do_event_op &&
ER_GET_ERRMSG, ER(ER_GET_ERRMSG), ndbcluster_create_event_ops(share, t, event_name.c_ptr()))
"Creating event for logging table failed. " {
"See error log for details."); sql_print_error("NDB Binlog: FAILED CREATE TABLE event operations."
} " Event: %s", name);
break; /* a warning has been issued to the client */
} }
if (ndb_extra_logging)
sql_print_information("NDB Binlog: CREATE TABLE Event: %s",
event_name.c_ptr());
if (share && do_event_op &&
ndbcluster_create_event_ops(share, t, event_name.c_ptr()) < 0)
{
sql_print_error("NDB Binlog: FAILED CREATE TABLE event operations."
" Event: %s", name);
/* a warning has been issued to the client */
} }
/*
warning has been issued if ndbcluster_create_event failed
and (share && do_event_op)
*/
if (share && !do_event_op) if (share && !do_event_op)
share->flags|= NSF_NO_BINLOG; share->flags|= NSF_NO_BINLOG;
ndbcluster_log_schema_op(current_thd, share, ndbcluster_log_schema_op(current_thd, share,
...@@ -4793,31 +4788,24 @@ int ha_ndbcluster::rename_table(const char *from, const char *to) ...@@ -4793,31 +4788,24 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
ndb_rep_event_name(&event_name, to + sizeof(share_prefix) - 1, 0); ndb_rep_event_name(&event_name, to + sizeof(share_prefix) - 1, 0);
const NDBTAB *ndbtab= dict->getTable(new_tabname); const NDBTAB *ndbtab= dict->getTable(new_tabname);
if (ndbcluster_create_event(ndb, ndbtab, event_name.c_ptr(), share) >= 0) if (!ndbcluster_create_event(ndb, ndbtab, event_name.c_ptr(), share,
share && ndb_binlog_running /* push warning */))
{ {
if (ndb_extra_logging) if (ndb_extra_logging)
sql_print_information("NDB Binlog: RENAME Event: %s", sql_print_information("NDB Binlog: RENAME Event: %s",
event_name.c_ptr()); event_name.c_ptr());
if (share && ndb_binlog_running) if (share && ndb_binlog_running &&
ndbcluster_create_event_ops(share, ndbtab, event_name.c_ptr()))
{ {
if (ndbcluster_create_event_ops(share, ndbtab, sql_print_error("NDB Binlog: FAILED create event operations "
event_name.c_ptr()) < 0) "during RENAME. Event %s", event_name.c_ptr());
{ /* a warning has been issued to the client */
sql_print_error("NDB Binlog: FAILED create event operations "
"during RENAME. Event %s", event_name.c_ptr());
/* a warning has been issued to the client */
}
} }
} }
else /*
{ warning has been issued if ndbcluster_create_event failed
sql_print_error("NDB Binlog: FAILED create event during RENAME. " and (share && ndb_binlog_running)
"Event: %s", event_name.c_ptr()); */
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
"Creating event for logging table failed. "
"See error log for details.");
}
if (!is_old_table_tmpfile) if (!is_old_table_tmpfile)
ndbcluster_log_schema_op(current_thd, share, ndbcluster_log_schema_op(current_thd, share,
current_thd->query, current_thd->query_length, current_thd->query, current_thd->query_length,
......
...@@ -1858,8 +1858,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, ...@@ -1858,8 +1858,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
/* /*
create the event operations for receiving logging events create the event operations for receiving logging events
*/ */
if (ndbcluster_create_event_ops(share, ndbtab, if (ndbcluster_create_event_ops(share, ndbtab, event_name.c_ptr()))
event_name.c_ptr()) < 0)
{ {
sql_print_error("NDB Binlog:" sql_print_error("NDB Binlog:"
"FAILED CREATE (DISCOVER) EVENT OPERATIONS Event: %s", "FAILED CREATE (DISCOVER) EVENT OPERATIONS Event: %s",
...@@ -1874,7 +1873,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, ...@@ -1874,7 +1873,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
int int
ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
const char *event_name, NDB_SHARE *share) const char *event_name, NDB_SHARE *share,
int push_warning)
{ {
DBUG_ENTER("ndbcluster_create_event"); DBUG_ENTER("ndbcluster_create_event");
DBUG_PRINT("info", ("table=%s version=%d event=%s share=%s", DBUG_PRINT("info", ("table=%s version=%d event=%s share=%s",
...@@ -1901,8 +1901,14 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, ...@@ -1901,8 +1901,14 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
if (share->flags & NSF_BLOB_FLAG) if (share->flags & NSF_BLOB_FLAG)
{ {
sql_print_error("NDB Binlog: logging of table %s " sql_print_error("NDB Binlog: logging of table %s "
"with no PK and blob attributes is not supported", "with BLOB attribute and no PK is not supported",
share->key); share->key);
if (push_warning)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_ILLEGAL_HA_CREATE_OPTION, ER(ER_ILLEGAL_HA_CREATE_OPTION),
ndbcluster_hton.name,
"Binlog of table with BLOB attribute and no PK");
share->flags|= NSF_NO_BINLOG; share->flags|= NSF_NO_BINLOG;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
...@@ -1935,17 +1941,16 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, ...@@ -1935,17 +1941,16 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
if (dict->createEvent(my_event)) // Add event to database if (dict->createEvent(my_event)) // Add event to database
{ {
#ifdef NDB_BINLOG_EXTRA_WARNINGS
/*
failed, print a warning
*/
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
dict->getNdbError().code,
dict->getNdbError().message, "NDB");
#endif
if (dict->getNdbError().classification != NdbError::SchemaObjectExists) if (dict->getNdbError().classification != NdbError::SchemaObjectExists)
{ {
/*
failed, print a warning
*/
if (push_warning)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
dict->getNdbError().code,
dict->getNdbError().message, "NDB");
sql_print_error("NDB Binlog: Unable to create event in database. " sql_print_error("NDB Binlog: Unable to create event in database. "
"Event: %s Error Code: %d Message: %s", event_name, "Event: %s Error Code: %d Message: %s", event_name,
dict->getNdbError().code, dict->getNdbError().message); dict->getNdbError().code, dict->getNdbError().message);
...@@ -1957,6 +1962,11 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, ...@@ -1957,6 +1962,11 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
*/ */
if (dict->dropEvent(my_event.getName())) if (dict->dropEvent(my_event.getName()))
{ {
if (push_warning)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
dict->getNdbError().code,
dict->getNdbError().message, "NDB");
sql_print_error("NDB Binlog: Unable to create event in database. " sql_print_error("NDB Binlog: Unable to create event in database. "
" Attempt to correct with drop failed. " " Attempt to correct with drop failed. "
"Event: %s Error Code: %d Message: %s", "Event: %s Error Code: %d Message: %s",
...@@ -1971,6 +1981,11 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, ...@@ -1971,6 +1981,11 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
*/ */
if (dict->createEvent(my_event)) if (dict->createEvent(my_event))
{ {
if (push_warning)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
dict->getNdbError().code,
dict->getNdbError().message, "NDB");
sql_print_error("NDB Binlog: Unable to create event in database. " sql_print_error("NDB Binlog: Unable to create event in database. "
" Attempt to correct with drop ok, but create failed. " " Attempt to correct with drop ok, but create failed. "
"Event: %s Error Code: %d Message: %s", "Event: %s Error Code: %d Message: %s",
......
...@@ -85,7 +85,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, ...@@ -85,7 +85,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
const char *table_name, const char *table_name,
my_bool share_may_exist); my_bool share_may_exist);
int ndbcluster_create_event(Ndb *ndb, const NDBTAB *table, int ndbcluster_create_event(Ndb *ndb, const NDBTAB *table,
const char *event_name, NDB_SHARE *share); const char *event_name, NDB_SHARE *share,
int push_warning= 0);
int ndbcluster_create_event_ops(NDB_SHARE *share, int ndbcluster_create_event_ops(NDB_SHARE *share,
const NDBTAB *ndbtab, const NDBTAB *ndbtab,
const char *event_name); const char *event_name);
......
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