diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln index da6d1bbcc9f..f4204b00bc4 100644 --- a/VC++Files/mysql.sln +++ b/VC++Files/mysql.sln @@ -823,32 +823,21 @@ Global {62E85884-3ACF-4F4C-873B-60B878147890}.TLS_DEBUG.ActiveCfg = Debug|Win32 {62E85884-3ACF-4F4C-873B-60B878147890}.TLS_DEBUG.Build.0 = Debug|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic.ActiveCfg = classic|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic.Build.0 = classic|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic nt.ActiveCfg = classic|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic nt.Build.0 = classic|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Debug.ActiveCfg = Debug|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Debug.Build.0 = Debug|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Classic.ActiveCfg = classic|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Debug.ActiveCfg = Debug|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Pro.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_ProGPL.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Release.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max nt.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max nt.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.nt.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.nt.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro.ActiveCfg = pro|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro.Build.0 = pro|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl nt.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl nt.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro nt.ActiveCfg = pro|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro nt.Build.0 = pro|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Release.ActiveCfg = Release|Win32 - {37D9BA79-302E-4582-A545-CB5FF7982EA3}.Release.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.TLS.ActiveCfg = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.TLS.Build.0 = Release|Win32 {37D9BA79-302E-4582-A545-CB5FF7982EA3}.TLS_DEBUG.ActiveCfg = Debug|Win32 @@ -916,32 +905,26 @@ Global {AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.TLS_DEBUG.ActiveCfg = Debug|Win32 {AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}.TLS_DEBUG.Build.0 = Debug|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.classic.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.classic.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Debug.ActiveCfg = Debug|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Debug.Build.0 = Debug|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Classic.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Classic.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Debug.ActiveCfg = Debug|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Debug.Build.0 = Debug|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Pro.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Pro.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_ProGPL.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_ProGPL.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Release.ActiveCfg = Release|Win32 + {94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Release.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Max.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Max.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Max nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Max nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.pro nt.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.pro nt.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.Release.ActiveCfg = Release|Win32 - {94B86159-C581-42CD-825D-C69CBC237E5C}.Release.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.TLS.ActiveCfg = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.TLS.Build.0 = Release|Win32 {94B86159-C581-42CD-825D-C69CBC237E5C}.TLS_DEBUG.ActiveCfg = Debug|Win32 diff --git a/VC++Files/storage/example/example.vcproj b/VC++Files/storage/example/example.vcproj index 3a2daa55676..257a1e77b71 100644 --- a/VC++Files/storage/example/example.vcproj +++ b/VC++Files/storage/example/example.vcproj @@ -24,7 +24,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG" + PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -73,7 +73,7 @@ Optimization="0" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_TLS" + PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="1" PrecompiledHeaderFile=".\example___Win32_TLS_DEBUG/example.pch" @@ -123,7 +123,7 @@ InlineFunctionExpansion="1" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS" + PreprocessorDefinitions="DBUG_OFF;_WINDOWS;NDEBUG;USE_TLS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -172,7 +172,7 @@ Optimization="0" OptimizeForProcessor="2" AdditionalIncludeDirectories="../../include,../../regex,../../sql" - PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS" + PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;WITH_PARTITION_STORAGE_ENGINE" StringPooling="TRUE" RuntimeLibrary="1" PrecompiledHeaderFile=".\debug/example.pch" diff --git a/client/Makefile.am b/client/Makefile.am index d95b4e39c6a..af7c3d2a549 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -21,17 +21,21 @@ if HAVE_YASSL else yassl_dummy_link_fix= endif + +if THREAD_SAFE_CLIENT +LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql_r/libmysqlclient_r.la +else +LIBMYSQLCLIENT_LA = $(top_builddir)/libmysql/libmysqlclient.la +endif + #AUTOMAKE_OPTIONS = nostdinc INCLUDES = -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/regex \ - $(openssl_includes) $(yassl_includes) + $(openssl_includes) $(yassl_includes) LIBS = @CLIENT_LIBS@ LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \ - $(top_builddir)/libmysql/libmysqlclient.la -LDADD_R= @CLIENT_EXTRA_LDFLAGS@ \ - $(CLIENT_THREAD_LIBS) \ - $(top_builddir)/libmysql_r/libmysqlclient_r.la + $(top_builddir)/libmysql/libmysqlclient.la bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \ mysqldump mysqlimport mysqltest mysqlbinlog \ mysqltestmanagerc mysqltestmanager-pwgen \ @@ -41,8 +45,8 @@ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \ mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc mysqladmin_SOURCES = mysqladmin.cc mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) -mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \ - $(yassl_dummy_link_fix) +mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c \ + $(yassl_dummy_link_fix) mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \ $(top_srcdir)/mysys/my_new.cc \ @@ -51,18 +55,22 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \ $(top_srcdir)/mysys/my_vle.c \ $(top_srcdir)/mysys/base64.c mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) -mysqlslap_LDADD = $(CXXLDFLAGS) $(LDADD_R) \ - $(top_builddir)/mysys/libmysys.a -mysqlimport_LDADD = $(CXXLDFLAGS) $(LDADD_R) \ - $(top_builddir)/mysys/libmysys.a -mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c -mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix) -mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix) -mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix) -mysqlslap_SOURCES= mysqlslap.c \ +mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ + @CLIENT_EXTRA_LDFLAGS@ \ + $(LIBMYSQLCLIENT_LA) \ + $(top_builddir)/mysys/libmysys.a +mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ + @CLIENT_EXTRA_LDFLAGS@ \ + $(LIBMYSQLCLIENT_LA) \ + $(top_builddir)/mysys/libmysys.a +mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c +mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix) +mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix) +mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix) +mysqlslap_SOURCES= mysqlslap.c \ $(yassl_dummy_link_fix) -mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix) -mysqlimport_SOURCES= mysqlimport.c \ +mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix) +mysqlimport_SOURCES= mysqlimport.c \ $(yassl_dummy_link_fix) sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc strings_src=decimal.c diff --git a/config/ac-macros/replication.m4 b/config/ac-macros/replication.m4 index f73b9319b86..3a0c83d6498 100644 --- a/config/ac-macros/replication.m4 +++ b/config/ac-macros/replication.m4 @@ -7,8 +7,8 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([MYSQL_CHECK_REPLICATION], [ AC_ARG_WITH([row-based-replication], - AC_HELP_STRING([--with-row-based-replication], - [Include row-based replication]), + AC_HELP_STRING([--without-row-based-replication], + [Don't include row-based replication]), [row_based="$withval"], [row_based=yes]) AC_MSG_CHECKING([for row-based replication]) diff --git a/configure.in b/configure.in index 6519f997d24..f7017e4455c 100644 --- a/configure.in +++ b/configure.in @@ -592,10 +592,10 @@ AC_ARG_WITH(named-curses-libs, # Make thread safe client AC_ARG_ENABLE(thread-safe-client, - [ --enable-thread-safe-client - Compile the client with threads.], + [ --disable-thread-safe-client + Compile the client without threads.], [ THREAD_SAFE_CLIENT=$enableval ], - [ THREAD_SAFE_CLIENT=no ] + [ THREAD_SAFE_CLIENT=yes ] ) # compile with strings functions in assembler @@ -1567,7 +1567,8 @@ then fi AC_ARG_WITH(debug, - [ --without-debug Build a production version without debugging code], + [ --with-debug Add debug code + --with-debug=full Add debug code (adds memory checker, very slow)], [with_debug=$withval], [with_debug=no]) if test "$with_debug" = "yes" @@ -2475,6 +2476,8 @@ dnl client is just using plain-old libs. sql_client_dirs="strings regex mysys libmysql client" linked_client_targets="linked_libmysql_sources" +AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no") + if test "$THREAD_SAFE_CLIENT" != "no" then sql_client_dirs="libmysql_r $sql_client_dirs" diff --git a/include/config-win.h b/include/config-win.h index e69b5d511db..fb7aeb82e83 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -427,6 +427,7 @@ inline double ulonglong2double(ulonglong value) #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 +#define HAVE_ROW_BASED_REPLICATION 1 /* #undef HAVE_OPENSSL */ /* #undef HAVE_YASSL */ diff --git a/mysql-test/include/drop-on-restart.inc b/mysql-test/include/drop-on-restart.inc index 841b636483a..af1d0d893e0 100644 --- a/mysql-test/include/drop-on-restart.inc +++ b/mysql-test/include/drop-on-restart.inc @@ -23,6 +23,7 @@ drop database if exists db1_secret; drop database if exists db2; drop database if exists federated; drop database if exists mysqldump_test_db; +drop database if exists mysqlslap; drop database if exists mysqltest1; drop database if exists mysqltest2; drop database if exists mysqltest3; @@ -34,6 +35,7 @@ drop database if exists mysqltest_bob; drop database if exists mysqltest_db1; drop database if exists mysqltest_prometheus; drop database if exists mysqltest_sisyfos; +drop database if exists ndbsynctest; drop database if exists ndbtest1; drop database if exists rewrite; drop database if exists test2; @@ -429,6 +431,7 @@ drop table if exists new_t2; drop table if exists not_exist; drop table if exists r1; drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t21,t70; +drop table if exists t00,t03,t04; drop table if exists t0_template; drop table if exists t1Aa,t2Aa,v1Aa,v2Aa; drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 6d28ecd8552..c6d341472b7 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -315,4 +315,37 @@ drop table t1; create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20)); alter table t1 add partition (partition x3 values in (30)); drop table t1; +CREATE TABLE t1 ( +f_int1 INTEGER, f_int2 INTEGER, +f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) +) +PARTITION BY RANGE(f_int1 DIV 2) +SUBPARTITION BY HASH(f_int1) +SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION parte VALUES LESS THAN (10), +PARTITION partf VALUES LESS THAN (2147483647)); +INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR), +f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#'; +SELECT * FROM t1 WHERE f_int1 IS NULL; +f_int1 f_int2 f_char1 f_char2 f_charbig +NULL -20 -20 -20 #NULL# +SELECT * FROM t1; +f_int1 f_int2 f_char1 f_char2 f_charbig +NULL -20 -20 -20 #NULL# +drop table t1; +CREATE TABLE t1 ( +f_int1 INTEGER, f_int2 INTEGER, +f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) ) +PARTITION BY LIST(MOD(f_int1,2)) +SUBPARTITION BY KEY(f_int1) +(PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2), +PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5), +PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6)); +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; +SELECT * FROM t1 WHERE f_int1 IS NULL; +f_int1 f_int2 f_char1 f_char2 f_charbig +drop table t1; End of 5.1 tests diff --git a/mysql-test/r/rpl_alter_db.result b/mysql-test/r/rpl_alter_db.result new file mode 100644 index 00000000000..6edbe5d427f --- /dev/null +++ b/mysql-test/r/rpl_alter_db.result @@ -0,0 +1,8 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +use mysql; +alter database collate latin1_bin; diff --git a/mysql-test/r/rpl_bit_npk.result b/mysql-test/r/rpl_bit_npk.result index aeefc77d69b..2850e63aabd 100644 --- a/mysql-test/r/rpl_bit_npk.result +++ b/mysql-test/r/rpl_bit_npk.result @@ -45,25 +45,27 @@ GSuppDf TINYINT, VNotSupp TINYINT, x034 TINYINT); LOCK TABLES test.t1 WRITE; -INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1); +INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1); INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); +INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); UNLOCK TABLES; +UPDATE test.t1 set x034 = 50 where bit3 = b'000000'; +UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0'; SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; oSupp sSuppD GSuppDf VNotSupp x034 +5 5 3 NULL 1 5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 +5 5 3 33 1 +5 5 3 2 50 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 SELECT hex(bit1) from test.t1; hex(bit1) 3F @@ -96,14 +98,14 @@ hex(bit3) 1 SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; oSupp sSuppD GSuppDf VNotSupp x034 +5 5 3 NULL 1 5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 -5 5 3 2 1 +5 5 3 33 1 +5 5 3 2 50 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 +5 5 3 33 1 SELECT hex(bit1) from test.t1; hex(bit1) 3F @@ -134,4 +136,30 @@ hex(bit3) 1 1 1 +CREATE TABLE test.t2 (a INT, b BIT(1)); +INSERT INTO test.t2 VALUES (1, b'0'); +INSERT INTO test.t2 VALUES (1, b'1'); +UPDATE test.t2 SET a = 2 WHERE b = b'1'; +CREATE TABLE test.t3 (a INT, b INT); +INSERT INTO test.t3 VALUES (1, NULL); +INSERT INTO test.t3 VALUES (1, 0); +UPDATE test.t3 SET a = 2 WHERE b = 0; +SELECT a, hex(b) FROM test.t2; +a hex(b) +1 0 +2 1 +SELECT * FROM test.t3; +a b +1 NULL +2 0 +SELECT a, hex(b) FROM test.t2; +a hex(b) +1 0 +2 1 +SELECT * FROM test.t3; +a b +1 NULL +2 0 DROP TABLE IF EXISTS test.t1; +DROP TABLE IF EXISTS test.t2; +DROP TABLE IF EXISTS test.t3; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 4845aecb88d..6e8314860a3 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -20,7 +20,7 @@ ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING] ndb_load : Bug#17233 partition_03ndb : Bug#16385 ps_7ndb : dbug assert in RBR mode when executing test suite -rpl_bit_npk : Bug#13418 +#rpl_bit_npk : Bug#13418 rpl_ddl : Bug#15963 SBR does not show "Definer" correctly rpl_ndb_2innodb : Bugs#17400, 17687, 17701 rpl_ndb_2myisam : Bugs#17400, 17687, 17701 diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 4760219c911..92b0ec55953 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -408,4 +408,44 @@ create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUE alter table t1 add partition (partition x3 values in (30)); drop table t1; +# +# Bug #17432: Partition functions containing NULL values should return +# LONGLONG_MIN +# +CREATE TABLE t1 ( + f_int1 INTEGER, f_int2 INTEGER, + f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) + ) + PARTITION BY RANGE(f_int1 DIV 2) + SUBPARTITION BY HASH(f_int1) + SUBPARTITIONS 2 + (PARTITION parta VALUES LESS THAN (0), + PARTITION partb VALUES LESS THAN (5), + PARTITION parte VALUES LESS THAN (10), + PARTITION partf VALUES LESS THAN (2147483647)); +INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR), + f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#'; +SELECT * FROM t1 WHERE f_int1 IS NULL; +SELECT * FROM t1; +drop table t1; + +# +# Bug 17430: Crash when SELECT * from t1 where field IS NULL +# + +CREATE TABLE t1 ( + f_int1 INTEGER, f_int2 INTEGER, + f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) ) + PARTITION BY LIST(MOD(f_int1,2)) + SUBPARTITION BY KEY(f_int1) + (PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2), + PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5), + PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6)); + +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; +INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2==='; + +SELECT * FROM t1 WHERE f_int1 IS NULL; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/rpl_alter_db.test b/mysql-test/t/rpl_alter_db.test new file mode 100644 index 00000000000..5ac8a2f4018 --- /dev/null +++ b/mysql-test/t/rpl_alter_db.test @@ -0,0 +1,10 @@ +source include/master-slave.inc; +connection master; +use mysql; # to be different from initial `test' db of mysqltest client +alter database collate latin1_bin; +save_master_pos; + +connection slave; +sync_with_master; + + diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 073964d4bde..8c0c539f3f2 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -163,11 +163,7 @@ s_echo() } s_echo "This script updates all the mysql privilege tables to be usable by" -s_echo "MySQL 4.0 and above." -s_echo "" -s_echo "This is needed if you want to use the new GRANT functions," -s_echo "CREATE AGGREGATE FUNCTION, stored procedures, or" -s_echo "more secure passwords in 4.1" +s_echo "MySQL 5.1 and above." s_echo "" if test $verbose = 1 diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 169c606280a..478d6b48c73 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -630,6 +630,9 @@ CREATE TABLE event ( # EVENT privilege # +SET @hadEventPriv := 0; +SELECT @hadEventPriv :=1 FROM user WHERE Event_priv LIKE '%'; + ALTER TABLE user add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv; ALTER TABLE db add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL; ALTER TABLE event DROP PRIMARY KEY; @@ -667,6 +670,8 @@ ALTER TABLE event ADD sql_mode 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL AFTER on_completion; +UPDATE user SET Event_priv=Super_priv WHERE @hadEventPriv = 0; + -- -- TRIGGER privilege -- diff --git a/sql/field.h b/sql/field.h index ad8b34594b7..3fbdc0d0aa9 100644 --- a/sql/field.h +++ b/sql/field.h @@ -173,8 +173,9 @@ public: virtual int cmp(const char *,const char *)=0; virtual int cmp_binary(const char *a,const char *b, uint32 max_length=~0L) { return memcmp(a,b,pack_length()); } - int cmp_offset(uint row_offset) { return cmp(ptr,ptr+row_offset); } - int cmp_binary_offset(uint row_offset) + virtual int cmp_offset(uint row_offset) + { return cmp(ptr,ptr+row_offset); } + virtual int cmp_binary_offset(uint row_offset) { return cmp_binary(ptr, ptr+row_offset); }; virtual int key_cmp(const byte *a,const byte *b) { return cmp((char*) a,(char*) b); } @@ -1317,6 +1318,20 @@ public: }; +/* + Note: + To use Field_bit::cmp_binary() you need to copy the bits stored in + the beginning of the record (the NULL bytes) to each memory you + want to compare (where the arguments point). + + This is the reason: + - Field_bit::cmp_binary() is only implemented in the base class + (Field::cmp_binary()). + - Field::cmp_binary() currenly use pack_length() to calculate how + long the data is. + - pack_length() includes size of the bits stored in the NULL bytes + of the record. +*/ class Field_bit :public Field { public: uchar *bit_ptr; // position in record where 'uneven' bits store @@ -1342,6 +1357,8 @@ public: my_decimal *val_decimal(my_decimal *); int cmp(const char *a, const char *b) { return cmp_binary(a, b); } + int cmp_binary_offset(uint row_offset) + { return cmp_offset(row_offset); } int cmp_max(const char *a, const char *b, uint max_length); int key_cmp(const byte *a, const byte *b) { return cmp_binary((char *) a, (char *) b); } diff --git a/sql/log_event.cc b/sql/log_event.cc index 3469d236b8e..e589f46e0e0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5601,7 +5601,7 @@ bool Rows_log_event::write_data_body(IO_CACHE*file) char sbuf[sizeof(m_width)]; my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf; - char *const sbuf_end= net_store_length(sbuf, (uint) m_width); + char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width); DBUG_ASSERT(static_cast(sbuf_end - sbuf) <= sizeof(sbuf)); return (my_b_safe_write(file, reinterpret_cast(sbuf), @@ -6050,7 +6050,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) byte const tbuf[]= { m_tbllen }; char cbuf[sizeof(m_colcnt)]; - char *const cbuf_end= net_store_length(cbuf, (uint) m_colcnt); + char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt); DBUG_ASSERT(static_cast(cbuf_end - cbuf) <= sizeof(cbuf)); return (my_b_safe_write(file, dbuf, sizeof(dbuf)) || @@ -6058,7 +6058,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) my_b_safe_write(file, tbuf, sizeof(tbuf)) || my_b_safe_write(file, (const byte*)m_tblnam, m_tbllen+1) || my_b_safe_write(file, reinterpret_cast(cbuf), - cbuf_end - cbuf) || + cbuf_end - (char*) cbuf) || my_b_safe_write(file, reinterpret_cast(m_coltype), m_colcnt)); } #endif @@ -6365,18 +6365,27 @@ void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) **************************************************************************/ #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -static int record_compare(TABLE *table, char const *a, char const *b) +/* + Compares table->record[0] and table->record[1] + + Returns TRUE if different. +*/ +static bool record_compare(TABLE *table) { - for (my_size_t i= 0 ; i < table->s->fields ; ++i) + if (table->s->blob_fields + table->s->varchar_fields == 0) + return cmp_record(table,record[1]); + /* Compare null bits */ + if (memcmp(table->null_flags, + table->null_flags+table->s->rec_buff_length, + table->s->null_bytes)) + return TRUE; // Diff in NULL value + /* Compare updated fields */ + for (Field **ptr=table->field ; *ptr ; ptr++) { - uint const off= table->field[i]->offset(); - uint const res= table->field[i]->cmp_binary(a + off, - b + off); - if (res != 0) { - return res; - } + if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length)) + return TRUE; } - return 0; + return FALSE; } @@ -6384,15 +6393,12 @@ static int record_compare(TABLE *table, char const *a, char const *b) Find the row given by 'key', if the table has keys, or else use a table scan to find (and fetch) the row. If the engine allows random access of the records, a combination of position() and rnd_pos() will be used. - - The 'record_buf' will be used as buffer for records while locating the - correct row. */ -static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) +static int find_and_fetch_row(TABLE *table, byte *key) { DBUG_ENTER("find_and_fetch_row(TABLE *table, byte *key, byte *record)"); DBUG_PRINT("enter", ("table=%p, key=%p, record=%p", - table, key, record_buf)); + table, key, table->record[1])); DBUG_ASSERT(table->in_use != NULL); @@ -6410,7 +6416,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) DBUG_RETURN(table->file->rnd_pos(table->record[0], table->file->ref)); } - DBUG_ASSERT(record_buf); + DBUG_ASSERT(table->record[1]); /* We need to retrieve all fields */ table->file->ha_set_all_bits_in_read_set(); @@ -6418,7 +6424,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) if (table->s->keys > 0) { int error; - if ((error= table->file->index_read_idx(record_buf, 0, key, + if ((error= table->file->index_read_idx(table->record[1], 0, key, table->key_info->key_length, HA_READ_KEY_EXACT))) { @@ -6443,10 +6449,10 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) if (table->key_info->flags & HA_NOSAME) DBUG_RETURN(0); - while (record_compare(table, (const char*)table->record[0], (const char*)record_buf) != 0) + while (record_compare(table)) { int error; - if ((error= table->file->index_next(record_buf))) + if ((error= table->file->index_next(table->record[1]))) { table->file->print_error(error, MYF(0)); DBUG_RETURN(error); @@ -6460,7 +6466,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) int error= 0; do { - error= table->file->rnd_next(record_buf); + error= table->file->rnd_next(table->record[1]); switch (error) { case 0: @@ -6477,9 +6483,7 @@ static int find_and_fetch_row(TABLE *table, byte *key, byte *record_buf) DBUG_RETURN(error); } } - while (restart_count < 2 && - record_compare(table, (const char*)table->record[0], - (const char*)record_buf) != 0); + while (restart_count < 2 && record_compare(table)); DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0); DBUG_RETURN(error); @@ -6499,7 +6503,7 @@ Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg, bool is_transactional) : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional) #ifdef HAVE_REPLICATION - ,m_memory(NULL), m_key(NULL), m_search_record(NULL) + ,m_memory(NULL), m_key(NULL), m_after_image(NULL) #endif { } @@ -6516,7 +6520,7 @@ Delete_rows_log_event::Delete_rows_log_event(const char *buf, uint event_len, : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event) #else : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event), - m_memory(NULL), m_key(NULL), m_search_record(NULL) + m_memory(NULL), m_key(NULL), m_after_image(NULL) #endif { } @@ -6531,7 +6535,7 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table) table->s->primary_key < MAX_KEY) { /* - We don't need to allocate any memory for m_search_record and + We don't need to allocate any memory for m_after_image and m_key since they are not used. */ return 0; @@ -6543,14 +6547,14 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table) { m_memory= my_multi_malloc(MYF(MY_WME), - &m_search_record, table->s->reclength, + &m_after_image, table->s->reclength, &m_key, table->key_info->key_length, NULL); } else { - m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); - m_memory= (gptr)m_search_record; + m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); + m_memory= (gptr)m_after_image; m_key= NULL; } if (!m_memory) @@ -6577,7 +6581,7 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error) table->file->ha_index_or_rnd_end(); my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc m_memory= NULL; - m_search_record= NULL; + m_after_image= NULL; m_key= NULL; return error; @@ -6615,7 +6619,7 @@ int Delete_rows_log_event::do_exec_row(TABLE *table) { DBUG_ASSERT(table != NULL); - int error= find_and_fetch_row(table, m_key, m_search_record); + int error= find_and_fetch_row(table, m_key); if (error) return error; @@ -6687,30 +6691,20 @@ int Update_rows_log_event::do_before_row_operations(TABLE *table) { DBUG_ASSERT(m_memory == NULL); - if ((table->file->table_flags() & HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS) && - table->s->primary_key < MAX_KEY) - { - /* - We don't need to allocate any memory for m_search_record and - m_key since they are not used. - */ - return 0; - } - int error= 0; if (table->s->keys > 0) { m_memory= my_multi_malloc(MYF(MY_WME), - &m_search_record, table->s->reclength, + &m_after_image, table->s->reclength, &m_key, table->key_info->key_length, NULL); } else { - m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); - m_memory= (gptr)m_search_record; + m_after_image= (byte*)my_malloc(table->s->reclength, MYF(MY_WME)); + m_memory= (gptr)m_after_image; m_key= NULL; } if (!m_memory) @@ -6738,7 +6732,7 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error) table->file->ha_index_or_rnd_end(); my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); m_memory= NULL; - m_search_record= NULL; + m_after_image= NULL; m_key= NULL; return error; @@ -6758,8 +6752,8 @@ char const *Update_rows_log_event::do_prepare_row(THD *thd, TABLE *table, /* record[0] is the before image for the update */ ptr= unpack_row(table, table->record[0], ptr, &m_cols); DBUG_ASSERT(ptr != NULL); - /* record[1] is the after image for the update */ - ptr= unpack_row(table, table->record[1], ptr, &m_cols); + /* m_after_image is the after image for the update */ + ptr= unpack_row(table, m_after_image, ptr, &m_cols); /* If we will access rows using the random access method, m_key will @@ -6779,10 +6773,19 @@ int Update_rows_log_event::do_exec_row(TABLE *table) { DBUG_ASSERT(table != NULL); - int error= find_and_fetch_row(table, m_key, m_search_record); + int error= find_and_fetch_row(table, m_key); if (error) return error; + /* + This is only a precaution to make sure that the call to + ha_update_row is using record[1]. + + If this is not needed/required, then we could use m_after_image in + that call instead. + */ + bmove_align(table->record[1], m_after_image,(size_t) table->s->reclength); + /* Now we should have the right row to update. The record that has been fetched is guaranteed to be in record[0], so we use that. diff --git a/sql/log_event.h b/sql/log_event.h index 25e04f66d74..dd68e969ff1 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2005,7 +2005,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) gptr m_memory; - byte *m_search_record; + byte *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); @@ -2069,7 +2069,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) gptr m_memory; byte *m_key; - byte *m_search_record; + byte *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); @@ -2139,7 +2139,7 @@ private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) gptr m_memory; byte *m_key; - byte *m_search_record; + byte *m_after_image; virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index bebee7df8b2..b9bfe7b508b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -471,10 +471,10 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) /* - if it is pre 5.1.4 privilege table then map CREATE privilege on + if it is pre 5.1.6 privilege table then map CREATE privilege on CREATE|ALTER|DROP|EXECUTE EVENT */ - if (table->s->fields <= 37 && (user.access & CREATE_ACL)) + if (table->s->fields <= 37 && (user.access & SUPER_ACL)) user.access|= EVENT_ACL; /* diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a482018218d..ebb3fa32f8f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3717,7 +3717,7 @@ end_with_restore_list: } if (!strip_sp(db) || check_db_name(db)) { - my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); + my_error(ER_WRONG_DB_NAME, MYF(0), db); break; } /* @@ -3729,8 +3729,8 @@ end_with_restore_list: */ #ifdef HAVE_REPLICATION if (thd->slave_thread && - (!rpl_filter->db_ok(lex->name) || - !rpl_filter->db_ok_with_wild_table(lex->name))) + (!rpl_filter->db_ok(db) || + !rpl_filter->db_ok_with_wild_table(db))) { my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0)); break; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 07ca28c69bc..728efb82b9f 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2341,6 +2341,29 @@ bool partition_key_modified(TABLE *table, List &fields) } +/* + A function to handle correct handling of NULL values in partition + functions. + SYNOPSIS + part_val_int() + item_expr The item expression to evaluate + RETURN VALUES + The value of the partition function, LONGLONG_MIN if any null value + in function +*/ + +static +inline +longlong +part_val_int(Item *item_expr) +{ + longlong value= item_expr->val_int(); + if (item_expr->null_value) + value= LONGLONG_MIN; + return value; +} + + /* The next set of functions are used to calculate the partition identity. A handler sets up a variable that corresponds to one of these functions @@ -2437,7 +2460,7 @@ static uint32 get_part_id_hash(uint no_parts, longlong *func_value) { DBUG_ENTER("get_part_id_hash"); - *func_value= part_expr->val_int(); + *func_value= part_val_int(part_expr); longlong int_hash_id= *func_value % no_parts; DBUG_RETURN(int_hash_id < 0 ? -int_hash_id : int_hash_id); } @@ -2466,7 +2489,7 @@ static uint32 get_part_id_linear_hash(partition_info *part_info, { DBUG_ENTER("get_part_id_linear_hash"); - *func_value= part_expr->val_int(); + *func_value= part_val_int(part_expr); DBUG_RETURN(get_part_id_from_linear_hash(*func_value, part_info->linear_hash_mask, no_parts)); @@ -2604,7 +2627,7 @@ int get_partition_id_list(partition_info *part_info, longlong list_value; int min_list_index= 0; int max_list_index= part_info->no_list_values - 1; - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); DBUG_ENTER("get_partition_id_list"); *func_value= part_func_value; @@ -2680,7 +2703,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, longlong list_value; uint min_list_index= 0, max_list_index= part_info->no_list_values - 1; /* Get the partitioning function value for the endpoint */ - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); while (max_list_index >= min_list_index) { list_index= (max_list_index + min_list_index) >> 1; @@ -2714,7 +2737,7 @@ int get_partition_id_range(partition_info *part_info, uint min_part_id= 0; uint max_part_id= max_partition; uint loc_part_id; - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); DBUG_ENTER("get_partition_id_int_range"); while (max_part_id > min_part_id) @@ -2789,7 +2812,7 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, uint max_partition= part_info->no_parts - 1; uint min_part_id= 0, max_part_id= max_partition, loc_part_id; /* Get the partitioning function value for the endpoint */ - longlong part_func_value= part_info->part_expr->val_int(); + longlong part_func_value= part_val_int(part_info->part_expr); while (max_part_id > min_part_id) { loc_part_id= (max_part_id + min_part_id + 1) >> 1; diff --git a/storage/ndb/src/common/transporter/Transporter.cpp b/storage/ndb/src/common/transporter/Transporter.cpp index 377fabe27ab..820aa4cfc18 100644 --- a/storage/ndb/src/common/transporter/Transporter.cpp +++ b/storage/ndb/src/common/transporter/Transporter.cpp @@ -105,10 +105,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) { } { - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r= getpeername(sockfd, &addr, &addrlen); - m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; + int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); + m_connect_address= (&addr)->sin_addr; } bool res = connect_server_impl(sockfd); @@ -198,10 +198,10 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) { } { - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r= getpeername(sockfd, &addr, &addrlen); - m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr; + int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); + m_connect_address= (&addr)->sin_addr; } bool res = connect_client_impl(sockfd); diff --git a/storage/ndb/src/mgmsrv/Services.cpp b/storage/ndb/src/mgmsrv/Services.cpp index 3564c5c40ba..aebadec933c 100644 --- a/storage/ndb/src/mgmsrv/Services.cpp +++ b/storage/ndb/src/mgmsrv/Services.cpp @@ -451,9 +451,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &, return; } - struct sockaddr addr; + struct sockaddr_in addr; SOCKET_SIZE_TYPE addrlen= sizeof(addr); - int r = getpeername(m_socket, &addr, &addrlen); + int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen); if (r != 0 ) { m_output->println(cmd); m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r); @@ -465,7 +465,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &, if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){ BaseString error_string; if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, - &addr, &addrlen, error_string)){ + (struct sockaddr*)&addr, &addrlen, error_string)){ const char *alias; const char *str; alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)