Bug #17559 ndb_gis test failure

- test tables use blobs without PK, and was not handled correctly
parent c6211f38
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;
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);
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);
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);
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);
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);
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);
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);
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;
Table Create Table
gis_point CREATE TABLE `gis_point` (
......@@ -416,6 +432,8 @@ mpg multipolygon,
gc geometrycollection,
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;
Field Type Null Key Default Extra
gp point YES NULL
......@@ -427,6 +445,8 @@ mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
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;
Field Type Null Key Default Extra
gp point YES NULL
......@@ -440,6 +460,8 @@ gm geometry YES NULL
fid int(11) YES NULL
DROP TABLE t1;
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 ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
......@@ -447,6 +469,8 @@ insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
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);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11);
......@@ -459,13 +483,29 @@ drop table t1;
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;
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);
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);
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);
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);
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);
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);
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);
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;
Table Create Table
gis_point CREATE TABLE `gis_point` (
......@@ -874,6 +914,8 @@ mpg multipolygon,
gc geometrycollection,
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;
Field Type Null Key Default Extra
gp point YES NULL
......@@ -885,6 +927,8 @@ mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
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;
Field Type Null Key Default Extra
gp point YES NULL
......@@ -898,6 +942,8 @@ gm geometry YES NULL
fid int(11) YES NULL
DROP TABLE t1;
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 ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
......@@ -905,6 +951,8 @@ insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
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);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11);
......
......@@ -4430,29 +4430,24 @@ int ha_ndbcluster::create(const char *name,
Always create an event for the table, as other mysql servers
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 (share && do_event_op)
{
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.");
}
break;
}
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)
ndbcluster_create_event_ops(share, t, event_name.c_ptr()))
{
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)
share->flags|= NSF_NO_BINLOG;
ndbcluster_log_schema_op(current_thd, share,
......@@ -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);
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)
sql_print_information("NDB Binlog: RENAME Event: %s",
event_name.c_ptr());
if (share && ndb_binlog_running)
{
if (ndbcluster_create_event_ops(share, ndbtab,
event_name.c_ptr()) < 0)
if (share && ndb_binlog_running &&
ndbcluster_create_event_ops(share, ndbtab, event_name.c_ptr()))
{
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
{
sql_print_error("NDB Binlog: FAILED create event during RENAME. "
"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.");
}
/*
warning has been issued if ndbcluster_create_event failed
and (share && ndb_binlog_running)
*/
if (!is_old_table_tmpfile)
ndbcluster_log_schema_op(current_thd, share,
current_thd->query, current_thd->query_length,
......
......@@ -1858,8 +1858,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
/*
create the event operations for receiving logging events
*/
if (ndbcluster_create_event_ops(share, ndbtab,
event_name.c_ptr()) < 0)
if (ndbcluster_create_event_ops(share, ndbtab, event_name.c_ptr()))
{
sql_print_error("NDB Binlog:"
"FAILED CREATE (DISCOVER) EVENT OPERATIONS Event: %s",
......@@ -1874,7 +1873,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
int
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_PRINT("info", ("table=%s version=%d event=%s share=%s",
......@@ -1901,8 +1901,14 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
if (share->flags & NSF_BLOB_FLAG)
{
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);
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;
DBUG_RETURN(-1);
}
......@@ -1935,17 +1941,16 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
if (dict->createEvent(my_event)) // Add event to database
{
#ifdef NDB_BINLOG_EXTRA_WARNINGS
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");
#endif
if (dict->getNdbError().classification != NdbError::SchemaObjectExists)
{
sql_print_error("NDB Binlog: Unable to create event in database. "
"Event: %s Error Code: %d Message: %s", event_name,
dict->getNdbError().code, dict->getNdbError().message);
......@@ -1957,6 +1962,11 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
*/
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. "
" Attempt to correct with drop failed. "
"Event: %s Error Code: %d Message: %s",
......@@ -1971,6 +1981,11 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
*/
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. "
" Attempt to correct with drop ok, but create failed. "
"Event: %s Error Code: %d Message: %s",
......
......@@ -85,7 +85,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
const char *table_name,
my_bool share_may_exist);
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,
const NDBTAB *ndbtab,
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