Re: [Maria-developers] [Commits] 9bd354e: MDEV-11060 sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed
Hi Varun, Please find a small note below. Ok to push after it has been addressed. On Tue, Dec 13, 2016 at 05:09:58AM +0530, Varun wrote:
revision-id: 9bd354ef91ae81e0f997f29acdae4f8a2997b3c8 (mariadb-10.1.19-40-g9bd354e) parent(s): 67b570af506a42f14a8ae30603d52ca9de68cce5 author: Varun Gupta committer: Varun Gupta timestamp: 2016-12-13 05:07:02 +0530 message:
MDEV-11060 sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed
In file sql/opt_range.cc,when calculate_cond_selectivity_for_table() is called with optimizer_use_condition_selectivity=4 then - thd->no_errors is set to 1 - the original value of thd->no_error is not restored to its original value - this is causing the assertion to fail in the subsequent queries
Fixed by restoring the original value of thd->no_errors
--- mysql-test/r/selectivity_innodb.result | 23 +++++++++++++++++++++++ mysql-test/t/selectivity_innodb.test | 28 ++++++++++++++++++++++++++++ sql/opt_range.cc | 1 + 3 files changed, 52 insertions(+)
diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 4355812..b57873d 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -1670,6 +1670,29 @@ DROP TABLE t1,t2; # # End of 10.0 tests # +# +# MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed +# +set optimizer_use_condition_selectivity=4; +drop table if exists t1, t2; +Warnings: +Note 1051 Unknown table 'test.t1' +Note 1051 Unknown table 'test.t2' +drop view if exists v1; +Warnings: +Note 1051 Unknown table 'test.v1'
Please remove 'DROP TABLE IF EXISTS' statements as they are not necessary. The previous test ends with DROP TABLE commands for tables t1, t2. There is no DROP VIEW command, so it is useful that the VIEW is dropped before it is used (just in case the test is run against a server that already has the view). Check out other test files, most of them start with lines like: --disable_warnings drop table if exists t1,t2; --enable_warnings Please also suppress warnings for the DROP VIEW statement.
+create table t1 (a int not null, b int, c int) engine=InnoDB; +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c); +create table t2 (d int, e int) engine=InnoDB; +update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200; +create view v1 as select * from t1, t2 where d=2; +insert v1 (a,c) values (NULL, 20); +ERROR 23000: Column 'a' cannot be null +drop table t1,t2; +drop view v1; +# +# End of 10.1 tests +# set use_stat_tables= @tmp_ust; set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/selectivity_innodb.test b/mysql-test/t/selectivity_innodb.test index 25aa0ab..bb87106 100644 --- a/mysql-test/t/selectivity_innodb.test +++ b/mysql-test/t/selectivity_innodb.test @@ -138,6 +138,34 @@ DROP TABLE t1,t2; --echo # End of 10.0 tests --echo #
+ +--echo # +--echo # MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed +--echo # + + +set optimizer_use_condition_selectivity=4; + +drop table if exists t1, t2; +drop view if exists v1; + +create table t1 (a int not null, b int, c int) engine=InnoDB; +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c); + +create table t2 (d int, e int) engine=InnoDB; +update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200; + +create view v1 as select * from t1, t2 where d=2; +--error ER_BAD_NULL_ERROR +insert v1 (a,c) values (NULL, 20); + +drop table t1,t2; +drop view v1; + +--echo # +--echo # End of 10.1 tests +--echo # + set use_stat_tables= @tmp_ust; set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index bed57f3..0577ef0 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3112,6 +3112,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) }
free_alloc: + thd->no_errors= 0; thd->mem_root= param.old_root; free_root(&alloc, MYF(0));
_______________________________________________ commits mailing list commits@mariadb.org https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
-- BR Sergei -- Sergei Petrunia, Software Developer MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog
participants (1)
-
Sergey Petrunia