Commit 5203bc10 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.4 into 10.5

parents 76cdc1d7 9394cc89
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -17,7 +18,7 @@
Endianness-independent definitions for architectures other
than the x86 architecture.
*/
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\
((int16) ((int16) (A)[1]) << 8))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
......@@ -27,38 +28,38 @@
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
(((int32) ((uchar) (A)[1]) << 8)) +\
(((int32) ((uchar) (A)[2]) << 16)) +\
#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) |\
(((int32) ((uchar) (A)[1]) << 8)) |\
(((int32) ((uchar) (A)[2]) << 16)) |\
(((int32) ((int16) (A)[3]) << 24)))
#define sint8korr(A) (longlong) uint8korr(A)
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\
((uint16) ((uchar) (A)[1]) << 8))
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
(((uint32) ((uchar) (A)[1])) << 8) + \
(((uint32) ((uchar) (A)[2])) << 16) + \
(((uint32) ((uchar) (A)[3])) << 24)) + \
(((ulonglong) ((uchar) (A)[4])) << 32) + \
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
(((uint32) ((uchar) (A)[1])) << 8) | \
(((uint32) ((uchar) (A)[2])) << 16) | \
(((uint32) ((uchar) (A)[3])) << 24)) | \
(((ulonglong) ((uchar) (A)[4])) << 32) | \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) (((uint32) ((uchar) (A)[4])) +\
(((uint32) ((uchar) (A)[5])) << 8) +\
(((uint32) ((uchar) (A)[6])) << 16) +\
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) (((uint32) ((uchar) (A)[4])) |\
(((uint32) ((uchar) (A)[5])) << 8) |\
(((uint32) ((uchar) (A)[6])) << 16) |\
(((uint32) ((uchar) (A)[7])) << 24))) <<\
32))
#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
......
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -27,20 +28,20 @@
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((const long *) (A)))
#define uint2korr(A) (*((const uint16 *) (A)))
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (*((const uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
(((uint32) ((uchar) (A)[1])) << 8) + \
(((uint32) ((uchar) (A)[2])) << 16) + \
(((uint32) ((uchar) (A)[3])) << 24)) + \
(((ulonglong) ((uchar) (A)[4])) << 32) + \
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
(((uint32) ((uchar) (A)[1])) << 8) | \
(((uint32) ((uchar) (A)[2])) << 16) | \
(((uint32) ((uchar) (A)[3])) << 24)) | \
(((ulonglong) ((uchar) (A)[4])) << 32) | \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) (*((const ulonglong *) (A)))
#define sint8korr(A) (*((const longlong *) (A)))
......
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -28,8 +29,8 @@
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (int32) (*((int32 *) (A)))
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
(((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
......@@ -53,7 +54,7 @@ static inline ulonglong uint6korr(const void *p)
#define int2store(T,A) do { uchar *pT= (uchar*)(T);\
*((uint16*)(pT))= (uint16) (A);\
} while (0)
#define int3store(T,A) do { *(T)= (uchar) ((A));\
*(T+1)=(uchar) (((uint) (A) >> 8));\
*(T+2)=(uchar) (((A) >> 16));\
......
......@@ -2,6 +2,7 @@
#define MYISAMPACK_INCLUDED
/* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc.
Copyright (c) 2020, MariaDB Corporation.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
......@@ -28,7 +29,7 @@
#define mi_sint1korr(A) ((int8)(*A))
#define mi_uint1korr(A) ((uint8)(*A))
#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) +\
#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) |\
((int16) ((int16) ((const char*) (A))[0]) << 8)))
#define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \
(((uint32) 255L << 24) | \
......@@ -38,58 +39,58 @@
(((uint32) ((const uchar*) (A))[0]) << 16) |\
(((uint32) ((const uchar*) (A))[1]) << 8) | \
((uint32) ((const uchar*) (A))[2])))
#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) +\
((int32) (((const uchar*) (A))[2]) << 8) +\
((int32) (((const uchar*) (A))[1]) << 16) +\
#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) |\
((int32) (((const uchar*) (A))[2]) << 8) |\
((int32) (((const uchar*) (A))[1]) << 16) |\
((int32) ((int16) ((const char*) (A))[0]) << 24)))
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) +\
#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) |\
((uint16) (((const uchar*) (A))[0]) << 8)))
#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) +\
(((uint32) (((const uchar*) (A))[1])) << 8) +\
#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) |\
(((uint32) (((const uchar*) (A))[1])) << 8) |\
(((uint32) (((const uchar*) (A))[0])) << 16)))
#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) +\
(((uint32) (((const uchar*) (A))[2])) << 8) +\
(((uint32) (((const uchar*) (A))[1])) << 16) +\
#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) |\
(((uint32) (((const uchar*) (A))[2])) << 8) |\
(((uint32) (((const uchar*) (A))[1])) << 16) |\
(((uint32) (((const uchar*) (A))[0])) << 24)))
#ifndef HAVE_mi_uint5korr
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) +\
(((uint32) (((const uchar*) (A))[3])) << 8) +\
(((uint32) (((const uchar*) (A))[2])) << 16) +\
(((uint32) (((const uchar*) (A))[1])) << 24)) +\
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) |\
(((uint32) (((const uchar*) (A))[3])) << 8) |\
(((uint32) (((const uchar*) (A))[2])) << 16) |\
(((uint32) (((const uchar*) (A))[1])) << 24)) |\
(((ulonglong) (((const uchar*) (A))[0])) << 32))
#endif /* HAVE_mi_uint5korr */
#ifndef HAVE_mi_uint6korr
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) +\
(((uint32) (((const uchar*) (A))[4])) << 8) +\
(((uint32) (((const uchar*) (A))[3])) << 16) +\
(((uint32) (((const uchar*) (A))[2])) << 24)) +\
(((ulonglong) (((uint32) (((const uchar*) (A))[1])) +\
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) |\
(((uint32) (((const uchar*) (A))[4])) << 8) |\
(((uint32) (((const uchar*) (A))[3])) << 16) |\
(((uint32) (((const uchar*) (A))[2])) << 24)) |\
(((ulonglong) (((uint32) (((const uchar*) (A))[1])) |\
(((uint32) (((const uchar*) (A))[0]) << 8)))) <<\
32))
#endif /* HAVE_mi_uint6korr */
#ifndef HAVE_mi_uint7korr
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) +\
(((uint32) (((const uchar*) (A))[5])) << 8) +\
(((uint32) (((const uchar*) (A))[4])) << 16) +\
(((uint32) (((const uchar*) (A))[3])) << 24)) +\
(((ulonglong) (((uint32) (((const uchar*) (A))[2])) +\
(((uint32) (((const uchar*) (A))[1])) << 8) +\
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) |\
(((uint32) (((const uchar*) (A))[5])) << 8) |\
(((uint32) (((const uchar*) (A))[4])) << 16) |\
(((uint32) (((const uchar*) (A))[3])) << 24)) |\
(((ulonglong) (((uint32) (((const uchar*) (A))[2])) |\
(((uint32) (((const uchar*) (A))[1])) << 8) |\
(((uint32) (((const uchar*) (A))[0])) << 16))) <<\
32))
#endif /* HAVE_mi_uint7korr */
#ifndef HAVE_mi_uint8korr
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) +\
(((uint32) (((const uchar*) (A))[6])) << 8) +\
(((uint32) (((const uchar*) (A))[5])) << 16) +\
(((uint32) (((const uchar*) (A))[4])) << 24)) +\
(((ulonglong) (((uint32) (((const uchar*) (A))[3])) +\
(((uint32) (((const uchar*) (A))[2])) << 8) +\
(((uint32) (((const uchar*) (A))[1])) << 16) +\
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) |\
(((uint32) (((const uchar*) (A))[6])) << 8) |\
(((uint32) (((const uchar*) (A))[5])) << 16) |\
(((uint32) (((const uchar*) (A))[4])) << 24)) |\
(((ulonglong) (((uint32) (((const uchar*) (A))[3])) |\
(((uint32) (((const uchar*) (A))[2])) << 8) |\
(((uint32) (((const uchar*) (A))[1])) << 16) |\
(((uint32) (((const uchar*) (A))[0])) << 24))) <<\
32))
#endif /* HAVE_mi_uint8korr */
......
Subproject commit 3be5897c3346639fa6d7195480d93108798c4917
Subproject commit 1768cb6c322d403c1e372b368cc3c23b660b7930
......@@ -967,6 +967,54 @@ STDDEV_SAMP(a)
NULL
DROP TABLE t1;
#
# MDEV-21977 main.func_math fails due to undefined behaviour
#
SELECT 9223372036854775808 DIV 1;
9223372036854775808 DIV 1
9223372036854775808
SELECT 9223372036854775808 DIV -1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 DIV -1'
SELECT -9223372036854775808 DIV 1;
ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV 1'
SELECT -9223372036854775808 DIV -1;
ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1'
SELECT 9223372036854775808 MOD 1;
9223372036854775808 MOD 1
0
SELECT 9223372036854775808 MOD -1;
9223372036854775808 MOD -1
0
SELECT -9223372036854775808 MOD 1;
-9223372036854775808 MOD 1
0
SELECT -9223372036854775808 MOD -1;
-9223372036854775808 MOD -1
0
SELECT 1 MOD 9223372036854775808;
1 MOD 9223372036854775808
1
SELECT -1 MOD 9223372036854775808;
-1 MOD 9223372036854775808
-1
SELECT 1 MOD -9223372036854775808;
1 MOD -9223372036854775808
1
SELECT -1 MOD -9223372036854775808;
-1 MOD -9223372036854775808
-1
SELECT 9223372036854775808 MOD 9223372036854775808;
9223372036854775808 MOD 9223372036854775808
0
SELECT 9223372036854775808 MOD -9223372036854775808;
9223372036854775808 MOD -9223372036854775808
0
SELECT -9223372036854775808 MOD 9223372036854775808;
-9223372036854775808 MOD 9223372036854775808
0
SELECT -9223372036854775808 MOD -9223372036854775808;
-9223372036854775808 MOD -9223372036854775808
0
#
# End of 10.1 tests
#
#
......
......@@ -688,6 +688,35 @@ INSERT INTO t1 VALUES (0);
SELECT STDDEV_SAMP(a) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-21977 main.func_math fails due to undefined behaviour
--echo #
SELECT 9223372036854775808 DIV 1;
--error ER_DATA_OUT_OF_RANGE
SELECT 9223372036854775808 DIV -1;
--error ER_DATA_OUT_OF_RANGE
SELECT -9223372036854775808 DIV 1;
--error ER_DATA_OUT_OF_RANGE
SELECT -9223372036854775808 DIV -1;
SELECT 9223372036854775808 MOD 1;
SELECT 9223372036854775808 MOD -1;
SELECT -9223372036854775808 MOD 1;
SELECT -9223372036854775808 MOD -1;
SELECT 1 MOD 9223372036854775808;
SELECT -1 MOD 9223372036854775808;
SELECT 1 MOD -9223372036854775808;
SELECT -1 MOD -9223372036854775808;
SELECT 9223372036854775808 MOD 9223372036854775808;
SELECT 9223372036854775808 MOD -9223372036854775808;
SELECT -9223372036854775808 MOD 9223372036854775808;
SELECT -9223372036854775808 MOD -9223372036854775808;
--echo #
--echo # End of 10.1 tests
--echo #
......
......@@ -1577,13 +1577,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
DROP TABLE t1;
......
......@@ -964,10 +964,10 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
DROP TABLE t1;
......
......@@ -1683,7 +1683,7 @@ NULL
#
create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1
ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1
drop table t1;
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
......@@ -5028,13 +5028,13 @@ ERROR HY000: Illegal parameter data types int and point for operation 'in'
CREATE TABLE t1 (a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (Point(0,0));
ALTER TABLE t1 MODIFY a LINESTRING;
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column `test`.`t1`.`a` at row 1
ERROR 22007: Incorrect LINESTRING value: 'POINT(0 0)' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a LINESTRING);
CREATE TABLE t2 (a POINT);
INSERT INTO t2 VALUES (POINT(0,0));
INSERT INTO t1 SELECT * FROM t2;
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column `test`.`t1`.`a` at row 1
ERROR 22007: Incorrect LINESTRING value: 'POINT(0 0)' for column `test`.`t1`.`a` at row 1
SELECT AsText(a) FROM t1;
AsText(a)
DROP TABLE t1, t2;
......
......@@ -2,7 +2,7 @@
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates.
# Copyright (c) 2009, 2018, MariaDB Corporation
# Copyright (c) 2009, 2020, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -626,7 +626,8 @@ sub main {
else
{
my $sys_info= My::SysInfo->new();
$opt_parallel= $sys_info->num_cpus();
$opt_parallel= $sys_info->num_cpus() +
int($sys_info->min_bogomips()/500) - 4;
for my $limit (2000, 1500, 1000, 500){
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
}
......
connection node_2;
connection node_1;
Test phase 1 to make sure that natral deadlock in trigger SP execution is
handled correctly
CREATE TABLE t1(a INT);
CREATE TABLE t2(f1 INT, f2 INT, f3 INT);
CREATE PROCEDURE proc()
BEGIN
INSERT INTO t2 VALUES(100, 200, 300);
UPDATE t2 SET f3 = f3 + 100;
END|
CREATE TRIGGER t1 BEFORE INSERT ON t1 FOR EACH ROW CALL proc();
INSERT INTO t1 VALUES(2);;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
INSERT INTO t1 VALUES(1);;
connection node_1;
connection node_1a;
connection node_1;
wsrep__bf_aborts
0
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE proc;
Test phase 2 to make sure that BF abort for SP execution is
handled correctly
connection node_1;
SET SESSION wsrep_retry_autocommit = 0;
SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
connection node_1a;
SET SESSION wsrep_retry_autocommit = 0;
SET SESSION wsrep_sync_wait = 0;
CREATE PROCEDURE proc_update()
BEGIN
UPDATE t1 SET f2 = 'b';
END|
INSERT INTO t1 VALUES(1, 'a');
connection node_1;
SET debug_sync='wsrep_before_certification SIGNAL ready WAIT_FOR cont';
CALL proc_update;
connection node_1a;
SET debug_sync='now WAIT_FOR ready';
connection node_2;
UPDATE t1 SET f2='c';
connection node_1a;
SET debug_sync='now SIGNAL cont';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1a;
SET debug_sync='RESET';
DROP PROCEDURE proc_update;
connection node_1;
Test phase 3 to make sure natural deadlock is not treated as BF abort
TRUNCATE t1;
INSERT INTO t1 VALUES (1, 'a'), (2, 'a');
connection node_1a;
START TRANSACTION;
UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
connection node_1;
START TRANSACTION;
UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
connection node_1a;
UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
connection node_1;
UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
connection node_1a;
COMMIT;
wsrep__bf_aborts
0
connection node_1;
ROLLBACK;
Test phase 4 to make sure natural deadlock inside SP execution
is not treated as BF abort
connection node_1a;
TRUNCATE t1;
INSERT INTO t1 VALUES (1, 'a'), (2, 'a');
CREATE PROCEDURE proc_update_1()
BEGIN
START TRANSACTION;
UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
SELECT SLEEP(5);
UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
COMMIT;
END|
CREATE PROCEDURE proc_update_2()
BEGIN
START TRANSACTION;
UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
SELECT SLEEP(5);
UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
COMMIT;
END|
connection node_1;
CALL proc_update_1;
connection node_1a;
CALL proc_update_2;
SLEEP(5)
0
wsrep__bf_aborts
0
connection node_1;
SLEEP(5)
0
DROP PROCEDURE proc_update_1;
DROP PROCEDURE proc_update_2;
DROP TABLE t1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
START TRANSACTION;
INSERT INTO t1 (f2) VALUES ('a'), ('b');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
COMMIT;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
START TRANSACTION;
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (2, 'b');
INSERT INTO t1 (f2) VALUES ('c'), ('d');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
COMMIT;
expect (1,'a'), (2, 'b')
SELECT * FROM t1;
f1 f2
1 a
2 b
connection node_2;
expect (1,'a'), (2, 'b')
SELECT * FROM t1;
f1 f2
1 a
2 b
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
INSERT INTO t1 (f2) VALUES ('a'),('b');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
DROP TABLE t1;
connection node_1;
CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
INSERT INTO p VALUES(1, 0);
START TRANSACTION;
INSERT INTO c VALUES (3,1);
INSERT INTO c VALUES (1,1), (2,2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`c`, CONSTRAINT `c_ibfk_1` FOREIGN KEY (`fk1`) REFERENCES `p` (`id`))
COMMIT;
SELECT * FROM p;
id j
1 0
SELECT * FROM c;
id fk1
3 1
connection node_2;
SELECT * FROM p;
id j
1 0
SELECT * FROM c;
id fk1
3 1
DROP TABLE c;
DROP TABLE p;
......@@ -41,6 +41,8 @@ SET DEBUG_SYNC = 'RESET';
SET GLOBAL wsrep_slave_threads = 1;
# Trigger should now be dropped on node_2.
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME like '%tr1'
--source include/wait_condition.inc
SHOW TRIGGERS;
DROP TABLE t1;
......
#
# Test different deadlock scenarios in innodb and make sure that
# wsrep patch does not handle them as BF aborts.
#
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
##############################################################################
# test case to verify that natural deadlock of trigger SP execution is
# handled correctly
##############################################################################
--echo
--echo Test phase 1 to make sure that natral deadlock in trigger SP execution is
--echo handled correctly
--echo
--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
CREATE TABLE t1(a INT);
CREATE TABLE t2(f1 INT, f2 INT, f3 INT);
--disable_query_log
let $run=1000;
while($run)
{
INSERT INTO t2 VALUES (1, 2, 3);
dec $run;
}
--enable_query_log
DELIMITER |;
CREATE PROCEDURE proc()
BEGIN
INSERT INTO t2 VALUES(100, 200, 300);
UPDATE t2 SET f3 = f3 + 100;
END|
DELIMITER ;|
CREATE TRIGGER t1 BEFORE INSERT ON t1 FOR EACH ROW CALL proc();
--send INSERT INTO t1 VALUES(2);
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--send INSERT INTO t1 VALUES(1);
--connection node_1
--error 0,ER_LOCK_DEADLOCK
--reap
--connection node_1a
--error 0,ER_LOCK_DEADLOCK
--reap
--connection node_1
--let $aborts_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
--disable_query_log
--eval SELECT $aborts_new - $aborts_old AS wsrep__bf_aborts;
--enable_query_log
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE proc;
##############################################################################
#
# test case to verify that BF abort for SP execution is handled correctly
#
##############################################################################
--echo
--echo Test phase 2 to make sure that BF abort for SP execution is
--echo handled correctly
--echo
--connection node_1
SET SESSION wsrep_retry_autocommit = 0;
SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
# Control connection for Galera sync point management
--connection node_1a
SET SESSION wsrep_retry_autocommit = 0;
SET SESSION wsrep_sync_wait = 0;
--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
DELIMITER |;
CREATE PROCEDURE proc_update()
BEGIN
UPDATE t1 SET f2 = 'b';
END|
DELIMITER ;|
INSERT INTO t1 VALUES(1, 'a');
--connection node_1
SET debug_sync='wsrep_before_certification SIGNAL ready WAIT_FOR cont';
--send CALL proc_update
--connection node_1a
SET debug_sync='now WAIT_FOR ready';
--connection node_2
UPDATE t1 SET f2='c';
--connection node_1a
# wait for BF to happen
--let $wait_condition = SELECT VARIABLE_VALUE = $aborts_old + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'
--source include/wait_condition.inc
SET debug_sync='now SIGNAL cont';
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
--connection node_1a
SET debug_sync='RESET';
DROP PROCEDURE proc_update;
##############################################################################
#
# test case to verify that natural deadlock does not cause BF abort
#
##############################################################################
--connection node_1
--echo
--echo Test phase 3 to make sure natural deadlock is not treated as BF abort
--echo
TRUNCATE t1;
INSERT INTO t1 VALUES (1, 'a'), (2, 'a');
--connection node_1a
--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
START TRANSACTION;
UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
--connection node_1
START TRANSACTION;
UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
--connection node_1a
# this hangs for lock wait
--send UPDATE t1 SET f2 = 'b' WHERE f1 = 2
#
# classic deadlock happens here
#
--connection node_1
--error 0, ER_LOCK_DEADLOCK
UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
--connection node_1a
--error 0, ER_LOCK_DEADLOCK
--reap
COMMIT;
#
# either one of SP executions was aborted because of natural deadlock, or in worst case
# they were ordered seqeuntailly, and both succeeded.
# anyways, we just check here that no BF aborts happened
#
--let $aborts_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
--disable_query_log
--eval SELECT $aborts_new - $aborts_old AS wsrep__bf_aborts;
--enable_query_log
--connection node_1
ROLLBACK;
##############################################################################
#
# test case to verify that natural deadlock within SP exceution
# does not cause BF abort
#
##############################################################################
--echo
--echo Test phase 4 to make sure natural deadlock inside SP execution
--echo is not treated as BF abort
--echo
--connection node_1a
TRUNCATE t1;
INSERT INTO t1 VALUES (1, 'a'), (2, 'a');
--let $aborts_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
DELIMITER |;
CREATE PROCEDURE proc_update_1()
BEGIN
START TRANSACTION;
UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
SELECT SLEEP(5);
UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
COMMIT;
END|
DELIMITER ;|
DELIMITER |;
CREATE PROCEDURE proc_update_2()
BEGIN
START TRANSACTION;
UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
SELECT SLEEP(5);
UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
COMMIT;
END|
DELIMITER ;|
--connection node_1
--send CALL proc_update_1
--connection node_1a
#
# calling proc_update_2 should cause a natural deadlock
# however, this test is not deterministic, and depends on the sleep() to
# cause expected ordering for update statement execution within SPs
# We therefore, allow both success and deadlock error for the result
#
--error 0, ER_LOCK_DEADLOCK
CALL proc_update_2;
#
# either one of SP executions was aborted because of natural deadlock, or in worst case
# they were ordered seqeuntailly, and both succeeded.
# anyways, we just check here that no BF aborts happened
#
--let $aborts_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
--disable_query_log
--eval SELECT $aborts_new - $aborts_old AS wsrep__bf_aborts;
--enable_query_log
--connection node_1
--error 0, ER_LOCK_DEADLOCK
--reap
DROP PROCEDURE proc_update_1;
DROP PROCEDURE proc_update_2;
DROP TABLE t1;
#
# Test multirow insert rollback
#
--source include/galera_cluster.inc
#
# Case 1: error on multirow insert results in empty transaction
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
START TRANSACTION;
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('a'), ('b');
COMMIT;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
#
# Case 2: error on multirow insert does not affect previous statements
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
START TRANSACTION;
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (2, 'b');
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('c'), ('d');
COMMIT;
--echo expect (1,'a'), (2, 'b')
SELECT * FROM t1;
--connection node_2
--echo expect (1,'a'), (2, 'b')
SELECT * FROM t1;
DROP TABLE t1;
#
# Case 3: error on autocommit multirow insert
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('a'),('b');
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
#
# Case 4: FK constraint violation on multirow insert
#
--connection node_1
CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
INSERT INTO p VALUES(1, 0);
START TRANSACTION;
INSERT INTO c VALUES (3,1);
--error ER_NO_REFERENCED_ROW_2
INSERT INTO c VALUES (1,1), (2,2);
COMMIT;
SELECT * FROM p;
SELECT * FROM c;
--connection node_2
SELECT * FROM p;
SELECT * FROM c;
DROP TABLE c;
DROP TABLE p;
......@@ -86,6 +86,8 @@ connection node_1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
connection node_2;
connection node_3;
connection node_2;
connection node_3;
SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
expect_3
3
......
......@@ -42,6 +42,10 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0");
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed.");
CALL mtr.add_suppression("Failed to initialize plugins.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()");
connection node_3;
CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible");
CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node");
......@@ -51,6 +55,10 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0");
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed.");
CALL mtr.add_suppression("Failed to initialize plugins.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()");
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
......@@ -88,6 +88,15 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
--source include/wait_condition.inc
--source include/galera_wait_ready.inc
# wait until nodes 2 and 3 have declared ready state (can happen after cluster_size raaise)
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
--source include/wait_condition.inc
--connection node_3
--source include/wait_condition.inc
# On all nodes, we now expect a Primary component of size 3, weight 3, Synced and ready
SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight';
......
......@@ -179,6 +179,10 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0");
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed.");
CALL mtr.add_suppression("Failed to initialize plugins.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()");
--connection node_3
CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible");
......@@ -189,6 +193,11 @@ CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0");
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node");
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed.");
CALL mtr.add_suppression("Failed to initialize plugins.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()");
SHOW CREATE TABLE t1;
DROP TABLE t1;
......
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
SET SESSION wsrep_trx_fragment_size = 1;
START TRANSACTION;
INSERT INTO t1 (f2) VALUES ('a'), ('b');
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
SET SESSION wsrep_trx_fragment_size = 1000;
START TRANSACTION;
INSERT INTO t1 (f2) VALUES ('a'), ('b');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
COMMIT;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
SET SESSION wsrep_trx_fragment_size = 1000;
START TRANSACTION;
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (2, 'b');
INSERT INTO t1 (f2) VALUES ('c'), ('d');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
COMMIT;
expect (1,'a'), (2, 'b')
SELECT * FROM t1;
f1 f2
1 a
2 b
connection node_2;
expect (1,'a'), (2, 'b')
SELECT * FROM t1;
f1 f2
1 a
2 b
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
connection node_1;
SET SESSION wsrep_trx_fragment_size = 1;
INSERT INTO t1 (f2) VALUES ('a'), ('b');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_1;
SET SESSION wsrep_trx_fragment_size = 1000;
INSERT INTO t1 (f2) VALUES ('a'), ('b');
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
DROP TABLE t1;
connection node_1;
CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
INSERT INTO p VALUES(1, 0);
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO c VALUES (3,1);
INSERT INTO c VALUES (1,1), (2,2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
SELECT * FROM p;
id j
1 0
SELECT * FROM c;
id fk1
connection node_2;
SELECT * FROM p;
id j
1 0
SELECT * FROM c;
id fk1
DROP TABLE c;
DROP TABLE p;
connection node_1;
CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
INSERT INTO p VALUES(1, 0);
SET SESSION wsrep_trx_fragment_size=1000;
START TRANSACTION;
INSERT INTO c VALUES (3,1);
INSERT INTO c VALUES (1,1), (2,2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`c`, CONSTRAINT `c_ibfk_1` FOREIGN KEY (`fk1`) REFERENCES `p` (`id`))
COMMIT;
SELECT * FROM p;
id j
1 0
SELECT * FROM c;
id fk1
3 1
connection node_2;
SELECT * FROM p;
id j
1 0
SELECT * FROM c;
id fk1
3 1
DROP TABLE c;
DROP TABLE p;
#
# Test multirow insert rollback with streaming replication
#
--source include/galera_cluster.inc
#
# Case 1: multirow insert results full rollback if a fragment
# managed to replicate
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
SET SESSION wsrep_trx_fragment_size = 1;
START TRANSACTION;
# With fragment size 1 we expect full rollback
# because a fragment is already replicated.
# Therefore, expect ER_LOCK_DEADLOCK instead of ER_DUP_ENTRY
--error ER_LOCK_DEADLOCK
INSERT INTO t1 (f2) VALUES ('a'), ('b');
COMMIT;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
#
# Case 2: error on multirow insert results in empty commit
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
SET SESSION wsrep_trx_fragment_size = 1000;
START TRANSACTION;
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('a'), ('b');
COMMIT;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
#
# Case 3: error on multirow insert does not affect previous statements
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
SET SESSION wsrep_trx_fragment_size = 1000;
START TRANSACTION;
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (2, 'b');
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('c'), ('d');
COMMIT;
--echo expect (1,'a'), (2, 'b')
SELECT * FROM t1;
--connection node_2
--echo expect (1,'a'), (2, 'b')
SELECT * FROM t1;
DROP TABLE t1;
#
# Case 4: error on autocommit multirow insert
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
--connection node_1
SET SESSION wsrep_trx_fragment_size = 1;
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('a'), ('b');
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_1
SET SESSION wsrep_trx_fragment_size = 1000;
--error ER_DUP_ENTRY
INSERT INTO t1 (f2) VALUES ('a'), ('b');
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
#
# Case 5: FK constraint violation on multirow insert results
# full rollback if a fragment has already replicated
#
--connection node_1
CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
INSERT INTO p VALUES(1, 0);
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO c VALUES (3,1);
--error ER_LOCK_DEADLOCK
INSERT INTO c VALUES (1,1), (2,2);
COMMIT;
SELECT * FROM p;
SELECT * FROM c;
--connection node_2
SELECT * FROM p;
SELECT * FROM c;
DROP TABLE c;
DROP TABLE p;
#
# Case 6: FK constraint violation on multirow insert results
# stmt rollback if no fragments have replicated
#
--connection node_1
CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
INSERT INTO p VALUES(1, 0);
SET SESSION wsrep_trx_fragment_size=1000;
START TRANSACTION;
INSERT INTO c VALUES (3,1);
--error ER_NO_REFERENCED_ROW_2
INSERT INTO c VALUES (1,1), (2,2);
COMMIT;
SELECT * FROM p;
SELECT * FROM c;
--connection node_2
SELECT * FROM p;
SELECT * FROM c;
DROP TABLE c;
DROP TABLE p;
......@@ -36,7 +36,9 @@ ALTER TABLE t DISCARD TABLESPACE;
Warnings:
Warning 1812 Tablespace is missing for table 'test/t'
Warning 1812 Tablespace is missing for table 'test/t'
DROP TABLE t;
RENAME TABLE t TO u;
RENAME TABLE u TO v;
DROP TABLE v;
SELECT * FROM `x..d`;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
DROP TABLE `x..d`;
......
......@@ -42,7 +42,7 @@ drop table t1;
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column ``.``.`b` at row 1
ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
a int(11) YES NULL
......
DROP TABLE if exists t1;
select @@global.innodb_stats_persistent;
@@global.innodb_stats_persistent
0
SET @n_pages= @@GLOBAL.innodb_defragment_n_pages;
SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy;
SET @sp= @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
set global innodb_defragment_stats_accuracy = 80;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
b VARCHAR(256),
......@@ -18,6 +18,14 @@ connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con4,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connection default;
SET @@global.innodb_defragment_n_pages = 20;
CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO tt SELECT 0 FROM seq_1_to_180;
INSERT INTO tt SELECT 5 FROM seq_1_to_160;
INSERT INTO tt SELECT 1 FROM seq_1_to_1000;
OPTIMIZE TABLE tt;
Table Op Msg_type Msg_text
test.tt optimize note Table does not support optimize, doing recreate + analyze instead
test.tt optimize status OK
select count(*) from t1;
count(*)
20000
......@@ -89,3 +97,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like
count(stat_value) > 0
1
drop table t1;
SET GLOBAL innodb_defragment_n_pages = @n_pages;
SET GLOBAL innodb_defragment_stats_accuracy = @accuracy;
SET GLOBAL innodb_stats_persistent = @sp;
......@@ -59,7 +59,9 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
--error ER_PARSE_ERROR
ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE;
ALTER TABLE t DISCARD TABLESPACE;
DROP TABLE t;
RENAME TABLE t TO u;
RENAME TABLE u TO v;
DROP TABLE v;
--error ER_GET_ERRNO
SELECT * FROM `x..d`;
DROP TABLE `x..d`;
......
......@@ -2,9 +2,10 @@
--source include/not_embedded.inc
-- source include/have_innodb.inc
-- source include/have_sequence.inc
-- source include/innodb_checksum_algorithm.inc
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
FLUSH TABLES;
......@@ -19,17 +20,14 @@ CREATE TABLE t1
KEY (b))
ENGINE = InnoDB;
insert into t1 (b, c) values ('Apa', 'Filler........'),
CREATE TEMPORARY TABLE t (b char(22),c varchar(255));
INSERT INTO t VALUES
('Apa', 'Filler........'),
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128;
DROP TEMPORARY TABLE t;
SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
......@@ -119,16 +117,11 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
......@@ -170,15 +163,10 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
......@@ -189,9 +177,6 @@ UNLOCK TABLES;
--list_files $MYSQLD_DATADIR/test
# Move the LSN forward
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
......@@ -224,14 +209,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
......@@ -240,9 +220,6 @@ EOF
UNLOCK TABLES;
# Move the LSN forward
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
......@@ -275,14 +252,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
......@@ -290,9 +262,6 @@ EOF
UNLOCK TABLES;
# Move the LSN forward
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
......@@ -345,14 +314,7 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
SELECT COUNT(*) FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
# This should fail, InnoDB should return a warning
......@@ -372,15 +334,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
......@@ -507,15 +463,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
......@@ -660,15 +610,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
......@@ -814,15 +758,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
......@@ -968,15 +906,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
......@@ -1141,9 +1073,8 @@ SELECT * FROM t1;
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
FLUSH TABLES;
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
......
......@@ -2,17 +2,13 @@
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--source include/have_sequence.inc
--disable_warnings
DROP TABLE if exists t1;
--enable_warnings
SET @n_pages= @@GLOBAL.innodb_defragment_n_pages;
SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy;
SET @sp= @@GLOBAL.innodb_stats_persistent;
--disable_query_log
let $innodb_defragment_n_pages_orig=`select @@innodb_defragment_n_pages`;
let $innodb_defragment_stats_accuracy_orig=`select @@innodb_defragment_stats_accuracy`;
--enable_query_log
select @@global.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
set global innodb_defragment_stats_accuracy = 80;
# Create table.
......@@ -46,6 +42,12 @@ connection default;
SET @@global.innodb_defragment_n_pages = 20;
CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO tt SELECT 0 FROM seq_1_to_180;
INSERT INTO tt SELECT 5 FROM seq_1_to_160;
INSERT INTO tt SELECT 1 FROM seq_1_to_1000;
OPTIMIZE TABLE tt;
let $data_size = 20000;
let $delete_size = 2000;
......@@ -60,7 +62,7 @@ while ($i)
}
--enable_query_log
select count(*) from t1;
select count(*) from t1;
select count(*) from t1 force index (second);
select count(*) from t1 force index (third);
......@@ -75,7 +77,7 @@ while ($size)
}
--enable_query_log
select count(*) from t1;
select count(*) from t1;
select count(*) from t1 force index (second);
select count(*) from t1 force index (third);
......@@ -136,7 +138,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like
drop table t1;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig;
EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig;
--enable_query_log
SET GLOBAL innodb_defragment_n_pages = @n_pages;
SET GLOBAL innodb_defragment_stats_accuracy = @accuracy;
SET GLOBAL innodb_stats_persistent = @sp;
......@@ -100,17 +100,17 @@ INSERT INTO t1(title) VALUES('mysql');
ERROR HY000: Lost connection to MySQL server during query
# restart
After restart
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
FTS_DOC_ID title
1 database
SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
title
database
SET @old_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
INSERT INTO t1(title) VALUES('mysql');
SET debug_dbug = @old_dbug;
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
FTS_DOC_ID title
1 database
2 mysql
SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
title
database
mysql
DROP TABLE t1;
# Case 4: Test sync commit & rollback in background
CREATE TABLE t1(
......
......@@ -123,7 +123,9 @@ INSERT INTO t1(title) VALUES('mysql');
--source include/start_mysqld.inc
-- echo After restart
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
# PAGE_ROOT_AUTO_INC could contain last failed autoinc value. Avoid
# doing show the result of auto increment field
SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
SET @old_dbug = @@SESSION.debug_dbug;
......@@ -133,7 +135,7 @@ INSERT INTO t1(title) VALUES('mysql');
SET debug_dbug = @old_dbug;
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
DROP TABLE t1;
......
......@@ -10,9 +10,3 @@
#
##############################################################################
gis_split_inf : MDEV-14057 InnoDB GIS tests fail
rtree_multi_pk : MDEV-14057 InnoDB GIS tests fail
point_big : MDEV-14057 InnoDB GIS tests fail
geometry : MDEV-14057 InnoDB GIS tests fail
bug16236208 : MDEV-14057 InnoDB GIS tests fail
bug16266012 : MDEV-14057 InnoDB GIS tests fail
......@@ -1040,9 +1040,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
SET @a=ST_POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=InnoDB;
insert into t1 values (ST_geomfromtext("point(0 1)"));
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1
insert into t1 values (ST_geomfromtext("point(1 0)"));
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
drop table t1;
......
......@@ -485,7 +485,7 @@ ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c3 POLYGON NOT NULL;
ERROR 22007: Incorrect POLYGON value: 'LINESTRING' for column `test`.`tab`.`c3` at row 1
ERROR 22007: Incorrect POLYGON value: 'LINESTRING(5 5,20 20,30 30)' for column `test`.`tab`.`c3` at row 1
ALTER TABLE tab add COLUMN c7 POINT NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
......@@ -790,13 +790,13 @@ DROP TABLE t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
insert into t1 values(default);
ERROR 22007: Incorrect POINT value: 'LINESTRING' for column `test`.`t1`.`p` at row 1
ERROR 22007: Incorrect POINT value: 'LINESTRING(0 0,1 1)' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
alter table t1 add column i int;
ERROR 22007: Incorrect POINT value: 'LINESTRING' for column `test`.`t1`.`p` at row 1
ERROR 22007: Incorrect POINT value: 'LINESTRING(0 0,1 1)' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
......
......@@ -39,5 +39,5 @@ ST_WITHIN( ST_GeomFromText('POLYGON( ( 4135 3009 , 4914 3087 , 4236 3194 , 4091
ST_GeomFromText('MULTILINESTRING( ( 4147 2871 , 4072 3042 , 4081 3099 , 3796
3021 , 4007 3463 ) , ( 4042 2808 , 4109 2816 , 3730 3673 ) )') ,
linestring_key ) AND ST_Length( linestring_nokey ) > 1;
ERROR 22023: Invalid GIS data provided to function st_within.
ST_AsText(linestring_nokey)
DROP TABLE linestring;
......@@ -6,4 +6,9 @@ MULTIPOLYGON( ( ( 0 0 , 7 1 , 6 8 , 0 0 ) ) , ( ( 9 9 , 4 0 , 4 7 , 9 9) ) )
') ) , ST_SYMDIFFERENCE( POLYGONFROMTEXT(' POLYGON( ( 9 9 , 6 5 , 2 3 , 9 9
) ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( ( 2 2 , 5 2 , 5 2 , 2 6 , 2
2 ) ) , ( ( 7 7 , 3 7 , 2 9 , 7 1 , 7 7 ) ) ) ') ) ) );
ERROR HY000: Geometry overlay calculation error: geometry data is invalid in function st_union.
ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4
4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT('
POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) ,
MULTIPOLYGONFROMTEXT('
MULTIPOLYGON( ( ( 0 0 , 7 1 , 6
0
......@@ -1036,9 +1036,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
SET @a=ST_POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=innodb;
insert into t1 values (ST_geomfromtext("point(0 1)"));
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1
insert into t1 values (ST_geomfromtext("point(1 0)"));
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
drop table t1;
......
create table t1(a geometrycollection not null,spatial key(a))engine=innodb;
insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-14,98), point(-14,98)), linestring(point(-97,64), point(-70,99), point(-97,64)), linestring(point(143851215403059150000000000000000000000.000000,13040009882500140000000000000000000000.000000), point(-73,85), point(-88,-29)))), multipolygon(polygon(linestring(point(41,95), point(4294967298,2050)), linestring(point(-61,85), point(-75,93), point(14,-2), point(1,84), point(-61,85)), linestring(point(-62,52), point(39,5), point(-18,12), point(-62,52))), polygon(linestring(point(-77,1), point(66,61), point(-77,1)), linestring(point(18446744073709551615,1125899906842622), point(-72,49), point(24,-66), point(82,73), point(68,22))), polygon(linestring(point(1048576,17179869181), point(-18,95), point(-90,-3), point(-33,82), point(20,-85)), linestring(point(-43,-97), point(-7,-3), point(39,-82), point(-65,-58), point(-43,-97)), linestring(point(44,-34), point(-69,58), point(44,-34)), linestring(point(57,-13), point(-17,74), point(57,-13)), linestring(point(3,71), point(-58,81), point(3,71)), linestring(point(9,25), point(77,-71), point(8388607,67108864), point(46,46), point(9,25)), linestring(point(98,-82), point(98,-82))))) ) ;
ERROR 22023: Invalid GIS data provided to function polygon.
Got one of the listed errors
insert into t1(a) values( geometrycollection(multilinestring(linestring(point(39,-60), point(-62,-11), point(-24,35), point(54,1)), linestring(point(-4,69), point(-22,-64), point(1.694824e+308,5.688896e+307), point(-33,-58), point(-64,-80), point(-15,-44), point(40,54)), linestring(point(-86,-54), point(11,41), point(-46,-38), point(-21,-8), point(10,70), point(-81,22), point(-46,-100)), linestring(point(-30,-48), point(50,58), point(-53,92), point(10,41), point(-46,-8)), linestring(point(-65,34), point(-92,93), point(-33,-74), point(75,-28)), linestring(point(25,-55), point(22,-10), point(-42,0), point(-86,-59), point(2,-37), point(63,-44), point(-55,-22)), linestring(point(28,0), point(-94,99), point(-32,-86)), linestring(point(9,-12), point(16,9), point(80,-73)), linestring(point(6,-55), point(83,-4)), linestring(point(-15,21), point(144115188075855876,16777212), point(-85,-31), point(-90,-50)), linestring(point(-33,33), point(21,90), point(-89,32)), linestring(point(16,24), point(73,-13), point(25,-48), point(71,52), point(-54,-78), point(-84,59), point(53,29)), linestring(point(-15,-81), point(83,43), point(-71,33), point(-8,0), point(84,-54), point(-35,38), point(-10,-50)), linestring(point(38,-50), point(20,-2), point(-57,-92)), linestring(point(5,-93), point(231601833467477080000000000000000000000.000000,51914987457169239000000000000000000000.000000), point(-94,62))), point(2,0)) ) ;
insert into t1(a) values( geometrycollection(multilinestring(linestring(point(80,-15), point(65,-57), point(-59,16), point(22,-67)), linestring(point(20,-55), point(-38,-64), point(19,-53), point(-63,-36), point(56,-37)), linestring(point(27,-8), point(-85,-75), point(4398046511106,2251799813685245)), linestring(point(45,32), point(-79,46))), multilinestring(linestring(point(8,-4), point(40,-38), point(100,95), point(5,-80), point(82,88)), linestring(point(-14,30), point(-94,51), point(-16,-29), point(37,-97), point(-26,92)), linestring(point(32,34), point(83,-23), point(-55,57), point(-15,90), point(32,-50), point(-20,-73), point(77,28)), linestring(point(4,88), point(87,74), point(-67,-58)), linestring(point(5.660747e+307,6.385657e+307), point(-58,-15), point(1.172095e+308,1.448533e+308)), linestring(point(-21,-37), point(-52,79), point(-16,-76), point(-65,-94), point(36,7), point(37,74), point(100,-57)), linestring(point(-23,-82), point(-73,23), point(18,-34)), linestring(point(20,-51), point(93,62), point(-65,84)), linestring(point(-48,31), point(-69,-96)), linestring(point(-5,78), point(10,-99), point(36,-33)), linestring(point(-84,55), point(96,1), point(-98,-29), point(-15,81), point(-27,-6), point(58,-32), point(54,-16)), linestring(point(2,5), point(2199023255553,8192)), linestring(point(12,-78), point(-97,-83)), linestring(point(-74,79), point(35,-56), point(50,95)), linestring(point(28,16), point(-39,-40), point(48,-3)), linestring(point(2199023255550,-65539), point(62,-25), point(94,-62)), linestring(point(-74,83), point(-18,75), point(91,17), point(-11,-48), point(30,100)), linestring(point(57,-13), point(88,-45)), linestring(point(20,-64), point(-37,13), point(20,35))), point(-3,-4)) ) ;
insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-34,19), point(-25,92), point(61921390294166805000000000000000000000.000000,319674749161701840000000000000000000000.000000), point(56,50), point(-34,19)), linestring(point(-26,-58), point(99,-50), point(34,-20), point(-26,-58)), linestring(point(-42,45), point(-63,-7), point(5,-89), point(-97,36), point(-42,45)), linestring(point(94,11), point(-71,4), point(94,11)), linestring(point(16,25), point(4,-33), point(-45,-33), point(-64,-77), point(16,25)), linestring(point(19,45), point(36,45), point(-83,-96), point(19,45)), linestring(point(85,-31), point(-87,52), point(85,-31))), polygon(linestring(point(55,-88), point(63,-12), point(55,-88)), linestring(point(-49,10), point(-49,10)), linestring(point(-51,-32), point(-51,-32)))), multipolygon(polygon(linestring(point(-21,-8), point(66,-58), point(100,-27), point(-21,-8)), linestring(point(-29,-13), point(-29,-13))), polygon(linestring(point(91307574660224730000000000000000000000.000000,101214152547755520000000000000000000000.000000), point(89,64), point(77,87), point(66,29), point(-71,-53)), linestring(point(38,-78), point(-43,-90), point(37,20), point(81,65), point(38,-78))), polygon(linestring(point(51,0), point(-62,8), point(-11,22), point(51,0)), linestring(point(-4,-44), point(6,82), point(-19,-90), point(131,32)))), point(-4,-7)) ) ;
ERROR 22023: Invalid GIS data provided to function polygon.
Got one of the listed errors
insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ;
insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ;
ERROR 22023: Invalid GIS data provided to function polygon.
insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ;
ERROR 22023: Invalid GIS data provided to function polygon.
Got one of the listed errors
insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ;
insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ;
ERROR 22023: Invalid GIS data provided to function polygon.
Got one of the listed errors
insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(99,-87), point(38,-79), point(33,-39), point(-91,-8), point(46,-87))) ) ;
insert into t1 select * from t1;
insert into t1 select * from t1;
......
......@@ -1577,13 +1577,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
DROP TABLE t1;
......
......@@ -164,7 +164,6 @@ POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
# Drop spatial keys on the table
ALTER TABLE t1 DROP KEY p, DROP KEY p1;
......@@ -194,7 +193,6 @@ POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
TRUNCATE t1;
ALTER TABLE t1 DROP COLUMN p, DROP COLUMN p1;
......@@ -235,10 +233,8 @@ SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('
ST_AsText(p) ST_AsText(p1)
POINT(0 1) POINT(10 19)
POINT(1 1) POINT(10 20)
POINT(1 0) POINT(10 21)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
POINT(1 0) POINT(10 21)
POINT(0 0) POINT(10 22)
ALTER TABLE t1 DROP COLUMN p1, ADD COLUMN p1 POINT, CHANGE COLUMN p pp POINT AFTER p1;
SELECT c.name, c.mtype, c.prtype, c.len
......@@ -274,14 +270,9 @@ SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE p1 = ST_PointFromText('POINT(1
ST_AsText(pp) ST_AsText(p1)
SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('POLYGON((5 5, 20 5, 20 21, 5 21, 5 5))')) ORDER BY pp;
ST_AsText(pp) ST_AsText(p1)
POINT(0 0) POINT(5 5)
POINT(0 1) POINT(5 5)
POINT(1 0) POINT(5 5)
POINT(1 1) POINT(5 5)
SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(pp, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')) ORDER BY pp;
ST_AsText(pp) ST_AsText(p1)
POINT(0 0) POINT(5 5)
POINT(1 0) POINT(5 5)
DROP TABLE t1;
#
# Test when the POINT is on B-TREE
......@@ -537,10 +528,8 @@ ST_AsText(p1)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p2) FROM gis_point1 WHERE ST_Contains(@poly2, p2);
ST_AsText(p2)
POINT(-1 -3)
......@@ -569,6 +558,7 @@ POINT(10 21)
POINT(20.5 41)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly);
ST_AsText(p1)
POINT(3 6)
# Check functions that use MBR, with line type data
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRIntersects(p1, @ls1);
ST_AsText(p1)
......@@ -618,10 +608,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
......@@ -744,10 +732,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
......@@ -829,10 +815,8 @@ ST_AsText(p1)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2);
ST_AsText(p2)
POINT(-1 -3)
......@@ -861,6 +845,7 @@ POINT(10 21)
POINT(20.5 41)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly);
ST_AsText(p1)
POINT(3 6)
# Check functions that use MBR, with line type data
SELECT ST_AsText(p1) FROM gis_point WHERE MBRIntersects(p1, @ls1);
ST_AsText(p1)
......@@ -910,10 +895,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
......@@ -1036,10 +1019,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
......@@ -1151,10 +1132,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
......@@ -1277,10 +1256,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
POINT(3 6)
POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
......
......@@ -259,10 +259,8 @@ INSERT INTO gis_point VALUES
(ST_PointFromText('POINT(32.1234 64.2468)'), ST_PointFromText('POINT(-1 -1)'));
'The ORDER BY for spatial index will use filesort'
EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # 100.00 Using filesort
Warnings:
Note 1003 /* select#1 */ select st_astext(`test`.`gis_point`.`p1`) AS `ST_AsText(p1)`,st_astext(`test`.`gis_point`.`p2`) AS `ST_AsText(p2)` from `test`.`gis_point` order by `test`.`gis_point`.`p1`,`test`.`gis_point`.`p2`
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 13 #
SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
ST_AsText(p1) ST_AsText(p2)
POINT(2 4) POINT(-2 -6)
......@@ -354,9 +352,11 @@ COUNT(*) ST_AsText(p1)
1024 POINT(4 8)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2) GROUP BY p2;
COUNT(*) ST_AsText(p2)
1024 POINT(0 0)
1024 POINT(-2 -6)
1024 POINT(-3 -9)
1024 POINT(-4 -12)
1024 POINT(-5 -15)
1024 POINT(-1 -3)
1024 POINT(-1 -1)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Equals(p2, @p1) GROUP BY p2;
......@@ -368,13 +368,17 @@ COUNT(*) ST_AsText(p1)
1024 POINT(32.1234 64.2468)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
1024 POINT(3 6) POINT(-3 -9)
1024 POINT(4 8) POINT(-4 -12)
1024 POINT(5 10) POINT(-5 -15)
1024 POINT(6 12) POINT(-6 -18)
1024 POINT(7 14) POINT(-7 -21)
1024 POINT(8 16) POINT(0 0)
1024 POINT(10 21) POINT(-6 3)
1024 POINT(20.5 41) POINT(-8 4)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
1024 POINT(3 6) POINT(-3 -9)
======================================================================
Build another new table with the same schema, will insert data from this table to the orignal one
======================================================================
......@@ -522,9 +526,11 @@ COUNT(*) ST_AsText(p1)
1024 POINT(4 8)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2) GROUP BY p2;
COUNT(*) ST_AsText(p2)
2 POINT(0 0)
1024 POINT(-2 -6)
1024 POINT(-3 -9)
1024 POINT(-4 -12)
1024 POINT(-5 -15)
1024 POINT(-1 -3)
1024 POINT(-1 -1)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Equals(p2, @p1) GROUP BY p2;
......@@ -536,13 +542,17 @@ COUNT(*) ST_AsText(p1)
1024 POINT(32.1234 64.2468)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
1024 POINT(3 6) POINT(-3 -9)
1024 POINT(4 8) POINT(-4 -12)
1024 POINT(5 10) POINT(-5 -15)
1024 POINT(6 12) POINT(-6 -18)
1024 POINT(7 14) POINT(-7 -21)
2 POINT(8 16) POINT(0 0)
1024 POINT(10 21) POINT(-6 3)
1024 POINT(20.5 41) POINT(-8 4)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
1024 POINT(3 6) POINT(-3 -9)
CHECK TABLE gis_point;
Table Op Msg_type Msg_text
test.gis_point check status OK
......
......@@ -16,7 +16,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
POINT(1.5 1.5)
POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
......@@ -24,6 +23,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
......@@ -33,6 +33,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
......@@ -161,7 +162,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
POINT(1.5 1.5)
POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
......@@ -169,6 +169,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
......@@ -178,6 +179,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
......
......@@ -234,7 +234,7 @@ start transaction;
set @g1 = ST_GeomFromText('Polygon((800 800, 800 1000, 1000 1000, 1000 800, 800 800))');
select count(*) from t1 where MBRwithin(t1.c2, @g1);
count(*)
201
199
connection b;
CALL insert_t1(1001, 2000);
set session transaction isolation level serializable;
......
......@@ -6,13 +6,12 @@ insert into t1 values (4, "444", POINT(3.1,3.1));
insert into t1 values (5, "555", POINT(5,5));
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where
Warnings:
Note 1003 /* select#1 */ select st_astext(`test`.`t1`.`g`) AS `ST_astext(t1.g)` from `test`.`t1` where mbrwithin(`test`.`t1`.`g`,(@`g1`))
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
......@@ -97,18 +96,6 @@ left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0))
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
name ST_AsText(square)
big POLYGON((0 0,0 3,3 3,3 0,0 0))
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
MBRoverlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name;
......@@ -140,7 +127,7 @@ alter table t1 drop primary key;
create spatial index idx on t1(g) algorithm=inplace;
create spatial index idx2 on t1(g);
Warnings:
Warning 1831 Duplicate index 'idx2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
alter table t1 add primary key(i), algorithm=inplace;
show create table t1;
Table Create Table
......
......@@ -14,19 +14,19 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((0 0,0 1000,1000 1000,1000 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
1000
999
set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
100
99
set @g1 = ST_GeomFromText('Polygon((10 10,10 800,800 800,800 10,10 10))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
791
789
set @g1 = ST_GeomFromText('Polygon((100 100,100 800,800 800,800 100,100 100))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
701
699
set @g1 = ST_GeomFromText('Point(1 1)');
select count(*) from t1 where MBRequals(t1.c2, @g1);
count(*)
......
......@@ -79,7 +79,7 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
65536
57344
set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
......@@ -87,5 +87,5 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
65536
57344
drop table t1;
......@@ -47,7 +47,7 @@ ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'));
CREATE INDEX linestring_index ON linestring(linestring_nokey(5));
ALTER TABLE linestring ADD KEY (linestring_key(5));
--error ER_GIS_INVALID_DATA
# --error ER_GIS_INVALID_DATA
SELECT ST_AsText(linestring_nokey) FROM linestring FORCE KEY (
linestring_key ) WHERE ST_CONTAINS( ST_GeomFromText('POLYGON( ( 3923 2815 , 4246
2122 , 4028 2971 , 4017 3019 , 3923 2815 ) )') , linestring_key ) AND
......
......@@ -6,7 +6,7 @@
--source include/have_geometry.inc
--source include/not_embedded.inc
--source include/have_debug.inc
--error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
# --error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4
4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT('
POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) ,
......
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.
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