Re: [Maria-developers] Working on spider patches, MDEV-7698

2016-11-21 Thread Michael Widenius
Hi!

Now working on MDEV-7700 Spiral patch 002_mariadb-10.0.15.spider.diff

+++ ./002_mariadb-10.1.8-spider/sql/ha_partition.cc2015-10-14
01:48:53.392665313 +0900
@@ -327,7 +327,9 @@ void ha_partition::init_handler_variable
   m_file_buffer= NULL;
   m_name_buffer_ptr= NULL;
   m_engine_array= NULL;
+/*
   m_connect_string= NULL;
+*/
   m_file= NULL;
   m_file_tot_parts= 0;
   m_reorged_file= NULL;
@@ -1516,4 +1518,6 @@ int ha_partition::prepare_new_partition(
   if ((error= set_up_table_before_create(tbl, part_name, create_info, p_elem)))
 goto error_create;

+/*
   tbl->s->connect_string = p_elem->connect_string;
+*/


I don't think this it will work removing the usage of p_elem->connect_string

This is because each partition may have a different connect string.

Here is an example from fedarated_partion.test:

eval create table t1 (s1 int primary key) engine=federated
  partition by list (s1)
  (partition p1 values in (1,3)
 connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1',
   partition p2 values in (2,4)
 connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_2');

The above works in mariadb 10.2 but not in your spider tree.

>From this patch I will, for now, only take the code related to

HA_EXTRA_WRITE_CAN_REPLACE
HA_EXTRA_WRITE_CANNOT_REPLACE

--- ./001_mariadb-10.1.8-partition_cond_push/sql/sql_plugin.cc
2015-10-13 23:49:10.188129839 +0900
+++ ./002_mariadb-10.1.8-spider/sql/sql_plugin.cc2015-10-14
01:48:54.296665317 +0900
@@ -2757,6 +2757,7 @@ static void update_func_str(THD *thd, st
   *(char**) tgt= my_strdup(value, MYF(0));
 else
   *(char**) tgt= 0;
-my_free(old);
+if (old)
+  my_free(old);

As my_free is safe to call with NULL, the above is not needed

diff -Narup ./001_mariadb-10.1.8-partition_cond_push/sql/sql_priv.h
./002_mariadb-10.1.8-spider/sql/sql_priv.h
--- ./001_mariadb-10.1.8-partition_cond_push/sql/sql_priv.h
2015-10-13 23:49:10.189129839 +0900
+++ ./002_mariadb-10.1.8-spider/sql/sql_priv.h2015-10-14
01:48:54.642665315 +0900
@@ -27,6 +27,8 @@
 #ifndef SQL_PRIV_INCLUDED
 #define SQL_PRIV_INCLUDED

+#define PLUGIN_VAR_CAN_MEMALLOC
+
 #ifndef MYSQL_CLIENT

The above is not needed, as all code that is testing this is doing:

#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 10

Which is always true in MariaDB 10.x

Regards,
Monty

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] Please review MDEV-11298 also fixing GIS bugs MDEV-9405 and MDEV-9425

2016-11-21 Thread Alexander Barkov

  Привет, Леха!

Че-то я запутался с номерами. Прошу прощения.


Вместо:

Please review MDEV-11298 also fixing GIS bugs MDEV-9405 and MDEV-9425

в этом письме должно было быть:

Please review MDEV-11302 also fixing GIS bugs MDEV-9405 and MDEV-9425

И имя патча было неверное.

А настоящий MDEV-11298 я оправлял другим письмом.



То есть всего осталось два патча из тех, что я отправлял тебе на ревью:


MDEV-11298 Split Item_func_hex::val_str_ascii() into virtual methods in 
Type_handler


MDEV-11302 Add class Type_ext_attributes and 
Type_handler::join_type_ext_attributes()




On 11/17/2016 05:57 PM, Alexander Barkov wrote:

Hello Alexey,

Please review a patch for:

MDEV-11302 Add class Type_ext_attributes and
Type_handler::join_type_ext_attributes()

A detailed description can be found in the task ticket:
https://jira.mariadb.org/browse/MDEV-11302


This patch also fixes the problems reported in:

MDEV-9405 Hybrid functions, SP do not preserve geometry type
MDEV-9425 Hybrid functions and UNION do not preserve spatial REF_SYSTEM_ID

Some calls for geometry_type() and/or srid() were forgotten in the old
code.


The new code replaces calls for geometry_type() and srid()
to a generic type_ext_attributes() and makes maintaining/adding
of similar data type specific attributes easier.

The new class Type_ext_attributes will be used in a few field creation
methods in Type_handler later.


Thanks!
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index d10cfec..fb7bbe0 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -2193,3 +2193,102 @@ DROP TABLE t1;
 #
 # End of 10.2 tests
 #
+#
+# Start of 10.3 tests
+#
+#
+#  MDEV-9405 Hybrid functions, SP do not preserve geometry type
+#
+CREATE TABLE t1 AS SELECT
+Point(0,0) AS p0,
+COALESCE(Point(0,0)) AS p1,
+CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2,
+LEAST(Point(0,0), Point(0,0)) AS p3;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `p0` point DEFAULT NULL,
+  `p1` point DEFAULT NULL,
+  `p2` point DEFAULT NULL,
+  `p3` point DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE FUNCTION f1() RETURNS POINT RETURN POINT(1,1);
+CREATE TABLE t1 SELECT f1() AS a;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` point DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP FUNCTION f1;
+CREATE TABLE t1 (a POINT REF_SYSTEM_ID=10, b POINT REF_SYSTEM_ID=11);
+CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1;
+SELECT G_TABLE_NAME,G_GEOMETRY_COLUMN,SRID FROM INFORMATION_SCHEMA.GEOMETRY_COLUMNS ORDER BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
+G_TABLE_NAME	G_GEOMETRY_COLUMN	SRID
+t1	a	10
+t1	b	11
+t2	a	0
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1;
+SELECT G_TABLE_NAME,G_GEOMETRY_COLUMN,SRID FROM INFORMATION_SCHEMA.GEOMETRY_COLUMNS ORDER BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
+G_TABLE_NAME	G_GEOMETRY_COLUMN	SRID
+t1	a	10
+t1	b	11
+t2	a	10
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (p POINT REF_SYSTEM_ID=10);
+CREATE TABLE t2 AS SELECT MIN(p) AS p FROM t1;
+SELECT G_TABLE_NAME,G_GEOMETRY_COLUMN,SRID FROM INFORMATION_SCHEMA.GEOMETRY_COLUMNS ORDER BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
+G_TABLE_NAME	G_GEOMETRY_COLUMN	SRID
+t1	p	10
+t2	p	10
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (p POINT REF_SYSTEM_ID=10);
+CREATE TABLE t2 AS SELECT MIN(p) AS p FROM t1 UNION SELECT p FROM t1;
+SELECT G_TABLE_NAME,G_GEOMETRY_COLUMN,SRID FROM INFORMATION_SCHEMA.GEOMETRY_COLUMNS ORDER BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
+G_TABLE_NAME	G_GEOMETRY_COLUMN	SRID
+t1	p	10
+t2	p	10
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (p POINT REF_SYSTEM_ID=10);
+CREATE VIEW v1 AS SELECT p FROM t1;
+CREATE TABLE t2 AS SELECT MIN(p) AS p FROM t1 UNION SELECT p FROM v1;
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `p` point DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT G_TABLE_NAME,G_GEOMETRY_COLUMN,SRID FROM INFORMATION_SCHEMA.GEOMETRY_COLUMNS ORDER BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
+G_TABLE_NAME	G_GEOMETRY_COLUMN	SRID
+t1	p	10
+t2	p	10
+v1	p	10
+DROP TABLE t2;
+DROP VIEW v1;
+DROP TABLE t1;
+#
+#  End of MDEV-9405 Hybrid functions, SP do not preserve geometry type
+#
+#
+# MDEV-9425 Hybrid functions and UNION do not preserve spatial REF_SYSTEM_ID
+#
+CREATE TABLE t1 (g GEOMETRY REF_SYSTEM_ID=101);
+CREATE TABLE t2 AS SELECT g AS g_column, COALESCE(g) AS g_coalesce FROM t1;
+CREATE TABLE t3 AS SELECT g AS g_unionn FROM t1 UNION SELECT g FROM t1;
+SELECT G_TABLE_NAME, G_GEOMETRY_COLUMN, SRID FROM INFORMATION_SCHEMA.GEOMETRY_COLUMNS ORDER BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
+G_TABLE_NAME	G_GEOMETRY_COLUMN	SRID
+t1	g	101
+t2	g_coalesce	101
+t2	g_column	101
+t3	g_unionn	101
+DROP TABLE t3,t2,t1;
+#
+# End of MDEV-9425 Hybrid functions and UNION do not preserve spatial REF_SYSTEM_ID
+#
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 12b3e60..aa721af 100644

[Maria-developers] Working on spider patches, MDEV-7698

2016-11-21 Thread Michael Widenius
Hi!

I have now started to work on the spider patches for MariaDB 10.2, MDEV-7698.

I have moved all code from maria-10.1-spider to a new branch
maria-10.2-spider and added some more patches.
I have closed all related MDEV's in MDEV-7698 that is now included in
10.2-spider.

While doing this, I noticed that spider/handler test was not included
in the test suite. I added the missing suite.pm and suite.opt files
and got the tests to work.

However, when I tried to run test to verify my changes, I noticed that
a lot of test in spider/handler where failing:

mysql-test-run --suite=spider/handler
produces these failures:

spider/handler.spider3_fixes spider/handler.direct_aggregate
spider/handler.direct_update spider/handler.spider_fixes
spider/handler.function spider/handler.ha spider/handler.vp_fixes

All failures are because .test and .result file doesn't match.

I checked the patch file:
http://spiderformysql.com/downloads/spider-3.2/patch_mariadb-10.1.8.tgz
but this doesn't include any updates to the handler test files:
grep mysql_test *  returns nothing.

However the .tar file:
http://spiderformysql.com/downloads/spider-3.2/mariadb-10.1.8-spider-3.2-vp-1.1.tgz
Contains a lot of updated .test and .result files.

Kentoku, do you have patches for the test files, or should I just take
them from the above spider branch or from somewhere else ?

Another question:
After applying the patches:

013_mariadb-10.0.15.vp_handler.diff
034_mariadb-10.0.15.vp_handler2.diff
005_mariadb-10.0.15.hs.diff
041_mariadb-10.0.15.vp_handler2.diff

I get the following change in spider/handler/basic_sql.result:

--- a/storage/spider/mysql-test/spider/handler/r/basic_sql.result
+++ b/storage/spider/mysql-test/spider/handler/r/basic_sql.result
@@ -70,6 +70,12 @@ CREATE TABLE ta_l (
 PRIMARY KEY(a)
 ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
 IGNORE SELECT a, b, c FROM tb_l
+Warnings:
+Warning1062Duplicate entry '1' for key 'PRIMARY'
+Warning1062Duplicate entry '2' for key 'PRIMARY'
+Warning1062Duplicate entry '3' for key 'PRIMARY'
+Warning1062Duplicate entry '4' for key 'PRIMARY'
+Warning1062Duplicate entry '5' for key 'PRIMARY'

I can't figure out,why we get the above warnings.
This is from a patch we discussed at booking.com one year ago.  Any
explanation for the above warnings would be appreciated.

You can branch 10.2-spider and check the current state.

Regards,
Monty

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp