From a3a99fc7cadc43a5efc071d33dc90ed7f7799034 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Nov 2002 22:13:23 +0200 Subject: [PATCH 1/7] A fix for the bug with: delete from table where column<=>NULL on indexed columns --- mysql-test/r/delete.result | 6 ++++++ mysql-test/t/delete.test | 5 +++++ sql/opt_range.cc | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index c2230722aa6..e3e95c79fb7 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -24,3 +24,9 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; +create table t1 (id int, index(id)); +insert into t1 values(NULL); +delete from t1 where id <=> NULL; +select * from t1; +id +drop table if exists t1; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 953e22cdd55..fc57fdabcd5 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -35,3 +35,8 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; +create table t1 (id int, index(id)); +insert into t1 values(NULL); +delete from t1 where id <=> NULL; +select * from t1; +drop table if exists t1; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f33a2d312b4..14999097c62 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1024,7 +1024,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, field->cmp_type() != value->result_type()) DBUG_RETURN(0); - if (value->save_in_field(field)) + if (value->save_in_field(field) || value->is_null()) { // TODO; Check if we can we remove the following block. if (type == Item_func::EQUAL_FUNC) From 9a2ac08bac0de5e0e42edb1e45ed28da4a7f1b1c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Nov 2002 21:42:44 +0100 Subject: [PATCH 2/7] configure.in: - fix MYSQL_NO_DASH_VERSION if version number ends on one digit only ("comment" test failed when MySQL version was changed from 4.0.5 to 4.0.5a) configure.in: - fix MYSQL_NO_DASH_VERSION if version number ends on one digit only ("comment" test failed when MySQL version was changed from 4.0.5 to 4.0.5a) --- configure.in | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.in b/configure.in index cc9e9f772b4..4dfee69f1c0 100644 --- a/configure.in +++ b/configure.in @@ -15,6 +15,7 @@ SHARED_LIB_VERSION=11:0:0 # Set all version vars based on $VERSION. How do we do this more elegant ? # Remember that regexps needs to quote [ and ] since this is run through m4 MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"` +MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[a-z]*-.*$||"` MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` F_PART=`echo $MYSQL_BASE_VERSION | sed -e "s|\.||g"| sed -e "s|[a-zA-Z]\+||"|sed -e "s|^\(..\)$|\\10|"` L_PART=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|" | sed -e "s|[[a-z]]||"` From b473d7d6405e9ab2d65baff3e7a79faae0229c09 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Nov 2002 22:14:57 +0100 Subject: [PATCH 3/7] configure.in: - actually follow the hints in the comment above and "Remember that regexps needs to quote [ and ] since this is run through m4"... configure.in: - actually follow the hints in the comment above and "Remember that regexps needs to quote [ and ] since this is run through m4"... --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 4dfee69f1c0..9b70e81d088 100644 --- a/configure.in +++ b/configure.in @@ -15,7 +15,7 @@ SHARED_LIB_VERSION=11:0:0 # Set all version vars based on $VERSION. How do we do this more elegant ? # Remember that regexps needs to quote [ and ] since this is run through m4 MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"` -MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[a-z]*-.*$||"` +MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"` MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` F_PART=`echo $MYSQL_BASE_VERSION | sed -e "s|\.||g"| sed -e "s|[a-zA-Z]\+||"|sed -e "s|^\(..\)$|\\10|"` L_PART=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|^[[0-9]]\.[[0-9]]*\.||" | sed -e "s|^\(.\)$|0\\1|" | sed -e "s|[[a-z]]||"` From 03ac294cceb5619557fffacbf95901f4c5b1997f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Nov 2002 00:33:15 +0200 Subject: [PATCH 4/7] fixed invalidation of query cache excluded double call of 'invalidate()' mysql-test/r/innodb_cache.result: test of invalidation mysql-test/t/innodb_cache.test: test of invalidation sql/handler.cc: excluded double call of 'invalidate()' sql/sql_delete.cc: fixed invalidation of query cache sql/sql_insert.cc: fixed invalidation of query cache sql/sql_update.cc: fixed invalidation of query cache --- mysql-test/r/innodb_cache.result | 10 ++++++++++ mysql-test/t/innodb_cache.test | 9 ++++++++- sql/handler.cc | 2 +- sql/sql_delete.cc | 10 ++++------ sql/sql_insert.cc | 9 +++------ sql/sql_update.cc | 10 ++++------ 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result index eaa030046da..47abcb45fe5 100644 --- a/mysql-test/r/innodb_cache.result +++ b/mysql-test/r/innodb_cache.result @@ -98,3 +98,13 @@ commit; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 +drop table if exists t1; +CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB; +select count(*) from t1; +count(*) +0 +insert into t1 (id) values (0); +select count(*) from t1; +count(*) +1 +drop table t1; diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test index 21d30420eaf..9066a5f19ba 100644 --- a/mysql-test/t/innodb_cache.test +++ b/mysql-test/t/innodb_cache.test @@ -47,4 +47,11 @@ select * from t3; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; commit; -show status like "Qcache_queries_in_cache"; \ No newline at end of file +show status like "Qcache_queries_in_cache"; + +drop table if exists t1; +CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB; +select count(*) from t1; +insert into t1 (id) values (0); +select count(*) from t1; +drop table t1; diff --git a/sql/handler.cc b/sql/handler.cc index f07e90d2eb9..c4e742ef519 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -314,7 +314,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) } #endif #ifdef HAVE_QUERY_CACHE - if (transaction_commited) + if (transaction_commited && thd->transaction.changed_tables) query_cache.invalidate(thd->transaction.changed_tables); #endif /*HAVE_QUERY_CACHE*/ if (error && trans == &thd->transaction.all && mysql_bin_log.is_open()) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 5f2d7e36a04..1361ff39388 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -179,14 +179,12 @@ cleanup: if (ha_autocommit_or_rollback(thd,error >= 0)) error=1; } + /* - Only invalidate the query cache if something changed or if we - didn't commit the transacion (query cache is automaticly - invalidated on commit) + Store table for future invalidation or invalidate it in + the query cache if something changed */ - if (deleted && - (!transactional_table || - thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) + if (deleted) { query_cache_invalidate3(thd, table_list, 1); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2508314c469..6ce2b50fc36 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -319,13 +319,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, error=ha_autocommit_or_rollback(thd,error); /* - Only invalidate the query cache if something changed or if we - didn't commit the transacion (query cache is automaticly - invalidated on commit) + Store table for future invalidation or invalidate it in + the query cache if something changed */ - if ((info.copied || info.deleted) && - (!transactional_table || - thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) + if (info.copied || info.deleted) { query_cache_invalidate3(thd, table_list, 1); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b5263322301..97e6ea43bfd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -318,14 +318,12 @@ int mysql_update(THD *thd, if (ha_autocommit_or_rollback(thd, error >= 0)) error=1; } + /* - Only invalidate the query cache if something changed or if we - didn't commit the transacion (query cache is automaticly - invalidated on commit) + Store table for future invalidation or invalidate it in + the query cache if something changed */ - if (updated && - (!transactional_table || - thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) + if (updated) { query_cache_invalidate3(thd, table_list, 1); } From 89083f2d6d078eb25f1fe013d8cd5bc46b9a631c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Nov 2002 13:47:01 +0200 Subject: [PATCH 5/7] reverting a change --- sql/opt_range.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 14999097c62..f33a2d312b4 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1024,7 +1024,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, field->cmp_type() != value->result_type()) DBUG_RETURN(0); - if (value->save_in_field(field) || value->is_null()) + if (value->save_in_field(field)) { // TODO; Check if we can we remove the following block. if (type == Item_func::EQUAL_FUNC) From fa76afe6edbc6572f179d1dcf859f013e85ef7dd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Nov 2002 13:59:06 +0200 Subject: [PATCH 6/7] ut0mem.c: Flush stderr if we run out of memory, so that the error message more probably finds its way to the error log innobase/ut/ut0mem.c: Flush stderr if we run out of memory, so that the error message more probably finds its way to the error log --- innobase/ut/ut0mem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 2a7643551ad..03f15031fdf 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -90,6 +90,12 @@ ut_malloc_low( "InnoDB: on Linux we get a stack trace.\n", n, ut_total_allocated_memory, errno); + /* Flush stderr to make more probable that the error + message gets in the error file before we generate a seg + fault */ + + fflush(stderr); + os_fast_mutex_unlock(&ut_list_mutex); /* Make an intentional seg fault so that we get a stack From fe9bbec4c0c48a680dbfeecd4d334679bc7bd5d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 23 Nov 2002 15:49:12 +0200 Subject: [PATCH 7/7] reverting a test that belongs to 3.23 --- mysql-test/r/delete.result | 6 ------ mysql-test/t/delete.test | 5 ----- 2 files changed, 11 deletions(-) diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index e3e95c79fb7..c2230722aa6 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -24,9 +24,3 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; -create table t1 (id int, index(id)); -insert into t1 values(NULL); -delete from t1 where id <=> NULL; -select * from t1; -id -drop table if exists t1; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index fc57fdabcd5..953e22cdd55 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -35,8 +35,3 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; -create table t1 (id int, index(id)); -insert into t1 values(NULL); -delete from t1 where id <=> NULL; -select * from t1; -drop table if exists t1;