diff --git a/CMakeLists.txt b/CMakeLists.txt index 538c5cb122e..1bdb1e01612 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,7 @@ IF(EMBED_MANIFESTS) ENDIF(NOT tmp_manifest) # Set the processor architecture. IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") - SET(PROCESSOR_ARCH "X64") + SET(PROCESSOR_ARCH "amd64") ELSE(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") SET(PROCESSOR_ARCH "X86") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") diff --git a/include/my_global.h b/include/my_global.h index d6f331019f6..30fa2aba41b 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -968,7 +968,12 @@ typedef unsigned long uint32; typedef unsigned long ulong; /* Short for unsigned long */ #endif #ifndef longlong_defined -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 +/* + Using [unsigned] long long is preferable as [u]longlong because we use + [unsigned] long long unconditionally in many places, + for example in constants with [U]LL suffix. +*/ +#if defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8 typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ typedef long long int longlong; #else diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index e838acbed35..02d5a92ea38 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -49,6 +49,98 @@ show binlog events in 'master-bin.000001' from 106; --replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// show binlog events in 'master-bin.000002' from 106; + +# +# Bug#22540 - Incorrect value in column End_log_pos of +# SHOW BINLOG EVENTS using InnoDB +# + +# the following tests will show that certain queries now return +# absolute offsets (from binlog start, rather than relative to +# the beginning of the current transaction). under what +# conditions it should be allowed / is sensible to put the +# slider into the middle of a transaction is not our concern +# here; we just guarantee that if and when it's done, the +# user has valid offsets to use. if the setter function still +# wants to throw a "positioning into middle of transaction" +# warning, that's its prerogative and handled elsewhere. + +set @ac = @@autocommit; + +# first show this to work for SHOW BINLOG EVENTS + +set autocommit= 0; +reset master; +create table t1(n int) engine=innodb; +begin; +insert into t1 values (1); +insert into t1 values (2); +insert into t1 values (3); +commit; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +set autocommit= 1; +reset master; +create table t1(n int) engine=innodb; +insert into t1 values (1); +insert into t1 values (2); +insert into t1 values (3); +commit; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +reset master; +create table t1(n int) engine=myisam; +begin; +insert into t1 values (4); +insert into t1 values (5); +insert into t1 values (6); +commit; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +# now show this also works for SHOW MASTER STATUS +# as this is what "mysqldump --master-data=1" uses. + +set autocommit= 1; +reset master; +create table t1(n int) engine=innodb; +show master status; +insert into t1 values (1); +show master status; +insert into t1 values (2); +insert into t1 values (3); +show master status; +commit; +show master status; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +set autocommit= 0; +reset master; +create table t1(n int) engine=myisam; +show master status; +insert into t1 values (4); +show master status; +insert into t1 values (5); +insert into t1 values (6); + +show master status; +commit; +show master status; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + +set session autocommit = @ac; + +--echo End of 5.0 tests + # Test of a too big SET INSERT_ID: see if the truncated value goes # into binlog (right), or the too big value (wrong); we look at the # binlog further down with SHOW BINLOG EVENTS. diff --git a/mysql-test/r/binlog_stm_binlog.result b/mysql-test/r/binlog_stm_binlog.result index 66fe3e40270..1bc7430fde0 100644 --- a/mysql-test/r/binlog_stm_binlog.result +++ b/mysql-test/r/binlog_stm_binlog.result @@ -7,7 +7,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 106 Server ver: #, Binlog ver: # master-bin.000001 106 Query 1 213 use `test`; create table t1 (a int, b int) engine=innodb master-bin.000001 213 Query 1 281 use `test`; BEGIN -master-bin.000001 281 Query 1 90 use `test`; insert into t1 values (1,2) +master-bin.000001 281 Query 1 371 use `test`; insert into t1 values (1,2) master-bin.000001 371 Xid 1 398 COMMIT /* XID */ drop table t1; drop table if exists t1, t2; @@ -145,6 +145,122 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002' from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query 1 # use `test`; drop table t1 +set @ac = @@autocommit; +set autocommit= 0; +reset master; +create table t1(n int) engine=innodb; +begin; +insert into t1 values (1); +insert into t1 values (2); +insert into t1 values (3); +commit; +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb +master-bin.000001 205 Query 1 273 use `test`; BEGIN +master-bin.000001 273 Query 1 361 use `test`; insert into t1 values (1) +master-bin.000001 361 Query 1 449 use `test`; insert into t1 values (2) +master-bin.000001 449 Query 1 537 use `test`; insert into t1 values (3) +master-bin.000001 537 Xid 1 564 COMMIT /* XID */ +master-bin.000001 564 Query 1 640 use `test`; drop table t1 +set autocommit= 1; +reset master; +create table t1(n int) engine=innodb; +insert into t1 values (1); +insert into t1 values (2); +insert into t1 values (3); +commit; +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb +master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (1) +master-bin.000001 293 Xid 1 320 COMMIT /* XID */ +master-bin.000001 320 Query 1 408 use `test`; insert into t1 values (2) +master-bin.000001 408 Xid 1 435 COMMIT /* XID */ +master-bin.000001 435 Query 1 523 use `test`; insert into t1 values (3) +master-bin.000001 523 Xid 1 550 COMMIT /* XID */ +master-bin.000001 550 Query 1 626 use `test`; drop table t1 +reset master; +create table t1(n int) engine=myisam; +begin; +insert into t1 values (4); +insert into t1 values (5); +insert into t1 values (6); +commit; +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam +master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (4) +master-bin.000001 293 Query 1 381 use `test`; insert into t1 values (5) +master-bin.000001 381 Query 1 469 use `test`; insert into t1 values (6) +master-bin.000001 469 Query 1 545 use `test`; drop table t1 +set autocommit= 1; +reset master; +create table t1(n int) engine=innodb; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 205 +insert into t1 values (1); +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 320 +insert into t1 values (2); +insert into t1 values (3); +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 550 +commit; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 550 +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb +master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (1) +master-bin.000001 293 Xid 1 320 COMMIT /* XID */ +master-bin.000001 320 Query 1 408 use `test`; insert into t1 values (2) +master-bin.000001 408 Xid 1 435 COMMIT /* XID */ +master-bin.000001 435 Query 1 523 use `test`; insert into t1 values (3) +master-bin.000001 523 Xid 1 550 COMMIT /* XID */ +master-bin.000001 550 Query 1 626 use `test`; drop table t1 +set autocommit= 0; +reset master; +create table t1(n int) engine=myisam; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 205 +insert into t1 values (4); +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 293 +insert into t1 values (5); +insert into t1 values (6); +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 469 +commit; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 469 +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam +master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (4) +master-bin.000001 293 Query 1 381 use `test`; insert into t1 values (5) +master-bin.000001 381 Query 1 469 use `test`; insert into t1 values (6) +master-bin.000001 469 Query 1 545 use `test`; drop table t1 +set session autocommit = @ac; +End of 5.0 tests reset master; create table t1 (id tinyint auto_increment primary key); set insert_id=128; diff --git a/sql/log.cc b/sql/log.cc index 6dc204265b0..de5d94a2e93 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3945,9 +3945,65 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log) if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) return ER_ERROR_ON_WRITE; - uint bytes= my_b_bytes_in_cache(cache); + uint bytes= my_b_bytes_in_cache(cache), group, carry, hdr_offs; + long val; + uchar header[LOG_EVENT_HEADER_LEN]; + + group= my_b_tell(&log_file); + hdr_offs= carry= 0; + do { + if (likely(carry > 0)) + { + DBUG_ASSERT(carry < LOG_EVENT_HEADER_LEN); + + memcpy(&header[carry], (char *)cache->read_pos, LOG_EVENT_HEADER_LEN - carry); + + val= uint4korr(&header[LOG_POS_OFFSET]) + group; + int4store(&header[LOG_POS_OFFSET], val); + + if (my_b_write(&log_file, header, carry)) + return ER_ERROR_ON_WRITE; + + memcpy((char *)cache->read_pos, &header[carry], LOG_EVENT_HEADER_LEN - carry); + + hdr_offs = LOG_EVENT_HEADER_LEN - carry + + uint4korr(&header[EVENT_LEN_OFFSET]); + + carry= 0; + } + + if(likely(bytes > 0)) + { + do { + DBUG_ASSERT((hdr_offs + max(EVENT_LEN_OFFSET, LOG_POS_OFFSET) + 4) <= bytes); + + val= uint4korr((char *)cache->read_pos + hdr_offs + LOG_POS_OFFSET) + group; + int4store((char *)cache->read_pos + hdr_offs + LOG_POS_OFFSET, val); + hdr_offs += uint4korr((char *)cache->read_pos + hdr_offs + EVENT_LEN_OFFSET); + + /* header beyond current read-buffer? */ + if (hdr_offs >= bytes) + { + hdr_offs -= bytes; + break; + } + + /* split header? */ + if (hdr_offs + LOG_EVENT_HEADER_LEN > bytes) + { + carry= bytes - hdr_offs; + + memcpy(header, (char *)cache->read_pos + hdr_offs, carry); + bytes -= carry; + } + + } while (hdr_offs < bytes); + } + + /* Write data to the binary log file */ + if (my_b_write(&log_file, cache->read_pos, bytes)) return ER_ERROR_ON_WRITE; cache->read_pos= cache->read_end; @@ -4028,7 +4084,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) if ((write_error= write_cache(cache, false, false))) goto err; - + if (commit_event && commit_event->write(&log_file)) goto err; if (flush_and_sync()) diff --git a/win/create_manifest.js b/win/create_manifest.js index 520ecec21b8..8569bd508ff 100755 --- a/win/create_manifest.js +++ b/win/create_manifest.js @@ -1,11 +1,10 @@ /* manifest.js - Writes a custom XML manifest for each executable/library - 6 command line options must be supplied: + 5 command line options must be supplied: name - Name of the executable/library into which the mainfest will be embedded. version - Version of the executable arch - Architecture intended. - type - Application type. exe_level - Application execution level. [asInvoker|highestAvailable|requireAdministrator] outfile - Final destination where mainfest will be written. @@ -37,9 +36,6 @@ try case "arch": var app_arch= parts[1]; break; - case "type": - var app_type= parts[1]; - break; case "exe_level": var app_exe_level= parts[1]; break; @@ -50,7 +46,7 @@ try WScript.echo("Invalid argument supplied."); } } - if (i != 6) + if (i != 5) throw new Error(1, "Incorrect number of arguments."); var manifest_xml= "\r\n"; @@ -61,7 +57,7 @@ try manifest_xml+= " version=\'" + app_version + "\'"; manifest_xml+= " processorArchitecture=\'" + app_arch + "\'"; // TOADD - Add publicKeyToken attribute once we have Authenticode key. - manifest_xml+= " type=\'" + app_type + "\' />\r\n"; + manifest_xml+= " type=\'win32\' />\r\n"; // Identify the application security requirements. manifest_xml+= "\t\r\n"; manifest_xml+= "\t\t\r\n\t\t\t\r\n\t\t\t\t"; diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake index b5bb6fda8fb..4c88be1d800 100755 --- a/win/mysql_manifest.cmake +++ b/win/mysql_manifest.cmake @@ -9,7 +9,7 @@ MACRO(MYSQL_EMBED_MANIFEST _target_name _required_privs) TARGET ${_target_name} PRE_LINK COMMAND cscript.exe - ARGS "${PROJECT_SOURCE_DIR}/win/create_manifest.js" name=$(ProjectName) version=${VERSION} arch=${PROCESSOR_ARCH} type=$(PlatformName) exe_level=${_required_privs} outfile=$(IntDir)\\$(TargetFileName).intermediate.manifest + ARGS "${PROJECT_SOURCE_DIR}/win/create_manifest.js" name=$(ProjectName) version=${VERSION} arch=${PROCESSOR_ARCH} exe_level=${_required_privs} outfile=$(IntDir)\\$(TargetFileName).intermediate.manifest COMMENT "Generates the contents of the manifest contents.") ADD_CUSTOM_COMMAND( TARGET ${_target_name}