From a3c5ad17472db208c676bbcb59a41fd7fe12b078 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Dec 2002 10:57:53 +0200 Subject: [PATCH 01/11] Moved lower_case_table_name check to right place. --- sql/sql_db.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 338d3161bd4..0be1b7b0411 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -323,9 +323,6 @@ bool mysql_change_db(THD *thd,const char *name) uint db_access; DBUG_ENTER("mysql_change_db"); - if (lower_case_table_names) - casedn_str(dbname); - if (!dbname || !(length=strip_sp(dbname))) { x_free(dbname); /* purecov: inspected */ @@ -338,6 +335,8 @@ bool mysql_change_db(THD *thd,const char *name) x_free(dbname); DBUG_RETURN(1); } + if (lower_case_table_names) + casedn_str(dbname); DBUG_PRINT("general",("Use database: %s", dbname)); if (test_all_bits(thd->master_access,DB_ACLS)) db_access=DB_ACLS; From a3444f379bfaf60f4ddb125488311480c22df8d7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Dec 2002 14:36:40 +0100 Subject: [PATCH 02/11] - Applied various patches provided by Christian Hammers (MySQL maintainer for the Debian project) to fix some architecture-specific problems and some bugs Makefile.am: - put current directory (.) at front of SUBDIRS list, so that "distclean" is done last. IF done first, "distclean" in include directory fails because config.h is missing, which is removed by distclean in current directory. (thanks to "jww" for the patch) - make "distclean" in libmysql_r, too (Thanks to Christian Hammers from the Debian project for the patch) bdb/dist/aclocal/mutex.m4: - Sparc patch for mutexes/pthreads from Christopher C. Chimelis and Ben Collins from Debian (thanks to Christian Hammers from the Debian project for forwarding it) bdb/include/mutex.h: - Patch for building on m68k architecture (originally provided by Michael Fedrowitz for Debian Linux, thanks to Christian Hammers from the Debian project for forwarding it) ltconfig: - A hardcoded "rpath" is forbidden by the Debian policy (thanks to Christian Hammers from the Debian project for forwarding this patch) man/isamchk.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/isamlog.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysql.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysql_zap.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysqlaccess.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysqladmin.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysqld.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysqld_multi.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/mysqldump.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) - fixed nroff mistake man/mysqlshow.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/perror.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/replace.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) man/safe_mysqld.1: - some syntactical correction in the headlines of the manpages for apropos(1) (Thanks to Christian Hammers from the Debian project for the patch) scripts/mysql_fix_privilege_tables.sh: - fixed some typos - script cleanup scripts/mysqlaccess.sh: - make $script_log path less dependent on the shell scripts/safe_mysqld.sh: - applied patch provided by Debian to enhance security (This way all logs and databases are created world-nothing). --- Makefile.am | 4 ++-- bdb/dist/aclocal/mutex.m4 | 2 +- bdb/include/mutex.h | 2 +- ltconfig | 10 +++++++++ man/isamchk.1 | 2 +- man/isamlog.1 | 2 +- man/mysql.1 | 2 +- man/mysql_zap.1 | 2 +- man/mysqlaccess.1 | 2 +- man/mysqladmin.1 | 2 +- man/mysqld.1 | 2 +- man/mysqld_multi.1 | 2 +- man/mysqldump.1 | 6 +++--- man/mysqlshow.1 | 2 +- man/perror.1 | 2 +- man/replace.1 | 2 +- man/safe_mysqld.1 | 2 +- scripts/mysql_fix_privilege_tables.sh | 29 +++++++++++++++++---------- scripts/mysqlaccess.sh | 2 +- scripts/safe_mysqld.sh | 2 ++ 20 files changed, 50 insertions(+), 31 deletions(-) diff --git a/Makefile.am b/Makefile.am index 35db77c684e..8440077298e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,10 +21,10 @@ AUTOMAKE_OPTIONS = foreign # These are built from source in the Docs directory EXTRA_DIST = INSTALL-SOURCE README \ COPYING COPYING.LIB MIRRORS -SUBDIRS = include @docs_dirs@ @readline_dir@ \ +SUBDIRS = . include @docs_dirs@ @readline_dir@ \ @thread_dirs@ @sql_client_dirs@ \ @sql_server_dirs@ scripts tests man \ - @bench_dirs@ support-files os2 + @bench_dirs@ support-files os2 libmysql_r # Relink after clean CLEANFILES = linked_client_sources linked_server_sources linked_libmysql_sources linked_libmysql_r_sources linked_include_sources diff --git a/bdb/dist/aclocal/mutex.m4 b/bdb/dist/aclocal/mutex.m4 index 5c9218da163..2010670599f 100644 --- a/bdb/dist/aclocal/mutex.m4 +++ b/bdb/dist/aclocal/mutex.m4 @@ -279,7 +279,7 @@ fi dnl Sparc/gcc: SunOS, Solaris dnl The sparc/gcc code doesn't always work, specifically, I've seen assembler dnl failures from the stbar instruction on SunOS 4.1.4/sun4c and gcc 2.7.2.2. -if test "$db_cv_mutex" = DOESNT_WORK; then +if test "$db_cv_mutex" = no; then AC_TRY_RUN([main(){ #if defined(__sparc__) #if defined(__GNUC__) diff --git a/bdb/include/mutex.h b/bdb/include/mutex.h index 4c1b265355d..9f341695cbf 100644 --- a/bdb/include/mutex.h +++ b/bdb/include/mutex.h @@ -327,7 +327,7 @@ typedef unsigned char tsl_t; */ #define MUTEX_SET(tsl) ({ \ register tsl_t *__l = (tsl); \ - int __r; \ + unsigned char __r; \ asm volatile("tas %1; \n \ seq %0" \ : "=dm" (__r), "=m" (*__l) \ diff --git a/ltconfig b/ltconfig index 5c6366c9890..a5011a81c19 100755 --- a/ltconfig +++ b/ltconfig @@ -3009,6 +3009,16 @@ hardcode_action=$hardcode_action # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec +# Check if debuild is being run by the current shell. If it is then, +# the DEB_BUILD_ARCH variable should be of non-zero length, indicating +# that we are in the middle of a Debian package build (assuming the +# user isn't doing anything strange with environment variables). +if test -n "`dpkg-architecture -qDEB_BUILD_ARCH`" && ps | grep debuild | grep -v grep > /dev/null; then + # Debian policy mandates that rpaths should not be encoded into a binary + # so it is overridden. + hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ " +fi + # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$hardcode_libdir_separator diff --git a/man/isamchk.1 b/man/isamchk.1 index f225dc35d18..6bf83abab5b 100755 --- a/man/isamchk.1 +++ b/man/isamchk.1 @@ -1,4 +1,4 @@ -.TH ISAMCHK 1 "19 December 2000" +.TH isamchk 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME .BR isamchk \- Description, check and repair of ISAM tables. diff --git a/man/isamlog.1 b/man/isamlog.1 index efc042ccd7c..430b1d3d396 100644 --- a/man/isamlog.1 +++ b/man/isamlog.1 @@ -1,4 +1,4 @@ -.TH ISAMLOG 1 "20 December 2000" +.TH isamlog 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME isamlog - Write info about whats in a nisam log file. .SH USAGE diff --git a/man/mysql.1 b/man/mysql.1 index 96ccca8f50e..baf212015bd 100644 --- a/man/mysql.1 +++ b/man/mysql.1 @@ -1,4 +1,4 @@ -.TH MYSQL 1 "13 June 1997" +.TH mysql 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME mysql \- text-based client for mysqld, a SQL-based relational database daemon .SH SYNOPSIS diff --git a/man/mysql_zap.1 b/man/mysql_zap.1 index 98da195894e..e6ff7f4a0d1 100644 --- a/man/mysql_zap.1 +++ b/man/mysql_zap.1 @@ -1,4 +1,4 @@ -.TH ZAP 1 "20 December 2000" +.TH zap 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME zap - a perl script used to kill processes .SH USAGE diff --git a/man/mysqlaccess.1 b/man/mysqlaccess.1 index 888cfe8f646..2e0d40c823a 100755 --- a/man/mysqlaccess.1 +++ b/man/mysqlaccess.1 @@ -1,4 +1,4 @@ -.TH MYSQLACCESS 1 "19 December 2000" +.TH mysqlaccess 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME .BR mysqlaccess \- Create new users to mysql. diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index 58bd2070de6..a67977dcb75 100755 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -1,4 +1,4 @@ -.TH MYSQLADMIN 1 "18 December 2000" +.TH mysqladmin 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME mysqladmin [OPTIONS] command command.... \- A utility for performing administrative operations .SH OPTION SYNOPSIS diff --git a/man/mysqld.1 b/man/mysqld.1 index d3f22c0be1b..b25606ceda0 100755 --- a/man/mysqld.1 +++ b/man/mysqld.1 @@ -1,4 +1,4 @@ -.TH MYSQLD 1 "19 December 2000" +.TH mysqld 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME .BR mysqld \- Starts the MySQL server demon diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1 index b68050e92ef..8e77626ad3c 100644 --- a/man/mysqld_multi.1 +++ b/man/mysqld_multi.1 @@ -1,4 +1,4 @@ -.TH MYSQLD_MULTI 1 "20 December 2000" +.TH mysqld_multi 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME mysqld_multi - is meant for managing several mysqld processes running in different UNIX sockets and TCP/IP ports. .SH USAGE diff --git a/man/mysqldump.1 b/man/mysqldump.1 index f108da17bf9..85c0e2e0c50 100755 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -1,4 +1,4 @@ -.TH MYSQLDUMP 1 "19 December 2000" +.TH mysqldump 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME mysqldump \- text-based client for dumping or backing up mysql databases , tables and or data. @@ -123,7 +123,7 @@ Connect to host. Lock all tables for read. .TP .BR \-n | \-\-no\-create\-db -'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' +\&'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if .BR \-\-databases @@ -270,4 +270,4 @@ Manual page by L. (Kill-9) Pedersen (kill-9@kill-9.dk), Mercurmedia Data Model Architect / system developer (http://www.mercurmedia.com) -.\" end of man page \ No newline at end of file +.\" end of man page diff --git a/man/mysqlshow.1 b/man/mysqlshow.1 index 55a87c1df78..3a78be69d49 100755 --- a/man/mysqlshow.1 +++ b/man/mysqlshow.1 @@ -1,4 +1,4 @@ -.TH MYSQLSHOW 1 "19 December 2000" +.TH mysqlshow 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME .BR mysqlshow \- Shows the structure of a mysql database (databases,tables and columns) diff --git a/man/perror.1 b/man/perror.1 index 2853f2cb1ba..bd5a4211f4b 100755 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,4 +1,4 @@ -.TH PERROR 1 "19 December 2000" +.TH perror 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME .BR perror can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code. The error messages are mostly system dependent. diff --git a/man/replace.1 b/man/replace.1 index 10bcf64fc88..3c14989e392 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,4 +1,4 @@ -.TH REPLACE 1 "20 December 2000" +.TH replace 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME .TP replace - A utility program that is used by msql2mysql, but that has more general applicability as well. replace changes strings in place in files or on the standard input. Uses a finite state machine to match longer strings first. Can be used to swap strings. diff --git a/man/safe_mysqld.1 b/man/safe_mysqld.1 index 3874801be3b..0505b973672 100755 --- a/man/safe_mysqld.1 +++ b/man/safe_mysqld.1 @@ -1,4 +1,4 @@ -.TH SAFE_MYSQLD 1 "19 December 2000" "safe_mysqld (mysql)" mysql.com +.TH safe_mysqld 1 "19 December 2000" "MySQL 3.23" "MySQL database" .SH NAME safe_mysqld \- start the mysqld daemon on Unix. .SH SYNOPSIS diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 86312fdab52..1677eaf5f32 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -1,23 +1,30 @@ #!/bin/sh echo "This scripts updates the mysql.user, mysql.db, mysql.host and the" -echo "mysql.func table to MySQL 3.22.14 and above." +echo "mysql.func tables to MySQL 3.22.14 and above." echo "" echo "This is needed if you want to use the new GRANT functions," -echo "CREATE AGGREAGATE FUNCTION or want to use the more secure passwords in 3.23" +echo "CREATE AGGREGATE FUNCTION or want to use the more secure passwords in 3.23" echo "" -echo "If you get Access denied errors, you should run this script again" -echo "and give the MySQL root user password as a argument!" +echo "If you get 'Access denied' errors, you should run this script again" +echo "and give the MySQL root user password as an argument!" -root_password="$1" host="localhost" +user="root" + +if test -z $1 ; then + cmd="@bindir@/mysql -f --user=$user --host=$host mysql" +else + root_password="$1" + cmd="@bindir@/mysql -f --user=$user --password=$root_password --host=$host mysql" +fi # Fix old password format, add File_priv and func table echo "" echo "If your tables are already up to date or partially up to date you will" echo "get some warnings about 'Duplicated column name'. You can safely ignore these!" -@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql < columns_priv.Column_priv" echo "You can ignore any errors from this" -@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql < Date: Thu, 26 Dec 2002 16:35:15 +0200 Subject: [PATCH 03/11] Updated comment --- sql/sql_table.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e2fa8bc00d5..4691c2fd494 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1528,12 +1528,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, /* We changed a temporary table */ if (error) { - /* - * The following function call will also free a - * new_table pointer. - * Therefore, here new_table pointer is not free'd as it is - * free'd in close_temporary() which is called by by the - * close_temporary_table() function. + /* + The following function call will free the new_table pointer, + in close_temporary_table(), so we can safely directly jump to err */ close_temporary_table(thd,new_db,tmp_name); goto err; From 884e3dee03caaece1f82acaaefd2a18caa5d89d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 17:50:07 +0200 Subject: [PATCH 04/11] Safety fix to not allow one to specify too big max_alloc_packet to mysqld Safety fix to not cause conflicts with extended packages in 4.0. sql/mysqld.cc: Safety fix to not allow one to specify too big max_alloc_packet sql/net_serv.cc: Safety fix to not cause conflicts with extended packages in 4.0. (Should not cause any notable changes for 3.23 servers) --- sql/mysqld.cc | 2 +- sql/net_serv.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bd17f7339a4..e2adc1a068e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2984,7 +2984,7 @@ CHANGEABLE_VAR changeable_vars[] = { #endif ,0, 1, 0, 1 }, { "max_allowed_packet", (long*) &max_allowed_packet, - 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 }, + 1024*1024L, 80, 16*1024*1024L, MALLOC_OVERHEAD, 1024 }, { "max_binlog_cache_size", (long*) &max_binlog_cache_size, ~0L, IO_SIZE, ~0L, 0, IO_SIZE }, { "max_binlog_size", (long*) &max_binlog_size, diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 750079b39a5..2583f0767f4 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -40,7 +40,7 @@ ulong max_allowed_packet=65536; extern ulong net_read_timeout,net_write_timeout; extern uint test_flags; #else -ulong max_allowed_packet=16*1024*1024L; +ulong max_allowed_packet=16*1024*1024L-1; ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT; #endif From 22611051945dc581414895086bd114dd597f69c7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 17:37:55 +0100 Subject: [PATCH 05/11] - fixes to properly make a "make distclean" (some files were not removed) (There are probably some more to fix) libmysql/Makefile.shared: - clean up the vio_* and ctype-* symlinks that are created by link_source (thanks to Christian Hammers from Debian for the patch) strings/Makefile.am: - remove ctype_autonf.c on "make distclean" (it's generated by "configure") --- libmysql/Makefile.shared | 2 ++ strings/Makefile.am | 1 + 2 files changed, 3 insertions(+) diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 8fe15cca20c..b1c7438543f 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -77,6 +77,8 @@ clean-local: rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \ `echo $(dbugobjects) | sed "s;\.lo;.c;g"` \ `echo $(mysysobjects) | sed "s;\.lo;.c;g"` \ + `echo $(vio_objects) | sed "s;\.lo;.c;g"` \ + $(CHARSET_SRCS) $(CHARSET_OBJS) \ $(mystringsextra) $(mystringsgen) $(mysysheaders) \ ctype_extra_sources.c ../linked_client_sources diff --git a/strings/Makefile.am b/strings/Makefile.am index a81ba1c17cb..1acd3365100 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -40,6 +40,7 @@ endif libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) noinst_PROGRAMS = conf_to_src +DISTCLEANFILES = ctype_autoconf.c # Default charset definitions EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c \ ctype-gb2312.c ctype-gbk.c ctype-sjis.c \ From d78c9adb55a7f43bc234cfbf818ce8183ec73daf Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 21:39:35 +0200 Subject: [PATCH 06/11] Fixed max_key_length when using UNIQUE keys. This fixed a bug in GROUP BY on a BLOB column with NULL values. myisam/mi_create.c: Fixed max_key_length when using UNIQUE keys. myisam/mi_unique.c: Simple optimization Make different CRC for keys with null and empty strings. mysql-test/r/group_by.result: Updated results mysql-test/t/group_by.test: Test of bug --- myisam/mi_create.c | 2 +- myisam/mi_unique.c | 11 ++++++++++- mysql-test/r/group_by.result | 8 ++++++++ mysql-test/t/group_by.test | 11 +++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/myisam/mi_create.c b/myisam/mi_create.c index 6941db158e1..5a5a49533da 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -224,7 +224,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, if (uniques) { max_key_block_length= MI_KEY_BLOCK_LENGTH; - max_key_length= MI_UNIQUE_HASH_LENGTH; + max_key_length= MI_UNIQUE_HASH_LENGTH + pointer; } for (i=0, keydef=keydefs ; i < keys ; i++ , keydef++) diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c index e598fbeedb4..7f1e6b83a12 100644 --- a/myisam/mi_unique.c +++ b/myisam/mi_unique.c @@ -24,7 +24,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, { my_off_t lastpos=info->lastpos; MI_KEYDEF *key= &info->s->keyinfo[def->key]; - uchar *key_buff=info->lastkey+info->s->base.max_key_length; + uchar *key_buff=info->lastkey2; DBUG_ENTER("mi_check_unique"); mi_unique_store(record+key->seg->start, unique_hash); @@ -80,7 +80,16 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) if (keyseg->null_bit) { if (record[keyseg->null_pos] & keyseg->null_bit) + { + /* + Change crc in a way different from an empty string or 0. + (This is an optimisation; The code will work even if this isn't + done) + */ + crc=((crc << 8) + 511+ + (crc >> (8*sizeof(ha_checksum)-8))); continue; + } } pos= record+keyseg->start; if (keyseg->flag & HA_VAR_LENGTH) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 0b720bc3d97..3bd3eeb5efd 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -102,3 +102,11 @@ pid c1id c2id value id active id active 1 4 NULL 4 4 Yes NULL NULL max(value) 4 +a count(*) +NULL 9 + 3 +b 1 +a count(*) +NULL 9 + 3 +b 1 diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index db6baec4b9f..b21ae88007b 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -312,3 +312,14 @@ m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id = c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS NOT NULL); drop table t1,t2,t3; + +# +# Test bug in GROUP BY on BLOB that is NULL or empty +# + +create table t1 (a blob null); +insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b"); +select a,count(*) from t1 group by a; +set option sql_big_tables=1; +select a,count(*) from t1 group by a; +drop table t1; From 9efb607e11383be71e7c9ca8eabd882e9d6e4afd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 23:29:27 +0200 Subject: [PATCH 07/11] Added O_BINARY flag to all my_fopen() calls. (To make the current tests results work on windows) --- client/mysqltest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index cfb7fe1aeaf..18fafff275e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -43,7 +43,7 @@ **********************************************************************/ -#define MTEST_VERSION "1.10" +#define MTEST_VERSION "1.11" #include #include @@ -573,7 +573,7 @@ int open_file(const char* name) { if (*cur_file && cur_file == file_stack_end) die("Source directives are nesting too deep"); - if (!(*(cur_file+1) = my_fopen(name, O_RDONLY, MYF(MY_WME)))) + if (!(*(cur_file+1) = my_fopen(name, O_RDONLY | O_BINARY, MYF(MY_WME)))) die(NullS); cur_file++; *++lineno=1; @@ -1589,7 +1589,7 @@ int parse_args(int argc, char **argv) result_file = optarg; break; case 'x': - if (!(*cur_file = my_fopen(optarg, O_RDONLY, MYF(MY_WME)))) + if (!(*cur_file = my_fopen(optarg, O_RDONLY | O_BINARY, MYF(MY_WME)))) die("Could not open %s: errno = %d", optarg, errno); break; case 'p': From 787307d5562be0b1b0b303add57f136b022cef2b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 22:15:03 +0200 Subject: [PATCH 08/11] log0log.c: Backport bugfix from 4.0: combined log file size >= 2 GB could cause log to be written in wrong place btr0pcur.c: Backport bugfix from 4.0: index cursor restoration could theoretically fail innobase/btr/btr0pcur.c: Backport bugfix from 4.0: index cursor restoration could theoretically fail innobase/log/log0log.c: Backport bugfix from 4.0: combined log file size >= 2 GB could cause log to be written in wrong place --- innobase/btr/btr0pcur.c | 6 ++++++ innobase/log/log0log.c | 32 +++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/innobase/btr/btr0pcur.c b/innobase/btr/btr0pcur.c index 8ca3d41f7f9..2b9dc11e683 100644 --- a/innobase/btr/btr0pcur.c +++ b/innobase/btr/btr0pcur.c @@ -292,6 +292,12 @@ btr_pcur_restore_position( mem_heap_free(heap); + /* We have to store position information, modify clock value, etc. + because the cursor may now be on a different page */ + + btr_pcur_store_position(cursor, mtr); + + return(FALSE); } diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index cb85e9d3ba6..9e40e4898a5 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -437,25 +437,29 @@ log_group_calc_lsn_offset( dulint lsn, /* in: lsn, must be within 4 GB of group->lsn */ log_group_t* group) /* in: log group */ { - dulint gr_lsn; - ulint gr_lsn_size_offset; - ulint difference; - ulint group_size; - ulint offset; + dulint gr_lsn; + ib_longlong gr_lsn_size_offset; + ib_longlong difference; + ib_longlong group_size; + ib_longlong offset; ut_ad(mutex_own(&(log_sys->mutex))); + /* If total log file size is > 2 GB we can easily get overflows + with 32-bit integers. Use 64-bit integers instead. */ + gr_lsn = group->lsn; - gr_lsn_size_offset = log_group_calc_size_offset(group->lsn_offset, - group); - group_size = log_group_get_capacity(group); + gr_lsn_size_offset = (ib_longlong) + log_group_calc_size_offset(group->lsn_offset, group); + + group_size = (ib_longlong) log_group_get_capacity(group); if (ut_dulint_cmp(lsn, gr_lsn) >= 0) { - difference = ut_dulint_minus(lsn, gr_lsn); + difference = (ib_longlong) ut_dulint_minus(lsn, gr_lsn); } else { - difference = ut_dulint_minus(gr_lsn, lsn); + difference = (ib_longlong) ut_dulint_minus(gr_lsn, lsn); difference = difference % group_size; @@ -464,7 +468,13 @@ log_group_calc_lsn_offset( offset = (gr_lsn_size_offset + difference) % group_size; - return(log_group_calc_real_offset(offset, group)); + ut_a(offset <= 0xFFFFFFFF); + + /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", + (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); + */ + + return(log_group_calc_real_offset((ulint)offset, group)); } /*********************************************************************** From b77dcb19e608d3947257b02e64cc84d09dae1223 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 23:28:30 +0200 Subject: [PATCH 09/11] Fixed wrong packed length for packet > 16M. sql/net_pkg.cc: Fixed wrong packed length for packet > 16M. (Not used in 3.23) --- sql/net_pkg.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc index 0b50b34c7bd..381e0ded3f4 100644 --- a/sql/net_pkg.cc +++ b/sql/net_pkg.cc @@ -206,7 +206,7 @@ net_store_length(char *pkg, ulonglong length) } *packet++=254; int8store(packet,length); - return (char*) packet+9; + return (char*) packet+8; } char * From b96140fe3a430ea4cb330ef915c35357ccc1efe9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Jan 2003 01:13:50 +0200 Subject: [PATCH 10/11] ha_innobase.cc: Backport from 4.0: fix possible adaprive hash index latch hang sql/ha_innobase.cc: Backport from 4.0: fix possible adaprive hash index latch hang --- sql/ha_innobase.cc | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index c5b529a3881..19ec6a9bb06 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -977,14 +977,14 @@ ha_innobase::open( norm_name, NULL); if (NULL == ib_table) { - sql_print_error("InnoDB error:\n\ -Cannot find table %s from the internal data dictionary\n\ -of InnoDB though the .frm file for the table exists. Maybe you\n\ -have deleted and recreated InnoDB data files but have forgotten\n\ -to delete the corresponding .frm files of InnoDB tables, or you\n\ -have moved .frm files to another database?\n\ -Look from section 15.1 of http://www.innodb.com/ibman.html\n\ -how you can resolve the problem.\n", + sql_print_error("InnoDB error:\n" +"Cannot find table %s from the internal data dictionary\n" +"of InnoDB though the .frm file for the table exists. Maybe you\n" +"have deleted and recreated InnoDB data files but have forgotten\n" +"to delete the corresponding .frm files of InnoDB tables, or you\n" +"have moved .frm files to another database?\n" +"Look from section 15.1 of http://www.innodb.com/ibman.html\n" +"how you can resolve the problem.\n", norm_name); free_share(share); @@ -3062,9 +3062,9 @@ ha_innobase::records_in_range( DBUG_ENTER("records_in_range"); - /* Warning: since it is not sure that MySQL calls external_lock - before calling this function, the trx field in prebuilt can be - obsolete! */ + update_thd(current_thd); + + trx_search_latch_release_if_reserved(prebuilt->trx); active_index = keynr; @@ -3117,12 +3117,12 @@ ha_innobase::estimate_number_of_rows(void) dict_index_t* index; ulonglong estimate; ulonglong data_file_length; - - /* Warning: since it is not sure that MySQL calls external_lock - before calling this function, the trx field in prebuilt can be - obsolete! */ - DBUG_ENTER("info"); + DBUG_ENTER("estimate_number_of_rows"); + + update_thd(current_thd); + + trx_search_latch_release_if_reserved(prebuilt->trx); index = dict_table_get_first_index_noninline(prebuilt->table); @@ -3178,9 +3178,9 @@ ha_innobase::info( DBUG_ENTER("info"); - /* Warning: since it is not sure that MySQL calls external_lock - before calling this function, the trx field in prebuilt can be - obsolete! */ + update_thd(current_thd); + + trx_search_latch_release_if_reserved(prebuilt->trx); ib_table = prebuilt->table; From cb460d38ccbc97c8c4fde22fdb7c4b5333cad8bb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Jan 2003 01:21:13 +0200 Subject: [PATCH 11/11] btr0btr.h, btr0btr.c, row0purge.c: Backport from 4.0: fix the BLOB hang if the index tree is of height 1 innobase/row/row0purge.c: Backport from 4.0: fix the BLOB hang if the index tree is of height 1 innobase/btr/btr0btr.c: Backport from 4.0: fix the BLOB hang if the index tree is of height 1 innobase/include/btr0btr.h: Backport from 4.0: fix the BLOB hang if the index tree is of height 1 --- innobase/btr/btr0btr.c | 2 +- innobase/include/btr0btr.h | 9 +++++++++ innobase/row/row0purge.c | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c index 15642e6ccbc..32750201c8e 100644 --- a/innobase/btr/btr0btr.c +++ b/innobase/btr/btr0btr.c @@ -116,7 +116,7 @@ btr_page_insert_fits( /****************************************************************** Gets the root node of a tree and x-latches it. */ -static + page_t* btr_root_get( /*=========*/ diff --git a/innobase/include/btr0btr.h b/innobase/include/btr0btr.h index f66ad3639d4..7e9d4b73d90 100644 --- a/innobase/include/btr0btr.h +++ b/innobase/include/btr0btr.h @@ -55,6 +55,15 @@ UNIQUE definition on secondary indexes when we decide if we can use the insert buffer to speed up inserts */ #define BTR_IGNORE_SEC_UNIQUE 2048 +/****************************************************************** +Gets the root node of a tree and x-latches it. */ + +page_t* +btr_root_get( +/*=========*/ + /* out: root page, x-latched */ + dict_tree_t* tree, /* in: index tree */ + mtr_t* mtr); /* in: mtr */ /****************************************************************** Gets a buffer page and declares its latching order level. */ UNIV_INLINE diff --git a/innobase/row/row0purge.c b/innobase/row/row0purge.c index 5da98943926..d24b296ec50 100644 --- a/innobase/row/row0purge.c +++ b/innobase/row/row0purge.c @@ -428,7 +428,9 @@ skip_secondaries: index = dict_table_get_first_index(node->table); mtr_x_lock(dict_tree_get_lock(index->tree), &mtr); - + + btr_root_get(index->tree, &mtr); + /* We assume in purge of externally stored fields that the space id of the undo log record is 0! */