diff options
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | myisam/mi_extra.c | 2 | ||||
-rw-r--r-- | myisam/mi_packrec.c | 9 | ||||
-rw-r--r-- | mysql-test/r/binlog.result | 135 | ||||
-rw-r--r-- | mysql-test/r/innodb.result | 6 | ||||
-rw-r--r-- | mysql-test/r/mix_innodb_myisam_binlog.result | 27 | ||||
-rw-r--r-- | mysql-test/r/rpl_rotate_logs.result | 117 | ||||
-rw-r--r-- | mysql-test/t/binlog-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/binlog.test | 45 | ||||
-rw-r--r-- | mysql-test/t/innodb.test | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_rotate_logs.test | 27 | ||||
-rw-r--r-- | mysys/my_mmap.c | 6 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/log.cc | 40 | ||||
-rw-r--r-- | sql/log_event.cc | 3 | ||||
-rw-r--r-- | sql/log_event.h | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_map.cc | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 |
19 files changed, 247 insertions, 194 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 2b8f144a9df..89e1ff4bd48 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -208,6 +208,7 @@ ramil@mysql.com ranger@regul.home.lan rburnett@build.mysql.com reggie@bob.(none) +reggie@mdk10.(none) root@home.(none) root@mc04.(none) root@x3.internalnet diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c index 9023fe26f9e..ba32bb9115a 100644 --- a/myisam/mi_extra.c +++ b/myisam/mi_extra.c @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "myisamdef.h" -#ifdef HAVE_MMAP +#ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #endif diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index a8a27858d79..f3e942943aa 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -1181,11 +1181,12 @@ static uint max_bit(register uint value) /***************************************************************************** Some redefined functions to handle files when we are using memmap *****************************************************************************/ +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif #ifdef HAVE_MMAP -#include <sys/mman.h> - static int _mi_read_mempack_record(MI_INFO *info,my_off_t filepos,byte *buf); static int _mi_read_rnd_mempack_record(MI_INFO*, byte *,my_off_t, my_bool); @@ -1211,7 +1212,7 @@ my_bool _mi_memmap_file(MI_INFO *info) DBUG_RETURN(0); } file_map=(byte*) - mmap(0,share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN,PROT_READ, + my_mmap(0,share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN,PROT_READ, MAP_SHARED | MAP_NORESERVE,info->dfile,0L); if (file_map == (byte*) MAP_FAILED) { @@ -1230,7 +1231,7 @@ my_bool _mi_memmap_file(MI_INFO *info) void _mi_unmap_file(MI_INFO *info) { - VOID(munmap((caddr_t) info->s->file_map, + VOID(my_munmap((caddr_t) info->s->file_map, (size_t) info->s->state.state.data_file_length+ MEMMAP_EXTRA_MARGIN)); } diff --git a/mysql-test/r/binlog.result b/mysql-test/r/binlog.result new file mode 100644 index 00000000000..d59ea7e1340 --- /dev/null +++ b/mysql-test/r/binlog.result @@ -0,0 +1,135 @@ +drop table if exists t1, t2; +reset master; +create table t1 (a int) engine=bdb; +create table t2 (a int) engine=innodb; +begin; +insert t1 values (5); +commit; +begin; +insert t2 values (5); +commit; +show binlog events from 96; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 96 Query 1 194 use `test`; create table t1 (a int) engine=bdb +master-bin.000001 194 Query 1 295 use `test`; create table t2 (a int) engine=innodb +master-bin.000001 295 Query 1 364 use `test`; BEGIN +master-bin.000001 364 Query 1 84 use `test`; insert t1 values (5) +master-bin.000001 448 Query 1 518 use `test`; COMMIT +master-bin.000001 518 Query 1 587 use `test`; BEGIN +master-bin.000001 587 Query 1 84 use `test`; insert t2 values (5) +master-bin.000001 671 Xid 1 698 COMMIT /* xid=11 */ +drop table t1,t2; +reset master; +create table t1 (n int) engine=innodb; +begin; +commit; +drop table t1; +show binlog events in 'master-bin.000001' from 96; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 96 Query 1 197 use `test`; create table t1 (n int) engine=innodb +master-bin.000001 197 Query 1 266 use `test`; BEGIN +master-bin.000001 266 Query 1 94 use `test`; insert into t1 values(100 + 4) +master-bin.000001 360 Query 1 187 use `test`; insert into t1 values(99 + 4) +master-bin.000001 453 Query 1 280 use `test`; insert into t1 values(98 + 4) +master-bin.000001 546 Query 1 373 use `test`; insert into t1 values(97 + 4) +master-bin.000001 639 Query 1 466 use `test`; insert into t1 values(96 + 4) +master-bin.000001 732 Query 1 559 use `test`; insert into t1 values(95 + 4) +master-bin.000001 825 Query 1 652 use `test`; insert into t1 values(94 + 4) +master-bin.000001 918 Query 1 745 use `test`; insert into t1 values(93 + 4) +master-bin.000001 1011 Query 1 838 use `test`; insert into t1 values(92 + 4) +master-bin.000001 1104 Query 1 931 use `test`; insert into t1 values(91 + 4) +master-bin.000001 1197 Query 1 1024 use `test`; insert into t1 values(90 + 4) +master-bin.000001 1290 Query 1 1117 use `test`; insert into t1 values(89 + 4) +master-bin.000001 1383 Query 1 1210 use `test`; insert into t1 values(88 + 4) +master-bin.000001 1476 Query 1 1303 use `test`; insert into t1 values(87 + 4) +master-bin.000001 1569 Query 1 1396 use `test`; insert into t1 values(86 + 4) +master-bin.000001 1662 Query 1 1489 use `test`; insert into t1 values(85 + 4) +master-bin.000001 1755 Query 1 1582 use `test`; insert into t1 values(84 + 4) +master-bin.000001 1848 Query 1 1675 use `test`; insert into t1 values(83 + 4) +master-bin.000001 1941 Query 1 1768 use `test`; insert into t1 values(82 + 4) +master-bin.000001 2034 Query 1 1861 use `test`; insert into t1 values(81 + 4) +master-bin.000001 2127 Query 1 1954 use `test`; insert into t1 values(80 + 4) +master-bin.000001 2220 Query 1 2047 use `test`; insert into t1 values(79 + 4) +master-bin.000001 2313 Query 1 2140 use `test`; insert into t1 values(78 + 4) +master-bin.000001 2406 Query 1 2233 use `test`; insert into t1 values(77 + 4) +master-bin.000001 2499 Query 1 2326 use `test`; insert into t1 values(76 + 4) +master-bin.000001 2592 Query 1 2419 use `test`; insert into t1 values(75 + 4) +master-bin.000001 2685 Query 1 2512 use `test`; insert into t1 values(74 + 4) +master-bin.000001 2778 Query 1 2605 use `test`; insert into t1 values(73 + 4) +master-bin.000001 2871 Query 1 2698 use `test`; insert into t1 values(72 + 4) +master-bin.000001 2964 Query 1 2791 use `test`; insert into t1 values(71 + 4) +master-bin.000001 3057 Query 1 2884 use `test`; insert into t1 values(70 + 4) +master-bin.000001 3150 Query 1 2977 use `test`; insert into t1 values(69 + 4) +master-bin.000001 3243 Query 1 3070 use `test`; insert into t1 values(68 + 4) +master-bin.000001 3336 Query 1 3163 use `test`; insert into t1 values(67 + 4) +master-bin.000001 3429 Query 1 3256 use `test`; insert into t1 values(66 + 4) +master-bin.000001 3522 Query 1 3349 use `test`; insert into t1 values(65 + 4) +master-bin.000001 3615 Query 1 3442 use `test`; insert into t1 values(64 + 4) +master-bin.000001 3708 Query 1 3535 use `test`; insert into t1 values(63 + 4) +master-bin.000001 3801 Query 1 3628 use `test`; insert into t1 values(62 + 4) +master-bin.000001 3894 Query 1 3721 use `test`; insert into t1 values(61 + 4) +master-bin.000001 3987 Query 1 3814 use `test`; insert into t1 values(60 + 4) +master-bin.000001 4080 Query 1 3907 use `test`; insert into t1 values(59 + 4) +master-bin.000001 4173 Query 1 4000 use `test`; insert into t1 values(58 + 4) +master-bin.000001 4266 Query 1 4093 use `test`; insert into t1 values(57 + 4) +master-bin.000001 4359 Query 1 4186 use `test`; insert into t1 values(56 + 4) +master-bin.000001 4452 Query 1 4279 use `test`; insert into t1 values(55 + 4) +master-bin.000001 4545 Query 1 4372 use `test`; insert into t1 values(54 + 4) +master-bin.000001 4638 Query 1 4465 use `test`; insert into t1 values(53 + 4) +master-bin.000001 4731 Query 1 4558 use `test`; insert into t1 values(52 + 4) +master-bin.000001 4824 Query 1 4651 use `test`; insert into t1 values(51 + 4) +master-bin.000001 4917 Query 1 4744 use `test`; insert into t1 values(50 + 4) +master-bin.000001 5010 Query 1 4837 use `test`; insert into t1 values(49 + 4) +master-bin.000001 5103 Query 1 4930 use `test`; insert into t1 values(48 + 4) +master-bin.000001 5196 Query 1 5023 use `test`; insert into t1 values(47 + 4) +master-bin.000001 5289 Query 1 5116 use `test`; insert into t1 values(46 + 4) +master-bin.000001 5382 Query 1 5209 use `test`; insert into t1 values(45 + 4) +master-bin.000001 5475 Query 1 5302 use `test`; insert into t1 values(44 + 4) +master-bin.000001 5568 Query 1 5395 use `test`; insert into t1 values(43 + 4) +master-bin.000001 5661 Query 1 5488 use `test`; insert into t1 values(42 + 4) +master-bin.000001 5754 Query 1 5581 use `test`; insert into t1 values(41 + 4) +master-bin.000001 5847 Query 1 5674 use `test`; insert into t1 values(40 + 4) +master-bin.000001 5940 Query 1 5767 use `test`; insert into t1 values(39 + 4) +master-bin.000001 6033 Query 1 5860 use `test`; insert into t1 values(38 + 4) +master-bin.000001 6126 Query 1 5953 use `test`; insert into t1 values(37 + 4) +master-bin.000001 6219 Query 1 6046 use `test`; insert into t1 values(36 + 4) +master-bin.000001 6312 Query 1 6139 use `test`; insert into t1 values(35 + 4) +master-bin.000001 6405 Query 1 6232 use `test`; insert into t1 values(34 + 4) +master-bin.000001 6498 Query 1 6325 use `test`; insert into t1 values(33 + 4) +master-bin.000001 6591 Query 1 6418 use `test`; insert into t1 values(32 + 4) +master-bin.000001 6684 Query 1 6511 use `test`; insert into t1 values(31 + 4) +master-bin.000001 6777 Query 1 6604 use `test`; insert into t1 values(30 + 4) +master-bin.000001 6870 Query 1 6697 use `test`; insert into t1 values(29 + 4) +master-bin.000001 6963 Query 1 6790 use `test`; insert into t1 values(28 + 4) +master-bin.000001 7056 Query 1 6883 use `test`; insert into t1 values(27 + 4) +master-bin.000001 7149 Query 1 6976 use `test`; insert into t1 values(26 + 4) +master-bin.000001 7242 Query 1 7069 use `test`; insert into t1 values(25 + 4) +master-bin.000001 7335 Query 1 7162 use `test`; insert into t1 values(24 + 4) +master-bin.000001 7428 Query 1 7255 use `test`; insert into t1 values(23 + 4) +master-bin.000001 7521 Query 1 7348 use `test`; insert into t1 values(22 + 4) +master-bin.000001 7614 Query 1 7441 use `test`; insert into t1 values(21 + 4) +master-bin.000001 7707 Query 1 7534 use `test`; insert into t1 values(20 + 4) +master-bin.000001 7800 Query 1 7627 use `test`; insert into t1 values(19 + 4) +master-bin.000001 7893 Query 1 7720 use `test`; insert into t1 values(18 + 4) +master-bin.000001 7986 Query 1 7813 use `test`; insert into t1 values(17 + 4) +master-bin.000001 8079 Query 1 7906 use `test`; insert into t1 values(16 + 4) +master-bin.000001 8172 Query 1 7999 use `test`; insert into t1 values(15 + 4) +master-bin.000001 8265 Query 1 8092 use `test`; insert into t1 values(14 + 4) +master-bin.000001 8358 Query 1 8185 use `test`; insert into t1 values(13 + 4) +master-bin.000001 8451 Query 1 8278 use `test`; insert into t1 values(12 + 4) +master-bin.000001 8544 Query 1 8371 use `test`; insert into t1 values(11 + 4) +master-bin.000001 8637 Query 1 8464 use `test`; insert into t1 values(10 + 4) +master-bin.000001 8730 Query 1 8556 use `test`; insert into t1 values(9 + 4) +master-bin.000001 8822 Query 1 8648 use `test`; insert into t1 values(8 + 4) +master-bin.000001 8914 Query 1 8740 use `test`; insert into t1 values(7 + 4) +master-bin.000001 9006 Query 1 8832 use `test`; insert into t1 values(6 + 4) +master-bin.000001 9098 Query 1 8924 use `test`; insert into t1 values(5 + 4) +master-bin.000001 9190 Query 1 9016 use `test`; insert into t1 values(4 + 4) +master-bin.000001 9282 Query 1 9108 use `test`; insert into t1 values(3 + 4) +master-bin.000001 9374 Query 1 9200 use `test`; insert into t1 values(2 + 4) +master-bin.000001 9466 Query 1 9292 use `test`; insert into t1 values(1 + 4) +master-bin.000001 9558 Xid 1 9585 COMMIT /* xid=18 */ +master-bin.000001 9585 Rotate 1 9629 master-bin.000002;pos=4 +show binlog events in 'master-bin.000002' from 96; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 96 Query 1 173 use `test`; drop table t1 diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index d65ce794a75..91f74be9453 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -272,6 +272,10 @@ n 7 rollback to savepoint `my_savepoint`; ERROR 42000: SAVEPOINT my_savepoint does not exist +insert into t1 values (8); +savepoint sv; +commit; +savepoint sv; set autocommit=1; rollback; drop table t1; @@ -1717,7 +1721,7 @@ Variable_name Value Innodb_rows_deleted 2070 show status like "Innodb_rows_inserted"; Variable_name Value -Innodb_rows_inserted 31708 +Innodb_rows_inserted 31709 show status like "Innodb_rows_updated"; Variable_name Value Innodb_rows_updated 29530 diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 06ca3245535..d4ff95e4e29 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -101,10 +101,9 @@ insert into t1 values(9); insert into t2 select * from t1; show binlog events from 96; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 96 Query 1 # use `test`; BEGIN -master-bin.000001 165 Query 1 # use `test`; insert into t1 values(9) -master-bin.000001 253 Xid 1 # COMMIT /* xid=59 */ -master-bin.000001 280 Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 96 Query 1 # use `test`; insert into t1 values(9) +master-bin.000001 184 Xid 1 # COMMIT /* xid=59 */ +master-bin.000001 211 Query 1 # use `test`; insert into t2 select * from t1 delete from t1; delete from t2; reset master; @@ -113,21 +112,19 @@ begin; insert into t2 select * from t1; show binlog events from 96; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 96 Query 1 # use `test`; BEGIN -master-bin.000001 165 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 254 Xid 1 # COMMIT /* xid=65 */ -master-bin.000001 281 Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 96 Query 1 # use `test`; insert into t1 values(10) +master-bin.000001 185 Xid 1 # COMMIT /* xid=65 */ +master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1 insert into t1 values(11); commit; show binlog events from 96; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 96 Query 1 # use `test`; BEGIN -master-bin.000001 165 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 254 Xid 1 # COMMIT /* xid=65 */ -master-bin.000001 281 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 376 Query 1 # use `test`; BEGIN -master-bin.000001 445 Query 1 # use `test`; insert into t1 values(11) -master-bin.000001 534 Xid 1 # COMMIT /* xid=67 */ +master-bin.000001 96 Query 1 # use `test`; insert into t1 values(10) +master-bin.000001 185 Xid 1 # COMMIT /* xid=65 */ +master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 307 Query 1 # use `test`; BEGIN +master-bin.000001 376 Query 1 # use `test`; insert into t1 values(11) +master-bin.000001 465 Xid 1 # COMMIT /* xid=67 */ alter table t2 engine=INNODB; delete from t1; delete from t2; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 745d4d8138e..ec29a01db10 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -92,120 +92,3 @@ count(*) 100 unlock tables; drop table if exists t1,t2,t3,t4; -slave stop; -reset master; -create table t1 (n int) engine=innodb; -begin; -commit; -drop table t1; -show binlog events in 'master-bin.000001'; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 96 Query 1 197 use `test`; create table t1 (n int) engine=innodb -master-bin.000001 197 Query 1 266 use `test`; BEGIN -master-bin.000001 266 Query 1 94 use `test`; insert into t1 values(100 + 4) -master-bin.000001 360 Query 1 187 use `test`; insert into t1 values(99 + 4) -master-bin.000001 453 Query 1 280 use `test`; insert into t1 values(98 + 4) -master-bin.000001 546 Query 1 373 use `test`; insert into t1 values(97 + 4) -master-bin.000001 639 Query 1 466 use `test`; insert into t1 values(96 + 4) -master-bin.000001 732 Query 1 559 use `test`; insert into t1 values(95 + 4) -master-bin.000001 825 Query 1 652 use `test`; insert into t1 values(94 + 4) -master-bin.000001 918 Query 1 745 use `test`; insert into t1 values(93 + 4) -master-bin.000001 1011 Query 1 838 use `test`; insert into t1 values(92 + 4) -master-bin.000001 1104 Query 1 931 use `test`; insert into t1 values(91 + 4) -master-bin.000001 1197 Query 1 1024 use `test`; insert into t1 values(90 + 4) -master-bin.000001 1290 Query 1 1117 use `test`; insert into t1 values(89 + 4) -master-bin.000001 1383 Query 1 1210 use `test`; insert into t1 values(88 + 4) -master-bin.000001 1476 Query 1 1303 use `test`; insert into t1 values(87 + 4) -master-bin.000001 1569 Query 1 1396 use `test`; insert into t1 values(86 + 4) -master-bin.000001 1662 Query 1 1489 use `test`; insert into t1 values(85 + 4) -master-bin.000001 1755 Query 1 1582 use `test`; insert into t1 values(84 + 4) -master-bin.000001 1848 Query 1 1675 use `test`; insert into t1 values(83 + 4) -master-bin.000001 1941 Query 1 1768 use `test`; insert into t1 values(82 + 4) -master-bin.000001 2034 Query 1 1861 use `test`; insert into t1 values(81 + 4) -master-bin.000001 2127 Query 1 1954 use `test`; insert into t1 values(80 + 4) -master-bin.000001 2220 Query 1 2047 use `test`; insert into t1 values(79 + 4) -master-bin.000001 2313 Query 1 2140 use `test`; insert into t1 values(78 + 4) -master-bin.000001 2406 Query 1 2233 use `test`; insert into t1 values(77 + 4) -master-bin.000001 2499 Query 1 2326 use `test`; insert into t1 values(76 + 4) -master-bin.000001 2592 Query 1 2419 use `test`; insert into t1 values(75 + 4) -master-bin.000001 2685 Query 1 2512 use `test`; insert into t1 values(74 + 4) -master-bin.000001 2778 Query 1 2605 use `test`; insert into t1 values(73 + 4) -master-bin.000001 2871 Query 1 2698 use `test`; insert into t1 values(72 + 4) -master-bin.000001 2964 Query 1 2791 use `test`; insert into t1 values(71 + 4) -master-bin.000001 3057 Query 1 2884 use `test`; insert into t1 values(70 + 4) -master-bin.000001 3150 Query 1 2977 use `test`; insert into t1 values(69 + 4) -master-bin.000001 3243 Query 1 3070 use `test`; insert into t1 values(68 + 4) -master-bin.000001 3336 Query 1 3163 use `test`; insert into t1 values(67 + 4) -master-bin.000001 3429 Query 1 3256 use `test`; insert into t1 values(66 + 4) -master-bin.000001 3522 Query 1 3349 use `test`; insert into t1 values(65 + 4) -master-bin.000001 3615 Query 1 3442 use `test`; insert into t1 values(64 + 4) -master-bin.000001 3708 Query 1 3535 use `test`; insert into t1 values(63 + 4) -master-bin.000001 3801 Query 1 3628 use `test`; insert into t1 values(62 + 4) -master-bin.000001 3894 Query 1 3721 use `test`; insert into t1 values(61 + 4) -master-bin.000001 3987 Query 1 3814 use `test`; insert into t1 values(60 + 4) -master-bin.000001 4080 Query 1 3907 use `test`; insert into t1 values(59 + 4) -master-bin.000001 4173 Query 1 4000 use `test`; insert into t1 values(58 + 4) -master-bin.000001 4266 Query 1 4093 use `test`; insert into t1 values(57 + 4) -master-bin.000001 4359 Query 1 4186 use `test`; insert into t1 values(56 + 4) -master-bin.000001 4452 Query 1 4279 use `test`; insert into t1 values(55 + 4) -master-bin.000001 4545 Query 1 4372 use `test`; insert into t1 values(54 + 4) -master-bin.000001 4638 Query 1 4465 use `test`; insert into t1 values(53 + 4) -master-bin.000001 4731 Query 1 4558 use `test`; insert into t1 values(52 + 4) -master-bin.000001 4824 Query 1 4651 use `test`; insert into t1 values(51 + 4) -master-bin.000001 4917 Query 1 4744 use `test`; insert into t1 values(50 + 4) -master-bin.000001 5010 Query 1 4837 use `test`; insert into t1 values(49 + 4) -master-bin.000001 5103 Query 1 4930 use `test`; insert into t1 values(48 + 4) -master-bin.000001 5196 Query 1 5023 use `test`; insert into t1 values(47 + 4) -master-bin.000001 5289 Query 1 5116 use `test`; insert into t1 values(46 + 4) -master-bin.000001 5382 Query 1 5209 use `test`; insert into t1 values(45 + 4) -master-bin.000001 5475 Query 1 5302 use `test`; insert into t1 values(44 + 4) -master-bin.000001 5568 Query 1 5395 use `test`; insert into t1 values(43 + 4) -master-bin.000001 5661 Query 1 5488 use `test`; insert into t1 values(42 + 4) -master-bin.000001 5754 Query 1 5581 use `test`; insert into t1 values(41 + 4) -master-bin.000001 5847 Query 1 5674 use `test`; insert into t1 values(40 + 4) -master-bin.000001 5940 Query 1 5767 use `test`; insert into t1 values(39 + 4) -master-bin.000001 6033 Query 1 5860 use `test`; insert into t1 values(38 + 4) -master-bin.000001 6126 Query 1 5953 use `test`; insert into t1 values(37 + 4) -master-bin.000001 6219 Query 1 6046 use `test`; insert into t1 values(36 + 4) -master-bin.000001 6312 Query 1 6139 use `test`; insert into t1 values(35 + 4) -master-bin.000001 6405 Query 1 6232 use `test`; insert into t1 values(34 + 4) -master-bin.000001 6498 Query 1 6325 use `test`; insert into t1 values(33 + 4) -master-bin.000001 6591 Query 1 6418 use `test`; insert into t1 values(32 + 4) -master-bin.000001 6684 Query 1 6511 use `test`; insert into t1 values(31 + 4) -master-bin.000001 6777 Query 1 6604 use `test`; insert into t1 values(30 + 4) -master-bin.000001 6870 Query 1 6697 use `test`; insert into t1 values(29 + 4) -master-bin.000001 6963 Query 1 6790 use `test`; insert into t1 values(28 + 4) -master-bin.000001 7056 Query 1 6883 use `test`; insert into t1 values(27 + 4) -master-bin.000001 7149 Query 1 6976 use `test`; insert into t1 values(26 + 4) -master-bin.000001 7242 Query 1 7069 use `test`; insert into t1 values(25 + 4) -master-bin.000001 7335 Query 1 7162 use `test`; insert into t1 values(24 + 4) -master-bin.000001 7428 Query 1 7255 use `test`; insert into t1 values(23 + 4) -master-bin.000001 7521 Query 1 7348 use `test`; insert into t1 values(22 + 4) -master-bin.000001 7614 Query 1 7441 use `test`; insert into t1 values(21 + 4) -master-bin.000001 7707 Query 1 7534 use `test`; insert into t1 values(20 + 4) -master-bin.000001 7800 Query 1 7627 use `test`; insert into t1 values(19 + 4) -master-bin.000001 7893 Query 1 7720 use `test`; insert into t1 values(18 + 4) -master-bin.000001 7986 Query 1 7813 use `test`; insert into t1 values(17 + 4) -master-bin.000001 8079 Query 1 7906 use `test`; insert into t1 values(16 + 4) -master-bin.000001 8172 Query 1 7999 use `test`; insert into t1 values(15 + 4) -master-bin.000001 8265 Query 1 8092 use `test`; insert into t1 values(14 + 4) -master-bin.000001 8358 Query 1 8185 use `test`; insert into t1 values(13 + 4) -master-bin.000001 8451 Query 1 8278 use `test`; insert into t1 values(12 + 4) -master-bin.000001 8544 Query 1 8371 use `test`; insert into t1 values(11 + 4) -master-bin.000001 8637 Query 1 8464 use `test`; insert into t1 values(10 + 4) -master-bin.000001 8730 Query 1 8556 use `test`; insert into t1 values(9 + 4) -master-bin.000001 8822 Query 1 8648 use `test`; insert into t1 values(8 + 4) -master-bin.000001 8914 Query 1 8740 use `test`; insert into t1 values(7 + 4) -master-bin.000001 9006 Query 1 8832 use `test`; insert into t1 values(6 + 4) -master-bin.000001 9098 Query 1 8924 use `test`; insert into t1 values(5 + 4) -master-bin.000001 9190 Query 1 9016 use `test`; insert into t1 values(4 + 4) -master-bin.000001 9282 Query 1 9108 use `test`; insert into t1 values(3 + 4) -master-bin.000001 9374 Query 1 9200 use `test`; insert into t1 values(2 + 4) -master-bin.000001 9466 Query 1 9292 use `test`; insert into t1 values(1 + 4) -master-bin.000001 9558 Xid 1 9319 COMMIT /* xid=146 */ -master-bin.000001 9585 Rotate 1 9629 master-bin.000002;pos=4 -show binlog events in 'master-bin.000002'; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4 -master-bin.000002 96 Query 1 173 use `test`; drop table t1 diff --git a/mysql-test/t/binlog-master.opt b/mysql-test/t/binlog-master.opt new file mode 100644 index 00000000000..ad2c6a647b5 --- /dev/null +++ b/mysql-test/t/binlog-master.opt @@ -0,0 +1 @@ +-O max_binlog_size=4096 diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test new file mode 100644 index 00000000000..5862861eaeb --- /dev/null +++ b/mysql-test/t/binlog.test @@ -0,0 +1,45 @@ +# +# misc binlogging tests that do not require a slave running +# +-- source include/have_bdb.inc +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1, t2; +--enable_warnings +reset master; + +create table t1 (a int) engine=bdb; +create table t2 (a int) engine=innodb; +begin; +insert t1 values (5); +commit; +begin; +insert t2 values (5); +commit; +# first COMMIT must be Query_log_event, second - Xid_log_event +--replace_result "xid=18" "xid=11" +show binlog events from 96; +drop table t1,t2; + +# +# binlog rotation after one big transaction +# +reset master; +let $1=100; + +create table t1 (n int) engine=innodb; +begin; +--disable_query_log +while ($1) +{ + eval insert into t1 values($1 + 4); + dec $1; +} +--enable_query_log +commit; +drop table t1; +--replace_result "xid=29" "xid=18" +show binlog events in 'master-bin.000001' from 96; +show binlog events in 'master-bin.000002' from 96; + diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 6514f3d5c94..82f91081d03 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -141,6 +141,10 @@ release savepoint `my_savepoint`; select n from t1; -- error 1305 rollback to savepoint `my_savepoint`; +insert into t1 values (8); +savepoint sv; +commit; +savepoint sv; set autocommit=1; # nop rollback; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 47b5754232c..7622a93e2a3 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -153,30 +153,3 @@ connection master; drop table if exists t1,t2,t3,t4; sync_slave_with_master; -# -# now the same in a transaction -# -slave stop; # we don't need it anymore -connection master; -reset master; -let $1=100; - ---disable_warnings -create table t1 (n int) engine=innodb; ---enable_warnings -begin; ---disable_query_log -while ($1) -{ - eval insert into t1 values($1 + 4); - dec $1; -} ---enable_query_log -commit; -drop table t1; -let $VERSION=`select version()`; ---replace_result $VERSION VERSION "xid=373" "xid=146" -show binlog events in 'master-bin.000001'; ---replace_result $VERSION VERSION -show binlog events in 'master-bin.000002'; - diff --git a/mysys/my_mmap.c b/mysys/my_mmap.c index 0225e7fac24..ed662a38712 100644 --- a/mysys/my_mmap.c +++ b/mysys/my_mmap.c @@ -84,6 +84,12 @@ int my_msync(int fd, void *addr, size_t len, int flags) } #endif + +#ifdef _WINDOWS +#pragma message "no mmap!" +#else #warning "no mmap!" #endif +#endif + diff --git a/sql/handler.h b/sql/handler.h index ad9345ac75c..633252a24f1 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -197,7 +197,7 @@ enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, #define HA_CREATE_USED_COMMENT (1L << 16) #define HA_CREATE_USED_PASSWORD (1L << 17) -typedef ulonglong my_xid; +typedef ulonglong my_xid; // this line is the same as in log_event.h #define MYSQL_XID_PREFIX "MySQLXid" #define MYSQL_XID_PREFIX_LEN 8 // must be a multiple of 8 #define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id)) diff --git a/sql/log.cc b/sql/log.cc index a873d75def9..8ecc1152d8e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -80,8 +80,13 @@ static int binlog_close_connection(THD *thd) return 0; } -static inline void binlog_cleanup_trans(IO_CACHE *trans_log) +static int binlog_end_trans(THD *thd, IO_CACHE *trans_log, Log_event *end_ev) { + int error=0; + DBUG_ENTER("binlog_end_trans"); + if (end_ev) + error= mysql_bin_log.write(thd, trans_log, end_ev); + statistic_increment(binlog_cache_use, &LOCK_status); if (trans_log->disk_writes != 0) { @@ -90,6 +95,7 @@ static inline void binlog_cleanup_trans(IO_CACHE *trans_log) } reinit_io_cache(trans_log, WRITE_CACHE, (my_off_t) 0, 0, 1); // cannot fail trans_log->end_of_file= max_binlog_cache_size; + DBUG_RETURN(error); } static int binlog_prepare(THD *thd, bool all) @@ -105,7 +111,6 @@ static int binlog_prepare(THD *thd, bool all) static int binlog_commit(THD *thd, bool all) { - int error; IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot]; DBUG_ENTER("binlog_commit"); DBUG_ASSERT(mysql_bin_log.is_open() && @@ -116,11 +121,8 @@ static int binlog_commit(THD *thd, bool all) // we're here because trans_log was flushed in MYSQL_LOG::log() DBUG_RETURN(0); } - - /* Update the binary log as we have cached some queries */ - error= mysql_bin_log.write(thd, trans_log); - binlog_cleanup_trans(trans_log); - DBUG_RETURN(error); + Query_log_event qev(thd, "COMMIT", 6, TRUE, FALSE); + DBUG_RETURN(binlog_end_trans(thd, trans_log, &qev)); } static int binlog_rollback(THD *thd, bool all) @@ -144,10 +146,10 @@ static int binlog_rollback(THD *thd, bool all) if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE)) { Query_log_event qev(thd, "ROLLBACK", 8, TRUE, FALSE); - qev.write(trans_log); - error= mysql_bin_log.write(thd, trans_log); + error= binlog_end_trans(thd, trans_log, &qev); } - binlog_cleanup_trans(trans_log); + else + error= binlog_end_trans(thd, trans_log, 0); DBUG_RETURN(error); } @@ -1822,11 +1824,11 @@ uint MYSQL_LOG::next_file_id() that the same updates are run on the slave. */ -bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) +bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) { bool error= 0; VOID(pthread_mutex_lock(&LOCK_log)); - DBUG_ENTER("MYSQL_LOG::write(THD *, IO_CACHE *)"); + DBUG_ENTER("MYSQL_LOG::write(THD *, IO_CACHE *, Log_event *)"); if (likely(is_open())) // Should always be true { @@ -1835,9 +1837,8 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) /* Log "BEGIN" at the beginning of the transaction. which may contain more than 1 SQL statement. - There is no need to append "COMMIT", as it's already in the 'cache' - (in fact, Xid_log_event is there which does the commit on slaves) */ + if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { Query_log_event qinfo(thd, "BEGIN", 5, TRUE, FALSE); /* @@ -1869,10 +1870,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) if (my_b_write(&log_file, cache->read_pos, length)) goto err; cache->read_pos=cache->read_end; // Mark buffer used up + DBUG_EXECUTE_IF("half_binlogged_transaction", goto DBUG_skip_commit;); } while ((length=my_b_fill(cache))); + if (commit_event->write(&log_file)) + goto err; +DBUG_skip_commit: if (flush_io_cache(&log_file) || sync_binlog(&log_file)) - goto err; + goto err; DBUG_EXECUTE_IF("half_binlogged_transaction", abort();); if (cache->error) // Error on read { @@ -2985,10 +2990,9 @@ void TC_LOG_BINLOG::close() int TC_LOG_BINLOG::log(THD *thd, my_xid xid) { Xid_log_event xle(thd, xid); - if (xle.write((IO_CACHE*)thd->ha_data[binlog_hton.slot])) - return 0; + IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot]; thread_safe_increment(prepared_xids, &LOCK_prep_xids); - return !binlog_commit(thd,1); // invert return value + return !binlog_end_trans(thd, trans_log, &xle); // invert return value } void TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid) diff --git a/sql/log_event.cc b/sql/log_event.cc index bbf894c2385..fa193df40a2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3140,10 +3140,9 @@ void Xid_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_eve #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) int Xid_log_event::exec_event(struct st_relay_log_info* rli) { - rli->inc_event_relay_log_pos(); /* For a slave Xid_log_event is COMMIT */ mysql_log.write(thd,COM_QUERY,"COMMIT /* implicit, from Xid_log_event */"); - return end_trans(thd, COMMIT); + return end_trans(thd, COMMIT) || Log_event::exec_event(rli); } #endif /* !MYSQL_CLIENT */ diff --git a/sql/log_event.h b/sql/log_event.h index f422a91f358..7a041959f92 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1077,7 +1077,7 @@ class Rand_log_event: public Log_event ****************************************************************************/ #ifdef MYSQL_CLIENT -typedef ulong my_xid; +typedef ulonglong my_xid; // this line is the same as in handler.h #endif class Xid_log_event: public Log_event diff --git a/sql/sql_class.h b/sql/sql_class.h index 2d89ded63c2..fa28750721c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -309,7 +309,7 @@ public: bool write(THD *thd, const char *query, uint query_length, time_t query_start=0); bool write(Log_event* event_info); // binary log write - bool write(THD *thd, IO_CACHE *cache); + bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event); /* v stands for vector diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 687e60b7c72..1b874a4fd88 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -20,7 +20,7 @@ #endif #include "mysql_priv.h" -#ifdef HAVE_MMAP +#ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #include <sys/stat.h> #endif @@ -42,7 +42,7 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt struct stat stat_buf; if (!fstat(file,&stat_buf)) { - if (!(map=(byte*) mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ, + if (!(map=(byte*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ, MAP_SHARED | MAP_NORESERVE,file, 0L))) { @@ -53,7 +53,7 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt if (map && memcmp(map,magic,magic_length)) { my_error(ER_WRONG_MAGIC, MYF(0), name); - VOID(munmap(map,size)); + VOID(my_munmap(map,size)); map=0; } if (!map) @@ -71,7 +71,7 @@ mapped_files::~mapped_files() #ifdef HAVE_MMAP if (file >= 0) { - VOID(munmap((caddr_t) map,size)); + VOID(my_munmap((caddr_t) map,size)); VOID(my_close(file,MYF(0))); file= -1; map=0; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 43fa1d6ced9..9a1b2eb0430 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -129,13 +129,13 @@ static bool end_active_trans(THD *thd) OPTION_TABLE_LOCK)) { DBUG_PRINT("info",("options: 0x%lx", (ulong) thd->options)); - thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); /* Safety if one did "drop table" on locked tables */ if (!thd->locked_tables) thd->options&= ~OPTION_TABLE_LOCK; thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (ha_commit(thd)) error=1; + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); } DBUG_RETURN(error); } @@ -1340,9 +1340,9 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion) even if there is a problem with the OPTION_AUTO_COMMIT flag (Which of course should never happen...) */ - thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status&= ~SERVER_STATUS_IN_TRANS; res= ha_commit(thd); + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); break; case COMMIT_RELEASE: do_release= 1; /* fall through */ |