XA (not completely polished out yet)
This commit is contained in:
parent
184cbf6d37
commit
1034677f94
@ -687,8 +687,8 @@ extern pthread_t shutdown_th, main_th, signal_th;
|
||||
#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
|
||||
#define thread_safe_sub(V,C,L) \
|
||||
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
|
||||
#if defined (__GNUC__) || defined (__cplusplus)
|
||||
static inline bool thread_safe_dec_and_test(ulong V, pthread_mutex_t *L)
|
||||
#ifdef __cplusplus
|
||||
static inline bool thread_safe_dec_and_test(ulong &V, pthread_mutex_t *L)
|
||||
{
|
||||
ulong res;
|
||||
pthread_mutex_lock(L);
|
||||
|
@ -315,7 +315,7 @@ trx_is_active(
|
||||
}
|
||||
|
||||
if (ut_dulint_cmp(trx_id, trx_sys->max_trx_id) >= 0) {
|
||||
|
||||
|
||||
/* There must be corruption: we return TRUE because this
|
||||
function is only called by lock_clust_rec_some_has_impl()
|
||||
and row_vers_impl_x_locked_off_kernel() and they have
|
||||
@ -325,8 +325,9 @@ trx_is_active(
|
||||
}
|
||||
|
||||
trx = trx_get_on_id(trx_id);
|
||||
if (trx && (trx->conc_state == TRX_ACTIVE)) {
|
||||
|
||||
if (trx && (trx->conc_state == TRX_ACTIVE ||
|
||||
trx->conc_state == TRX_PREPARED)) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
@ -153,10 +153,11 @@ read_view_open_now(
|
||||
/* No active transaction should be visible, except cr_trx */
|
||||
|
||||
while (trx) {
|
||||
if (trx != cr_trx && trx->conc_state == TRX_ACTIVE) {
|
||||
if (trx != cr_trx && (trx->conc_state == TRX_ACTIVE ||
|
||||
trx->conc_state == TRX_PREPARED)) {
|
||||
|
||||
read_view_set_nth_trx_id(view, n, trx->id);
|
||||
|
||||
|
||||
n++;
|
||||
|
||||
/* NOTE that a transaction whose trx number is <
|
||||
@ -164,7 +165,7 @@ read_view_open_now(
|
||||
in the middle of its commit! Note that when a
|
||||
transaction starts, we initialize trx->no to
|
||||
ut_dulint_max. */
|
||||
|
||||
|
||||
if (ut_dulint_cmp(view->low_limit_no, trx->no) > 0) {
|
||||
|
||||
view->low_limit_no = trx->no;
|
||||
|
@ -1607,20 +1607,23 @@ trx_print(
|
||||
(ulong) ut_dulint_get_high(trx->id),
|
||||
(ulong) ut_dulint_get_low(trx->id));
|
||||
|
||||
switch (trx->conc_state) {
|
||||
switch (trx->conc_state) {
|
||||
case TRX_NOT_STARTED:
|
||||
fputs(", not started", f);
|
||||
break;
|
||||
case TRX_ACTIVE:
|
||||
fprintf(f, ", ACTIVE %lu sec",
|
||||
(ulong)difftime(time(NULL), trx->start_time));
|
||||
break;
|
||||
break;
|
||||
case TRX_PREPARED:
|
||||
fputs(", PREPARED", f);
|
||||
break;
|
||||
case TRX_COMMITTED_IN_MEMORY:
|
||||
fputs(", COMMITTED IN MEMORY", f);
|
||||
break;
|
||||
default:
|
||||
fprintf(f, " state %lu", (ulong) trx->conc_state);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
fprintf(f, ", process no %lu", trx->mysql_process_no);
|
||||
|
@ -77,6 +77,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
|
||||
alter table t1 add unique(v);
|
||||
alter table t1 add key(v);
|
||||
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
|
||||
--replace_column 6 # 9 #
|
||||
explain select * from t1 where v='a';
|
||||
|
||||
# GROUP BY
|
||||
|
@ -523,10 +523,10 @@ create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 User var 1 135 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
|
||||
master-bin.000001 135 Query 1 218 use `test`; insert into t2 values (@v)
|
||||
master-bin.000001 96 User var 1 136 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
|
||||
master-bin.000001 136 Query 1 219 use `test`; insert into t2 values (@v)
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
|
||||
use test;
|
||||
|
@ -10,9 +10,9 @@ get_lock("a",10)
|
||||
1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 206 create database `drop-temp+table-test`
|
||||
master-bin.000001 206 Query 1 322 use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 322 Query 1 473 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
|
||||
master-bin.000001 473 Query 1 566 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 207 create database `drop-temp+table-test`
|
||||
master-bin.000001 207 Query 1 323 use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 323 Query 1 474 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
|
||||
master-bin.000001 474 Query 1 567 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
|
||||
drop database `drop-temp+table-test`;
|
||||
|
@ -74,8 +74,8 @@ insert into t1 select * from t2;
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 183 use `test`; insert into t1 select * from t2
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 184 use `test`; insert into t1 select * from t2
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
@ -88,7 +88,7 @@ create table t2(unique(a)) select a from t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 1
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
drop table t1;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (a int not null);
|
||||
|
@ -6,12 +6,13 @@ begin;
|
||||
insert into t1 values(1);
|
||||
insert into t2 select * from t1;
|
||||
commit;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(1)
|
||||
master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 326 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(1)
|
||||
master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 327 Xid 1 # xid=7
|
||||
master-bin.000001 350 Query 1 # use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@ -21,12 +22,12 @@ insert into t2 select * from t1;
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(2)
|
||||
master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 326 Query 1 # use `test`; ROLLBACK
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(2)
|
||||
master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 327 Query 1 # use `test`; ROLLBACK
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@ -39,15 +40,16 @@ rollback to savepoint my_savepoint;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
commit;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(3)
|
||||
master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 317 Query 1 # use `test`; insert into t1 values(4)
|
||||
master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 577 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(3)
|
||||
master-bin.000001 239 Query 1 # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 318 Query 1 # use `test`; insert into t1 values(4)
|
||||
master-bin.000001 399 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 487 Query 1 # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 578 Xid 1 # xid=24
|
||||
master-bin.000001 601 Query 1 # use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@ -65,16 +67,17 @@ select a from t1 order by a;
|
||||
a
|
||||
5
|
||||
7
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(5)
|
||||
master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 317 Query 1 # use `test`; insert into t1 values(6)
|
||||
master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 577 Query 1 # use `test`; insert into t1 values(7)
|
||||
master-bin.000001 658 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(5)
|
||||
master-bin.000001 239 Query 1 # use `test`; savepoint my_savepoint
|
||||
master-bin.000001 318 Query 1 # use `test`; insert into t1 values(6)
|
||||
master-bin.000001 399 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 487 Query 1 # use `test`; rollback to savepoint my_savepoint
|
||||
master-bin.000001 578 Query 1 # use `test`; insert into t1 values(7)
|
||||
master-bin.000001 659 Xid 1 # xid=36
|
||||
master-bin.000001 682 Query 1 # use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@ -87,40 +90,41 @@ insert into t2 select * from t1;
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(8)
|
||||
master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 326 Query 1 # use `test`; ROLLBACK
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(8)
|
||||
master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 327 Query 1 # use `test`; ROLLBACK
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
insert into t1 values(9);
|
||||
insert into t2 select * from t1;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(9)
|
||||
master-bin.000001 176 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 177 Query 1 # use `test`; insert into t2 select * from t1
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
insert into t1 values(10);
|
||||
begin;
|
||||
insert into t2 select * from t1;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
|
||||
master-bin.000001 177 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 178 Query 1 # use `test`; insert into t2 select * from t1
|
||||
insert into t1 values(11);
|
||||
commit;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
|
||||
master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 265 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 327 Query 1 # use `test`; insert into t1 values(11)
|
||||
master-bin.000001 409 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; insert into t1 values(10)
|
||||
master-bin.000001 178 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 266 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 328 Query 1 # use `test`; insert into t1 values(11)
|
||||
master-bin.000001 410 Xid 1 # xid=67
|
||||
master-bin.000001 433 Query 1 # use `test`; COMMIT
|
||||
alter table t2 engine=INNODB;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -129,12 +133,13 @@ begin;
|
||||
insert into t1 values(12);
|
||||
insert into t2 select * from t1;
|
||||
commit;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(12)
|
||||
master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 327 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(12)
|
||||
master-bin.000001 240 Query 1 # use `test`; insert into t2 select * from t1
|
||||
master-bin.000001 328 Xid 1 # xid=77
|
||||
master-bin.000001 351 Query 1 # use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@ -142,7 +147,7 @@ begin;
|
||||
insert into t1 values(13);
|
||||
insert into t2 select * from t1;
|
||||
rollback;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -154,11 +159,12 @@ insert into t1 values(15);
|
||||
insert into t2 select * from t1;
|
||||
rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(14)
|
||||
master-bin.000001 239 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(14)
|
||||
master-bin.000001 240 Xid 1 # xid=93
|
||||
master-bin.000001 263 Query 1 # use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
@ -174,12 +180,13 @@ select a from t1 order by a;
|
||||
a
|
||||
16
|
||||
18
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 157 Query 1 # use `test`; insert into t1 values(16)
|
||||
master-bin.000001 239 Query 1 # use `test`; insert into t1 values(18)
|
||||
master-bin.000001 321 Query 1 # use `test`; COMMIT
|
||||
master-bin.000001 96 Query 1 # use `test`; BEGIN
|
||||
master-bin.000001 158 Query 1 # use `test`; insert into t1 values(16)
|
||||
master-bin.000001 240 Query 1 # use `test`; insert into t1 values(18)
|
||||
master-bin.000001 322 Xid 1 # xid=104
|
||||
master-bin.000001 345 Query 1 # use `test`; COMMIT
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
alter table t2 type=MyISAM;
|
||||
|
@ -716,7 +716,7 @@ qq
|
||||
*a *a*a *
|
||||
explain select * from t1 where v='a';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v,v_2 v_2 13 const 7 Using where
|
||||
1 SIMPLE t1 ref v,v_2 # 13 const # Using where
|
||||
select v,count(*) from t1 group by v limit 10;
|
||||
v count(*)
|
||||
a 1
|
||||
|
@ -1,7 +1,7 @@
|
||||
reset master;
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 95
|
||||
master-bin.000001 96
|
||||
reset slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
@ -17,7 +17,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 96 # # master-bin.000001 Yes Yes 0 0 96 # None 0 No #
|
||||
drop table if exists t1;
|
||||
create table t1 (n int);
|
||||
insert into t1 values (10),(45),(90);
|
||||
|
@ -16,11 +16,11 @@ n
|
||||
1
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 355 # # master-bin.000001 No No 0 0 274 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 356 # # master-bin.000001 No No 0 0 275 # None 0 No #
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 274 # # master-bin.000001 No No 0 0 274 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 275 # # master-bin.000001 No No 0 0 275 # None 0 No #
|
||||
select release_lock("a");
|
||||
release_lock("a")
|
||||
1
|
||||
|
@ -103,7 +103,7 @@ a b
|
||||
1 cp850_general_ci
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # drop database if exists mysqltest2
|
||||
master-bin.000001 # Query 1 # drop database if exists mysqltest3
|
||||
@ -200,8 +200,8 @@ hex(c1) hex(c2)
|
||||
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
|
||||
stop slave;
|
||||
delete from t1;
|
||||
change master to master_log_pos=6809;
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=6967;
|
||||
change master to master_log_pos=6810;
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=6968;
|
||||
start slave;
|
||||
select hex(c1), hex(c2) from t1;
|
||||
hex(c1) hex(c2)
|
||||
|
@ -9,7 +9,7 @@ insert into t1 values (1),(1);
|
||||
ERROR 23000: Duplicate entry '1' for key 1
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 274 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 274 # None 0 No #
|
||||
show tables like 't1';
|
||||
Tables_in_test (t1)
|
||||
drop table t1;
|
||||
@ -26,14 +26,14 @@ select (@id := id) - id from t3;
|
||||
0
|
||||
kill @id;
|
||||
drop table t2,t3;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 187 use `test`; create table t1 (a int primary key)
|
||||
master-bin.000001 187 Query 1 273 use `test`; insert into t1 values (1),(1)
|
||||
master-bin.000001 273 Query 1 343 use `test`; drop table t1
|
||||
master-bin.000001 343 Query 1 435 use `test`; create table t2 (a int primary key)
|
||||
master-bin.000001 435 Query 1 516 use `test`; insert into t2 values(1)
|
||||
master-bin.000001 516 Query 1 597 use `test`; create table t3 (id int)
|
||||
master-bin.000001 597 Query 1 692 use `test`; insert into t3 values(connection_id())
|
||||
master-bin.000001 692 Query 1 805 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
|
||||
master-bin.000001 805 Query 1 878 use `test`; drop table t2,t3
|
||||
master-bin.000001 96 Query 1 188 use `test`; create table t1 (a int primary key)
|
||||
master-bin.000001 188 Query 1 274 use `test`; insert into t1 values (1),(1)
|
||||
master-bin.000001 274 Query 1 344 use `test`; drop table t1
|
||||
master-bin.000001 344 Query 1 436 use `test`; create table t2 (a int primary key)
|
||||
master-bin.000001 436 Query 1 517 use `test`; insert into t2 values(1)
|
||||
master-bin.000001 517 Query 1 598 use `test`; create table t3 (id int)
|
||||
master-bin.000001 598 Query 1 693 use `test`; insert into t3 values(connection_id())
|
||||
master-bin.000001 693 Query 1 806 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
|
||||
master-bin.000001 806 Query 1 879 use `test`; drop table t2,t3
|
||||
|
@ -14,4 +14,4 @@ start slave;
|
||||
flush logs;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 199 # # slave-bin.000001 Yes Yes 0 0 199 # None 0 No #
|
||||
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 200 # # slave-bin.000001 Yes Yes 0 0 200 # None 0 No #
|
||||
|
@ -14,27 +14,27 @@ rename table t1 to t5, t2 to t1;
|
||||
flush no_write_to_binlog tables;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
|
||||
master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
|
||||
master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
|
||||
master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
|
||||
master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
|
||||
master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
|
||||
master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 176 use `test`; create table t1 (a int)
|
||||
master-bin.000001 176 Query 1 259 use `test`; insert into t1 values (10)
|
||||
master-bin.000001 259 Query 1 339 use `test`; create table t2 (a int)
|
||||
master-bin.000001 339 Query 1 442 use `test`; create table t3 (a int) engine=merge union(t1)
|
||||
master-bin.000001 442 Query 1 522 use `test`; create table t4 (a int)
|
||||
master-bin.000001 522 Query 1 610 use `test`; insert into t4 select * from t3
|
||||
master-bin.000001 610 Query 1 698 use `test`; rename table t1 to t5, t2 to t1
|
||||
select * from t3;
|
||||
a
|
||||
flush tables;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
|
||||
master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
|
||||
master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
|
||||
master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
|
||||
master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
|
||||
master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
|
||||
master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
|
||||
master-bin.000001 697 Query 1 766 use `test`; flush tables
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: SERVER_VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 176 use `test`; create table t1 (a int)
|
||||
master-bin.000001 176 Query 1 259 use `test`; insert into t1 values (10)
|
||||
master-bin.000001 259 Query 1 339 use `test`; create table t2 (a int)
|
||||
master-bin.000001 339 Query 1 442 use `test`; create table t3 (a int) engine=merge union(t1)
|
||||
master-bin.000001 442 Query 1 522 use `test`; create table t4 (a int)
|
||||
master-bin.000001 522 Query 1 610 use `test`; insert into t4 select * from t3
|
||||
master-bin.000001 610 Query 1 698 use `test`; rename table t1 to t5, t2 to t1
|
||||
master-bin.000001 698 Query 1 767 use `test`; flush tables
|
||||
select * from t3;
|
||||
a
|
||||
|
@ -22,7 +22,7 @@ day id category name
|
||||
2003-03-22 2416 a bbbbb
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
slave-bin.000001 1068
|
||||
slave-bin.000001 1069
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
@ -33,7 +33,7 @@ set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1503 # # master-bin.000001 Yes Yes 0 0 1503 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1504 # # master-bin.000001 Yes Yes 0 0 1504 # None 0 No #
|
||||
set sql_log_bin=0;
|
||||
delete from t1;
|
||||
set sql_log_bin=1;
|
||||
@ -43,7 +43,7 @@ change master to master_user='test';
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1611 # # master-bin.000001 No No 0 0 1611 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1612 # # master-bin.000001 No No 0 0 1612 # None 0 No #
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
set sql_log_bin=0;
|
||||
@ -64,5 +64,5 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
ERROR 23000: Duplicate entry '2003-03-22' for key 1
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 529
|
||||
master-bin.000001 530
|
||||
drop table t2;
|
||||
|
@ -10,8 +10,8 @@ create database mysqltest;
|
||||
create table t1(a int, b int, unique(b));
|
||||
use mysqltest;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 190 drop database if exists mysqltest
|
||||
master-bin.000001 190 Query 1 277 create database mysqltest
|
||||
master-bin.000001 96 Query 1 191 drop database if exists mysqltest
|
||||
master-bin.000001 191 Query 1 278 create database mysqltest
|
||||
drop database mysqltest;
|
||||
|
@ -10,5 +10,5 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
|
@ -19,25 +19,25 @@ count(*)
|
||||
drop table t1;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 210 Intvar 1 238 INSERT_ID=1
|
||||
master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 323 Query 1 393 use `test`; drop table t1
|
||||
master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
|
||||
master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
|
||||
master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
|
||||
master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
|
||||
show binlog events from 95 limit 1;
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 211 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 211 Intvar 1 239 INSERT_ID=1
|
||||
master-bin.000001 239 Query 1 324 use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 324 Query 1 394 use `test`; drop table t1
|
||||
master-bin.000001 394 Query 1 491 use `test`; create table t1 (word char(20) not null)
|
||||
master-bin.000001 491 Create_file 1 1161 db=test;table=t1;file_id=1;block_len=581
|
||||
master-bin.000001 1161 Exec_load 1 1184 ;file_id=1
|
||||
master-bin.000001 1184 Query 1 1254 use `test`; drop table t1
|
||||
show binlog events from 96 limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
show binlog events from 95 limit 2;
|
||||
master-bin.000001 96 Query 1 211 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
show binlog events from 96 limit 2;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 210 Intvar 1 238 INSERT_ID=1
|
||||
show binlog events from 95 limit 2,1;
|
||||
master-bin.000001 96 Query 1 211 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 211 Intvar 1 239 INSERT_ID=1
|
||||
show binlog events from 96 limit 2,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 239 Query 1 324 use `test`; insert into t1 values (NULL)
|
||||
flush logs;
|
||||
create table t5 (a int);
|
||||
drop table t5;
|
||||
@ -49,24 +49,24 @@ insert into t1 values (1);
|
||||
drop table t1;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 210 Intvar 1 238 INSERT_ID=1
|
||||
master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 323 Query 1 393 use `test`; drop table t1
|
||||
master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
|
||||
master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
|
||||
master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
|
||||
master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
|
||||
master-bin.000001 1253 Rotate 1 1297 master-bin.000002;pos=4
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 211 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 211 Intvar 1 239 INSERT_ID=1
|
||||
master-bin.000001 239 Query 1 324 use `test`; insert into t1 values (NULL)
|
||||
master-bin.000001 324 Query 1 394 use `test`; drop table t1
|
||||
master-bin.000001 394 Query 1 491 use `test`; create table t1 (word char(20) not null)
|
||||
master-bin.000001 491 Create_file 1 1161 db=test;table=t1;file_id=1;block_len=581
|
||||
master-bin.000001 1161 Exec_load 1 1184 ;file_id=1
|
||||
master-bin.000001 1184 Query 1 1254 use `test`; drop table t1
|
||||
master-bin.000001 1254 Rotate 1 1298 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 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000002 95 Query 1 175 use `test`; create table t5 (a int)
|
||||
master-bin.000002 175 Query 1 245 use `test`; drop table t5
|
||||
master-bin.000002 245 Query 1 325 use `test`; create table t1 (n int)
|
||||
master-bin.000002 325 Query 1 407 use `test`; insert into t1 values (1)
|
||||
master-bin.000002 407 Query 1 477 use `test`; drop table t1
|
||||
master-bin.000002 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000002 96 Query 1 176 use `test`; create table t5 (a int)
|
||||
master-bin.000002 176 Query 1 246 use `test`; drop table t5
|
||||
master-bin.000002 246 Query 1 326 use `test`; create table t1 (n int)
|
||||
master-bin.000002 326 Query 1 408 use `test`; insert into t1 values (1)
|
||||
master-bin.000002 408 Query 1 478 use `test`; drop table t1
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000001
|
||||
@ -78,26 +78,26 @@ slave-bin.000001
|
||||
slave-bin.000002
|
||||
show binlog events in 'slave-bin.000001' from 4;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 4 Format_desc 2 95 Server ver: VERSION, Binlog ver: 4
|
||||
slave-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
slave-bin.000001 210 Intvar 1 238 INSERT_ID=1
|
||||
slave-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
|
||||
slave-bin.000001 323 Query 1 393 use `test`; drop table t1
|
||||
slave-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
|
||||
slave-bin.000001 490 Create_file 1 1169 db=test;table=t1;file_id=1;block_len=581
|
||||
slave-bin.000001 1169 Exec_load 1 1192 ;file_id=1
|
||||
slave-bin.000001 1192 Query 1 1262 use `test`; drop table t1
|
||||
slave-bin.000001 1262 Query 1 1342 use `test`; create table t5 (a int)
|
||||
slave-bin.000001 1342 Query 1 1412 use `test`; drop table t5
|
||||
slave-bin.000001 1412 Rotate 2 1455 slave-bin.000002;pos=4
|
||||
slave-bin.000001 4 Format_desc 2 96 Server ver: VERSION, Binlog ver: 4
|
||||
slave-bin.000001 96 Query 1 211 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
slave-bin.000001 211 Intvar 1 239 INSERT_ID=1
|
||||
slave-bin.000001 239 Query 1 324 use `test`; insert into t1 values (NULL)
|
||||
slave-bin.000001 324 Query 1 394 use `test`; drop table t1
|
||||
slave-bin.000001 394 Query 1 491 use `test`; create table t1 (word char(20) not null)
|
||||
slave-bin.000001 491 Create_file 1 1170 db=test;table=t1;file_id=1;block_len=581
|
||||
slave-bin.000001 1170 Exec_load 1 1193 ;file_id=1
|
||||
slave-bin.000001 1193 Query 1 1263 use `test`; drop table t1
|
||||
slave-bin.000001 1263 Query 1 1343 use `test`; create table t5 (a int)
|
||||
slave-bin.000001 1343 Query 1 1413 use `test`; drop table t5
|
||||
slave-bin.000001 1413 Rotate 2 1456 slave-bin.000002;pos=4
|
||||
show binlog events in 'slave-bin.000002' from 4;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000002 4 Format_desc 2 95 Server ver: VERSION, Binlog ver: 4
|
||||
slave-bin.000002 95 Query 1 175 use `test`; create table t1 (n int)
|
||||
slave-bin.000002 175 Query 1 257 use `test`; insert into t1 values (1)
|
||||
slave-bin.000002 257 Query 1 327 use `test`; drop table t1
|
||||
slave-bin.000002 4 Format_desc 2 96 Server ver: VERSION, Binlog ver: 4
|
||||
slave-bin.000002 96 Query 1 176 use `test`; create table t1 (n int)
|
||||
slave-bin.000002 176 Query 1 258 use `test`; insert into t1 values (1)
|
||||
slave-bin.000002 258 Query 1 328 use `test`; drop table t1
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 477 # # master-bin.000002 Yes Yes 0 0 477 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 478 # # master-bin.000002 Yes Yes 0 0 478 # None 0 No #
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||
|
@ -6,10 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 95
|
||||
master-bin.000001 96
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 96 # # master-bin.000001 Yes Yes 0 0 96 # None 0 No #
|
||||
stop slave;
|
||||
change master to master_log_pos=73;
|
||||
start slave;
|
||||
@ -30,13 +30,13 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 # # master-bin.000001 No Yes 0 0 173 # None 0 No #
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 95
|
||||
master-bin.000001 96
|
||||
create table if not exists t1 (n int);
|
||||
drop table if exists t1;
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
stop slave;
|
||||
change master to master_log_pos=95;
|
||||
change master to master_log_pos=96;
|
||||
start slave;
|
||||
select * from t1;
|
||||
n
|
||||
|
@ -16,7 +16,7 @@ select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68138 # # master-bin.000001 Yes Yes 0 0 68138 # None 0 No #
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=(5*4096);
|
||||
@ -26,7 +26,7 @@ select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68138 # # master-bin.000001 Yes Yes 0 0 68138 # None 0 No #
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=0;
|
||||
@ -36,7 +36,7 @@ select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68138 # # master-bin.000001 Yes Yes 0 0 68138 # None 0 No #
|
||||
stop slave;
|
||||
reset slave;
|
||||
flush logs;
|
||||
@ -49,13 +49,13 @@ flush logs;
|
||||
create table t1 (a int);
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68217 # # master-bin.000001 Yes Yes 0 0 68217 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68218 # # master-bin.000001 Yes Yes 0 0 68218 # None 0 No #
|
||||
flush logs;
|
||||
drop table t1;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68287 # # master-bin.000001 Yes Yes 0 0 68287 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68288 # # master-bin.000001 Yes Yes 0 0 68288 # None 0 No #
|
||||
flush logs;
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000002 95
|
||||
master-bin.000002 96
|
||||
|
@ -18,5 +18,5 @@ max(a)
|
||||
8000
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 687207 # # master-bin.000001 Yes Yes 0 0 687207 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 687231 # # master-bin.000001 Yes Yes 0 0 687231 # None 0 No #
|
||||
drop table t1;
|
||||
|
@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
|
||||
drop table if exists t1,t2,t11;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1554 # # master-bin.000001 Yes Yes test.t1 0 0 1554 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1555 # # master-bin.000001 Yes Yes test.t1 0 0 1555 # None 0 No #
|
||||
|
@ -6,12 +6,12 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 96 # # master-bin.000001 Yes Yes 0 0 96 # None 0 No #
|
||||
stop slave;
|
||||
change master to master_user='test';
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 95 # # master-bin.000001 No No 0 0 95 # None 0 No #
|
||||
# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 96 # # master-bin.000001 No No 0 0 96 # None 0 No #
|
||||
reset slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
@ -19,7 +19,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 96 # # master-bin.000001 Yes Yes 0 0 96 # None 0 No #
|
||||
stop slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
|
@ -16,7 +16,7 @@ create table t1 (s text);
|
||||
insert into t1 values('Could not break slave'),('Tried hard');
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 521 # # master-bin.000001 Yes Yes 0 0 521 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 522 # # master-bin.000001 Yes Yes 0 0 522 # None 0 No #
|
||||
select * from t1;
|
||||
s
|
||||
Could not break slave
|
||||
@ -57,7 +57,7 @@ master-bin.000003
|
||||
insert into t2 values (65);
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 469 # # master-bin.000003 Yes Yes 0 0 469 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 470 # # master-bin.000003 Yes Yes 0 0 470 # None 0 No #
|
||||
select * from t2;
|
||||
m
|
||||
34
|
||||
@ -79,13 +79,13 @@ master-bin.000004
|
||||
master-bin.000005
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000005 1387
|
||||
master-bin.000005 1388
|
||||
select * from t4;
|
||||
a
|
||||
testing temporary tables part 2
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 1387 # # master-bin.000005 Yes Yes 0 0 1387 # None 0 No #
|
||||
# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 1388 # # master-bin.000005 Yes Yes 0 0 1388 # None 0 No #
|
||||
lock tables t3 read;
|
||||
select count(*) from t3 where n >= 4;
|
||||
count(*)
|
||||
|
@ -10,7 +10,7 @@ stop slave;
|
||||
change master to master_port=SLAVE_PORT;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 95 None 0 No NULL
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 96 None 0 No NULL
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
show status like "slave_running";
|
||||
|
@ -10,7 +10,7 @@ stop slave;
|
||||
change master to master_port=SLAVE_PORT;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 95 None 0 No NULL
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 96 None 0 No NULL
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
select * from t1;
|
||||
|
@ -38,19 +38,19 @@ f
|
||||
7
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 178 use `test`; drop table if exists t1,t2
|
||||
master-bin.000001 178 Query 1 257 use `test`; create table t1(f int)
|
||||
master-bin.000001 257 Query 1 336 use `test`; create table t2(f int)
|
||||
master-bin.000001 336 Query 1 455 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
|
||||
master-bin.000001 455 Query 1 544 use `test`; create temporary table t3(f int)
|
||||
master-bin.000001 544 Query 1 642 use `test`; insert into t3 select * from t1 where f<6
|
||||
master-bin.000001 642 Query 1 731 use `test`; create temporary table t3(f int)
|
||||
master-bin.000001 731 Query 1 826 use `test`; insert into t2 select count(*) from t3
|
||||
master-bin.000001 826 Query 1 925 use `test`; insert into t3 select * from t1 where f>=4
|
||||
master-bin.000001 925 Query 1 1005 use `test`; drop temporary table t3
|
||||
master-bin.000001 1005 Query 1 1100 use `test`; insert into t2 select count(*) from t3
|
||||
master-bin.000001 1100 Query 1 1180 use `test`; drop temporary table t3
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 179 use `test`; drop table if exists t1,t2
|
||||
master-bin.000001 179 Query 1 258 use `test`; create table t1(f int)
|
||||
master-bin.000001 258 Query 1 337 use `test`; create table t2(f int)
|
||||
master-bin.000001 337 Query 1 456 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
|
||||
master-bin.000001 456 Query 1 545 use `test`; create temporary table t3(f int)
|
||||
master-bin.000001 545 Query 1 643 use `test`; insert into t3 select * from t1 where f<6
|
||||
master-bin.000001 643 Query 1 732 use `test`; create temporary table t3(f int)
|
||||
master-bin.000001 732 Query 1 827 use `test`; insert into t2 select count(*) from t3
|
||||
master-bin.000001 827 Query 1 926 use `test`; insert into t3 select * from t1 where f>=4
|
||||
master-bin.000001 926 Query 1 1006 use `test`; drop temporary table t3
|
||||
master-bin.000001 1006 Query 1 1101 use `test`; insert into t2 select count(*) from t3
|
||||
master-bin.000001 1101 Query 1 1181 use `test`; drop temporary table t3
|
||||
drop table t1, t2;
|
||||
use test;
|
||||
SET TIMESTAMP=1040323920;
|
||||
|
@ -32,13 +32,13 @@ t
|
||||
2004-06-11 09:39:02
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp)
|
||||
master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32))
|
||||
master-bin.000001 266 Query 1 351 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
|
||||
master-bin.000001 351 Query 1 468 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
|
||||
master-bin.000001 468 Query 1 539 use `test`; delete from t1
|
||||
master-bin.000001 539 Query 1 656 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 182 use `test`; create table t1 (t timestamp)
|
||||
master-bin.000001 182 Query 1 267 use `test`; create table t2 (t char(32))
|
||||
master-bin.000001 267 Query 1 352 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
|
||||
master-bin.000001 352 Query 1 469 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
|
||||
master-bin.000001 469 Query 1 540 use `test`; delete from t1
|
||||
master-bin.000001 540 Query 1 657 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
|
||||
set time_zone='MET';
|
||||
insert into t2 (select t from t1);
|
||||
select * from t1;
|
||||
|
@ -14,14 +14,14 @@ insert into t2 values (3),(4);
|
||||
drop table t2;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 210 Query 1 304 use `test`; insert into t1 values (1),(2),(3),(4)
|
||||
master-bin.000001 304 Query 1 374 use `test`; drop table t1
|
||||
master-bin.000001 374 Query 1 489 use `test`; create table t2(n int not null auto_increment primary key)
|
||||
master-bin.000001 489 Query 1 575 use `test`; insert into t2 values (1),(2)
|
||||
master-bin.000001 575 Query 1 661 use `test`; insert into t2 values (3),(4)
|
||||
master-bin.000001 661 Query 1 731 use `test`; drop table t2
|
||||
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 96 Query 1 211 use `test`; create table t1(n int not null auto_increment primary key)
|
||||
master-bin.000001 211 Query 1 305 use `test`; insert into t1 values (1),(2),(3),(4)
|
||||
master-bin.000001 305 Query 1 375 use `test`; drop table t1
|
||||
master-bin.000001 375 Query 1 490 use `test`; create table t2(n int not null auto_increment primary key)
|
||||
master-bin.000001 490 Query 1 576 use `test`; insert into t2 values (1),(2)
|
||||
master-bin.000001 576 Query 1 662 use `test`; insert into t2 values (3),(4)
|
||||
master-bin.000001 662 Query 1 732 use `test`; drop table t2
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=304;
|
||||
select * from t1;
|
||||
n
|
||||
@ -31,7 +31,7 @@ n
|
||||
4
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-bin.000001 304 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 732 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 305 # Master master-bin.000001 304 No #
|
||||
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
|
||||
select * from t1;
|
||||
n
|
||||
@ -41,7 +41,7 @@ n
|
||||
4
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-no-such-bin.000001 291 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 732 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 305 # Master master-no-such-bin.000001 291 No #
|
||||
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=710;
|
||||
select * from t2;
|
||||
n
|
||||
@ -49,13 +49,13 @@ n
|
||||
2
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 575 # Relay slave-relay-bin.000004 710 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 732 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 576 # Relay slave-relay-bin.000004 710 No #
|
||||
start slave;
|
||||
stop slave;
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=710;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 731 # Master master-bin.000001 710 No #
|
||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 732 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 732 # Master master-bin.000001 710 No #
|
||||
start slave until master_log_file='master-bin', master_log_pos=561;
|
||||
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
||||
|
@ -76,34 +76,34 @@ abcn1n2
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
show binlog events from 179;
|
||||
show binlog events from 180;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 179 User var 2 222 @`i1`=12345678901234
|
||||
slave-bin.000001 222 User var 2 265 @`i2`=-12345678901234
|
||||
slave-bin.000001 265 User var 2 308 @`i3`=0
|
||||
slave-bin.000001 308 User var 2 351 @`i4`=-1
|
||||
slave-bin.000001 351 Query 1 456 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
|
||||
slave-bin.000001 456 User var 2 499 @`r1`=12.5
|
||||
slave-bin.000001 499 User var 2 542 @`r2`=-12.5
|
||||
slave-bin.000001 542 Query 1 633 use `test`; insert into t1 values (@r1), (@r2)
|
||||
slave-bin.000001 633 User var 2 682 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 682 User var 2 717 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 717 User var 2 759 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 759 User var 2 801 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 801 User var 2 843 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 843 Query 1 955 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
|
||||
slave-bin.000001 955 User var 2 981 @`n1`=NULL
|
||||
slave-bin.000001 981 Query 1 1065 use `test`; insert into t1 values (@n1)
|
||||
slave-bin.000001 1065 User var 2 1091 @`n2`=NULL
|
||||
slave-bin.000001 1091 Query 1 1175 use `test`; insert into t1 values (@n2)
|
||||
slave-bin.000001 1175 Query 1 1285 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
|
||||
slave-bin.000001 1285 User var 2 1327 @`a`=2
|
||||
slave-bin.000001 1327 Query 1 1421 use `test`; insert into t1 values (@a+(@b:=@a+1))
|
||||
slave-bin.000001 1421 User var 2 1458 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 1458 Query 1 1584 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
|
||||
slave-bin.000001 1584 User var 2 1626 @`a`=5
|
||||
slave-bin.000001 1626 Query 1 1714 use `test`; insert into t1 values (@a),(@a)
|
||||
slave-bin.000001 1714 User var 2 1739 @`a`=NULL
|
||||
slave-bin.000001 1739 Query 1 1834 use `test`; insert into t1 values (@a),(@a),(@a*5)
|
||||
slave-bin.000001 180 User var 2 223 @`i1`=12345678901234
|
||||
slave-bin.000001 223 User var 2 266 @`i2`=-12345678901234
|
||||
slave-bin.000001 266 User var 2 309 @`i3`=0
|
||||
slave-bin.000001 309 User var 2 352 @`i4`=-1
|
||||
slave-bin.000001 352 Query 1 457 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
|
||||
slave-bin.000001 457 User var 2 500 @`r1`=12.5
|
||||
slave-bin.000001 500 User var 2 543 @`r2`=-12.5
|
||||
slave-bin.000001 543 Query 1 634 use `test`; insert into t1 values (@r1), (@r2)
|
||||
slave-bin.000001 634 User var 2 683 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 683 User var 2 718 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 718 User var 2 760 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 760 User var 2 802 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 802 User var 2 844 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 844 Query 1 956 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
|
||||
slave-bin.000001 956 User var 2 982 @`n1`=NULL
|
||||
slave-bin.000001 982 Query 1 1066 use `test`; insert into t1 values (@n1)
|
||||
slave-bin.000001 1066 User var 2 1092 @`n2`=NULL
|
||||
slave-bin.000001 1092 Query 1 1176 use `test`; insert into t1 values (@n2)
|
||||
slave-bin.000001 1176 Query 1 1286 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
|
||||
slave-bin.000001 1286 User var 2 1328 @`a`=2
|
||||
slave-bin.000001 1328 Query 1 1422 use `test`; insert into t1 values (@a+(@b:=@a+1))
|
||||
slave-bin.000001 1422 User var 2 1459 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
|
||||
slave-bin.000001 1459 Query 1 1585 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
|
||||
slave-bin.000001 1585 User var 2 1627 @`a`=5
|
||||
slave-bin.000001 1627 Query 1 1715 use `test`; insert into t1 values (@a),(@a)
|
||||
slave-bin.000001 1715 User var 2 1740 @`a`=NULL
|
||||
slave-bin.000001 1740 Query 1 1835 use `test`; insert into t1 values (@a),(@a),(@a*5)
|
||||
drop table t1;
|
||||
stop slave;
|
||||
|
@ -173,12 +173,12 @@ SET @`a b`='hello';
|
||||
INSERT INTO t1 VALUES(@`a b`);
|
||||
set @var1= "';aaa";
|
||||
insert into t1 values (@var1);
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
|
||||
master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`)
|
||||
master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 264 Query 1 350 use `test`; insert into t1 values (@var1)
|
||||
master-bin.000001 96 User var 1 137 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
|
||||
master-bin.000001 137 Query 1 223 use `test`; INSERT INTO t1 VALUES(@`a b`)
|
||||
master-bin.000001 223 User var 1 265 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 265 Query 1 351 use `test`; insert into t1 values (@var1)
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
|
||||
use test;
|
||||
|
@ -338,7 +338,7 @@ create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
|
@ -26,7 +26,7 @@ insert into t2 select * from t1;
|
||||
commit;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -39,7 +39,7 @@ insert into t2 select * from t1;
|
||||
rollback;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -54,7 +54,7 @@ rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -71,7 +71,7 @@ commit;
|
||||
select a from t1 order by a; # check that savepoints work :)
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
# and when ROLLBACK is not explicit?
|
||||
delete from t1;
|
||||
@ -92,7 +92,7 @@ connection con2;
|
||||
# logging has been done, we use a user lock.
|
||||
select get_lock("a",10);
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
# and when not in a transact1on?
|
||||
delete from t1;
|
||||
@ -103,7 +103,7 @@ insert into t1 values(9);
|
||||
insert into t2 select * from t1;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
# Check that when the query updat1ng the MyISAM table is the first in the
|
||||
# transaction, we log it immediately.
|
||||
@ -115,12 +115,12 @@ insert into t1 values(10); # first make t1 non-empty
|
||||
begin;
|
||||
insert into t2 select * from t1;
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
insert into t1 values(11);
|
||||
commit;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
|
||||
# Check that things work like before this BEGIN/ROLLBACK code was added,
|
||||
@ -138,7 +138,7 @@ insert into t2 select * from t1;
|
||||
commit;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -150,7 +150,7 @@ insert into t2 select * from t1;
|
||||
rollback;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -165,7 +165,7 @@ rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
@ -182,7 +182,7 @@ commit;
|
||||
select a from t1 order by a; # check that savepoints work :)
|
||||
|
||||
--replace_column 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
|
||||
# Test for BUG#5714, where a MyISAM update in the transaction used to
|
||||
# release row-level locks in InnoDB
|
||||
|
@ -61,7 +61,7 @@ select "--- --database --" as "";
|
||||
select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=118 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=119 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
|
||||
# These are tests for remote binlog.
|
||||
# They should return the same as previous test.
|
||||
@ -93,7 +93,7 @@ select "--- --database --" as "";
|
||||
select "--- --position --" as "";
|
||||
--enable_query_log
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=118 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=119 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||
|
||||
# clean up
|
||||
drop table t1, t2;
|
||||
|
@ -46,11 +46,11 @@ select "--- offset --" as "";
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=601 $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=602 $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=601 $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=602 $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
@ -75,11 +75,11 @@ select "--- offset --" as "";
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=601 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=602 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=123 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=124 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
@ -102,11 +102,11 @@ select "--- offset --" as "";
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=601 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=602 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=601 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=602 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
@ -129,11 +129,11 @@ select "--- offset --" as "";
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=601 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=602 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=123 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=124 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
|
@ -107,7 +107,7 @@ connection master;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Check that we can't change global.collation_server
|
||||
@ -163,14 +163,14 @@ delete from t1;
|
||||
# command just before the INSERT.
|
||||
# You can find it by doing:
|
||||
# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 CHARACTER_SET | tail -7
|
||||
change master to master_log_pos=6809;
|
||||
change master to master_log_pos=6810;
|
||||
|
||||
# This position should be position of the INSERT command.
|
||||
# You can find it by doing:
|
||||
#
|
||||
# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 INSERT | tail -4
|
||||
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=6967;
|
||||
start slave until master_log_file='master-bin.000001', master_log_pos=6968;
|
||||
|
||||
# Slave is supposed to stop _after_ the INSERT, even though 'master_log_pos' is
|
||||
# the position of the beginning of the INSERT; after SET slave is not
|
||||
|
@ -48,7 +48,7 @@ connection master;
|
||||
--error 0,1053;
|
||||
reap;
|
||||
connection master1;
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# SQL slave thread should not have stopped (because table of the killed
|
||||
|
@ -19,5 +19,5 @@ create database mysqltest;
|
||||
create table t1(a int, b int, unique(b));
|
||||
use mysqltest;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
|
||||
show binlog events from 95; # should be nothing
|
||||
show binlog events from 96; # should be nothing
|
||||
drop database mysqltest;
|
||||
|
@ -17,4 +17,4 @@ save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select count(*) from t1; # check that LOAD was replicated
|
||||
show binlog events from 95; # should be nothing
|
||||
show binlog events from 96; # should be nothing
|
||||
|
@ -38,9 +38,9 @@ select count(*) from t1;
|
||||
drop table t1;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
show binlog events from 95 limit 1;
|
||||
show binlog events from 95 limit 2;
|
||||
show binlog events from 95 limit 2,1;
|
||||
show binlog events from 96 limit 1;
|
||||
show binlog events from 96 limit 2;
|
||||
show binlog events from 96 limit 2,1;
|
||||
flush logs;
|
||||
|
||||
# We need an extra update before doing save_master_pos.
|
||||
|
@ -38,7 +38,7 @@ insert into t1 values (1),(2),(3);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
stop slave;
|
||||
change master to master_log_pos=95;
|
||||
change master to master_log_pos=96;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
|
@ -46,7 +46,7 @@ save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
show binlog events from 179;
|
||||
show binlog events from 180;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
|
@ -109,7 +109,7 @@ SET @`a b`='hello';
|
||||
INSERT INTO t1 VALUES(@`a b`);
|
||||
set @var1= "';aaa";
|
||||
insert into t1 values (@var1);
|
||||
show binlog events from 95;
|
||||
show binlog events from 96;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
|
@ -103,7 +103,7 @@ static inline void hash_free_elements(HASH *hash)
|
||||
hash_free()
|
||||
hash the hash to delete elements of
|
||||
|
||||
NOTES: Hash can't be reused wuthing calling hash_init again.
|
||||
NOTES: Hash can't be reused without calling hash_init again.
|
||||
*/
|
||||
|
||||
void hash_free(HASH *hash)
|
||||
|
@ -102,11 +102,32 @@ static int write_status(DB *status_block, char *buff, uint length);
|
||||
static void update_status(BDB_SHARE *share, TABLE *table);
|
||||
static void berkeley_noticecall(DB_ENV *db_env, db_notices notice);
|
||||
|
||||
static int berkeley_close_connection(THD *thd);
|
||||
static int berkeley_commit(THD *thd, bool all);
|
||||
static int berkeley_rollback(THD *thd, bool all);
|
||||
|
||||
static handlerton berkeley_hton = {
|
||||
0, /* slot */
|
||||
0, /* savepoint size */
|
||||
berkeley_close_connection,
|
||||
NULL, /* savepoint_set */
|
||||
NULL, /* savepoint_rollback */
|
||||
NULL, /* savepoint_release */
|
||||
berkeley_commit,
|
||||
berkeley_rollback,
|
||||
NULL, /* prepare */
|
||||
NULL, /* recover */
|
||||
};
|
||||
|
||||
typedef struct st_berkeley_trx_data {
|
||||
DB_TXN *all;
|
||||
DB_TXN *stmt;
|
||||
uint bdb_lock_count;
|
||||
} berkeley_trx_data;
|
||||
|
||||
/* General functions */
|
||||
|
||||
bool berkeley_init(void)
|
||||
handlerton *berkeley_init(void)
|
||||
{
|
||||
DBUG_ENTER("berkeley_init");
|
||||
|
||||
@ -135,7 +156,7 @@ bool berkeley_init(void)
|
||||
berkeley_log_file_size= max(berkeley_log_file_size, 10*1024*1024L);
|
||||
|
||||
if (db_env_create(&db_env,0))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
DBUG_RETURN(0);
|
||||
db_env->set_errcall(db_env,berkeley_print_error);
|
||||
db_env->set_errpfx(db_env,"bdb");
|
||||
db_env->set_noticecall(db_env, berkeley_noticecall);
|
||||
@ -163,14 +184,15 @@ bool berkeley_init(void)
|
||||
DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN |
|
||||
DB_CREATE | DB_THREAD, 0666))
|
||||
{
|
||||
db_env->close(db_env,0); /* purecov: inspected */
|
||||
db_env=0; /* purecov: inspected */
|
||||
db_env->close(db_env,0);
|
||||
db_env=0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
(void) hash_init(&bdb_open_tables,system_charset_info,32,0,0,
|
||||
(hash_get_key) bdb_get_key,0,0);
|
||||
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST);
|
||||
DBUG_RETURN(db_env == 0);
|
||||
DBUG_RETURN(&berkeley_hton);
|
||||
}
|
||||
|
||||
|
||||
@ -188,6 +210,11 @@ bool berkeley_end(void)
|
||||
DBUG_RETURN(error != 0);
|
||||
}
|
||||
|
||||
static int berkeley_close_connection(THD *thd)
|
||||
{
|
||||
my_free((gptr)thd->ha_data[berkeley_hton.slot], MYF(0));
|
||||
}
|
||||
|
||||
bool berkeley_flush_logs()
|
||||
{
|
||||
int error;
|
||||
@ -206,26 +233,33 @@ bool berkeley_flush_logs()
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
||||
int berkeley_commit(THD *thd, void *trans)
|
||||
static int berkeley_commit(THD *thd, bool all)
|
||||
{
|
||||
DBUG_ENTER("berkeley_commit");
|
||||
DBUG_PRINT("trans",("ending transaction %s",
|
||||
trans == thd->transaction.stmt.bdb_tid ? "stmt" : "all"));
|
||||
int error=txn_commit((DB_TXN*) trans,0);
|
||||
DBUG_PRINT("trans",("ending transaction %s", all ? "all" : "stmt"));
|
||||
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
|
||||
int error=txn_commit(all ? trx->all : trx->stmt,0);
|
||||
#ifndef DBUG_OFF
|
||||
if (error)
|
||||
DBUG_PRINT("error",("error: %d",error)); /* purecov: inspected */
|
||||
DBUG_PRINT("error",("error: %d",error));
|
||||
#endif
|
||||
if (all)
|
||||
trx->all=0;
|
||||
else
|
||||
trx->stmt=0;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
int berkeley_rollback(THD *thd, void *trans)
|
||||
static int berkeley_rollback(THD *thd, bool all)
|
||||
{
|
||||
DBUG_ENTER("berkeley_rollback");
|
||||
DBUG_PRINT("trans",("aborting transaction %s",
|
||||
trans == thd->transaction.stmt.bdb_tid ? "stmt" : "all"));
|
||||
int error=txn_abort((DB_TXN*) trans);
|
||||
DBUG_PRINT("trans",("aborting transaction %s", all ? "all" : "stmt"));
|
||||
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
|
||||
int error=txn_abort(all ? trx->all : trx->stmt);
|
||||
if (all)
|
||||
trx->all=0;
|
||||
else
|
||||
trx->stmt=0;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
@ -1818,52 +1852,56 @@ int ha_berkeley::reset(void)
|
||||
int ha_berkeley::external_lock(THD *thd, int lock_type)
|
||||
{
|
||||
int error=0;
|
||||
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
|
||||
DBUG_ENTER("ha_berkeley::external_lock");
|
||||
if (!trx)
|
||||
{
|
||||
thd->ha_data[berkeley_hton.slot]= trx= (berkeley_trx_data *)
|
||||
my_malloc(sizeof(*trx), MYF(MY_ZEROFILL));
|
||||
if (!trx)
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (lock_type != F_UNLCK)
|
||||
{
|
||||
if (!thd->transaction.bdb_lock_count++)
|
||||
if (!trx->bdb_lock_count++)
|
||||
{
|
||||
DBUG_ASSERT(thd->transaction.stmt.bdb_tid == 0);
|
||||
DBUG_ASSERT(trx->stmt == 0);
|
||||
transaction=0; // Safety
|
||||
/* First table lock, start transaction */
|
||||
if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN |
|
||||
OPTION_TABLE_LOCK)) &&
|
||||
!thd->transaction.all.bdb_tid)
|
||||
OPTION_TABLE_LOCK)) && !trx->all)
|
||||
{
|
||||
/* We have to start a master transaction */
|
||||
DBUG_PRINT("trans",("starting transaction all: options: 0x%lx",
|
||||
(ulong) thd->options));
|
||||
if ((error=txn_begin(db_env, 0,
|
||||
(DB_TXN**) &thd->transaction.all.bdb_tid,
|
||||
0)))
|
||||
if ((error=txn_begin(db_env, 0, &trx->all, 0)))
|
||||
{
|
||||
thd->transaction.bdb_lock_count--; // We didn't get the lock /* purecov: inspected */
|
||||
DBUG_RETURN(error); /* purecov: inspected */
|
||||
trx->bdb_lock_count--; // We didn't get the lock
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
trans_register_ha(thd, TRUE, &berkeley_hton);
|
||||
if (thd->in_lock_tables)
|
||||
DBUG_RETURN(0); // Don't create stmt trans
|
||||
}
|
||||
DBUG_PRINT("trans",("starting transaction stmt"));
|
||||
if ((error=txn_begin(db_env,
|
||||
(DB_TXN*) thd->transaction.all.bdb_tid,
|
||||
(DB_TXN**) &thd->transaction.stmt.bdb_tid,
|
||||
0)))
|
||||
if ((error=txn_begin(db_env, trx->all, &trx->stmt, 0)))
|
||||
{
|
||||
/* We leave the possible master transaction open */
|
||||
thd->transaction.bdb_lock_count--; // We didn't get the lock /* purecov: inspected */
|
||||
DBUG_RETURN(error); /* purecov: inspected */
|
||||
trx->bdb_lock_count--; // We didn't get the lock
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
trans_register_ha(thd, FALSE, &berkeley_hton);
|
||||
}
|
||||
transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid;
|
||||
transaction= trx->stmt;
|
||||
}
|
||||
else
|
||||
{
|
||||
lock.type=TL_UNLOCK; // Unlocked
|
||||
thread_safe_add(share->rows, changed_rows, &share->mutex);
|
||||
changed_rows=0;
|
||||
if (!--thd->transaction.bdb_lock_count)
|
||||
if (!--trx->bdb_lock_count)
|
||||
{
|
||||
if (thd->transaction.stmt.bdb_tid)
|
||||
if (trx->stmt)
|
||||
{
|
||||
/*
|
||||
F_UNLOCK is done without a transaction commit / rollback.
|
||||
@ -1871,9 +1909,8 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
|
||||
We must in this case commit the work to keep the row locks
|
||||
*/
|
||||
DBUG_PRINT("trans",("commiting non-updating transaction"));
|
||||
error=txn_commit((DB_TXN*) thd->transaction.stmt.bdb_tid,0);
|
||||
thd->transaction.stmt.bdb_tid=0;
|
||||
transaction=0;
|
||||
error= txn_commit(trx->stmt,0);
|
||||
trx->stmt= transaction= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1891,14 +1928,19 @@ int ha_berkeley::start_stmt(THD *thd)
|
||||
{
|
||||
int error=0;
|
||||
DBUG_ENTER("ha_berkeley::start_stmt");
|
||||
if (!thd->transaction.stmt.bdb_tid)
|
||||
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
|
||||
/*
|
||||
note that trx->stmt may have been already initialized as start_stmt()
|
||||
is called for *each table* not for each storage engine,
|
||||
and there could be many bdb tables referenced in the query
|
||||
*/
|
||||
if (!trx->stmt)
|
||||
{
|
||||
DBUG_PRINT("trans",("starting transaction stmt"));
|
||||
error=txn_begin(db_env, (DB_TXN*) thd->transaction.all.bdb_tid,
|
||||
(DB_TXN**) &thd->transaction.stmt.bdb_tid,
|
||||
0);
|
||||
error=txn_begin(db_env, trx->all, &trx->stmt, 0);
|
||||
trans_register_ha(thd, FALSE, &berkeley_hton);
|
||||
}
|
||||
transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid;
|
||||
transaction= trx->stmt;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
@ -2234,6 +2276,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
uint i;
|
||||
DB_BTREE_STAT *stat=0;
|
||||
DB_TXN_STAT *txn_stat_ptr= 0;
|
||||
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
|
||||
|
||||
/*
|
||||
Original bdb documentation says:
|
||||
@ -2249,11 +2292,8 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
DB_TXN_ACTIVE *atxn_stmt= 0, *atxn_all= 0;
|
||||
|
||||
DB_TXN *txn_all= (DB_TXN*) thd->transaction.all.bdb_tid;
|
||||
u_int32_t all_id= txn_all->id(txn_all);
|
||||
|
||||
DB_TXN *txn_stmt= (DB_TXN*) thd->transaction.stmt.bdb_tid;
|
||||
u_int32_t stmt_id= txn_stmt->id(txn_stmt);
|
||||
u_int32_t all_id= trx->all->id(trx->all);
|
||||
u_int32_t stmt_id= trx->stmt->id(trx->stmt);
|
||||
|
||||
DB_TXN_ACTIVE *cur= txn_stat_ptr->st_txnarray;
|
||||
DB_TXN_ACTIVE *end= cur + txn_stat_ptr->st_nactive;
|
||||
|
@ -168,9 +168,7 @@ extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir;
|
||||
extern long berkeley_lock_scan_time;
|
||||
extern TYPELIB berkeley_lock_typelib;
|
||||
|
||||
bool berkeley_init(void);
|
||||
handlerton *berkeley_init(void);
|
||||
bool berkeley_end(void);
|
||||
bool berkeley_flush_logs(void);
|
||||
int berkeley_commit(THD *thd, void *trans);
|
||||
int berkeley_rollback(THD *thd, void *trans);
|
||||
int berkeley_show_logs(Protocol *protocol);
|
||||
|
307
sql/ha_innodb.cc
307
sql/ha_innodb.cc
@ -14,14 +14,12 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* This file defines the InnoDB handler: the interface between MySQL and
|
||||
InnoDB
|
||||
/* This file defines the InnoDB handler: the interface between MySQL and InnoDB
|
||||
NOTE: You can only use noninlined InnoDB functions in this file, because we
|
||||
have disables the InnoDB inlining in this file. */
|
||||
|
||||
/* TODO list for the InnoDB handler in 4.1:
|
||||
- Remove the flag innodb_active_trans from thd and replace it with a
|
||||
function call innodb_active_trans(thd), which looks at the InnoDB
|
||||
/* TODO list for the InnoDB handler in 5.0:
|
||||
- Remove the flag trx->active_trans and look at the InnoDB
|
||||
trx struct state field
|
||||
- Find out what kind of problems the OS X case-insensitivity causes to
|
||||
table and database names; should we 'normalize' the names like we do
|
||||
@ -141,8 +139,6 @@ ulong innobase_active_counter = 0;
|
||||
|
||||
char* innobase_home = NULL;
|
||||
|
||||
char innodb_dummy_stmt_trx_handle = 'D';
|
||||
|
||||
static HASH innobase_open_tables;
|
||||
|
||||
#ifdef __NETWARE__ /* some special cleanup for NetWare */
|
||||
@ -153,6 +149,26 @@ static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
|
||||
my_bool not_used __attribute__((unused)));
|
||||
static INNOBASE_SHARE *get_share(const char *table_name);
|
||||
static void free_share(INNOBASE_SHARE *share);
|
||||
static int innobase_close_connection(THD* thd);
|
||||
static int innobase_commit(THD* thd, bool all);
|
||||
static int innobase_rollback(THD* thd, bool all);
|
||||
static int innobase_rollback_to_savepoint(THD* thd, void *savepoint);
|
||||
static int innobase_savepoint(THD* thd, void *savepoint);
|
||||
|
||||
static handlerton innobase_hton = {
|
||||
0, /* slot */
|
||||
sizeof(trx_named_savept_t), /* savepoint size. TODO: use it */
|
||||
innobase_close_connection,
|
||||
innobase_savepoint,
|
||||
innobase_rollback_to_savepoint,
|
||||
NULL, /* savepoint_release */
|
||||
innobase_commit,
|
||||
innobase_rollback,
|
||||
innobase_xa_prepare, //makes flush_block_commit test to fail
|
||||
NULL, /* recover */
|
||||
NULL, /* commit_by_xid */
|
||||
NULL, /* rollback_by_xid */
|
||||
};
|
||||
|
||||
/*********************************************************************
|
||||
Commits a transaction in an InnoDB database. */
|
||||
@ -307,9 +323,11 @@ documentation, see handler.cc. */
|
||||
void
|
||||
innobase_release_temporary_latches(
|
||||
/*===============================*/
|
||||
void* innobase_tid)
|
||||
THD *thd)
|
||||
{
|
||||
innobase_release_stat_resources((trx_t*)innobase_tid);
|
||||
trx_t *trx= (trx_t*) thd->ha_data[innobase_hton.slot];
|
||||
if (trx)
|
||||
innobase_release_stat_resources(trx);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@ -633,25 +651,17 @@ check_trx_exists(
|
||||
|
||||
ut_ad(thd == current_thd);
|
||||
|
||||
trx = (trx_t*) thd->transaction.all.innobase_tid;
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton.slot];
|
||||
|
||||
if (trx == NULL) {
|
||||
DBUG_ASSERT(thd != NULL);
|
||||
trx = trx_allocate_for_mysql();
|
||||
|
||||
trx->mysql_thd = thd;
|
||||
trx->mysql_query_str = &((*thd).query);
|
||||
|
||||
thd->transaction.all.innobase_tid = trx;
|
||||
trx->mysql_query_str = &(thd->query);
|
||||
trx->active_trans = 0;
|
||||
|
||||
/* The execution of a single SQL statement is denoted by
|
||||
a 'transaction' handle which is a dummy pointer: InnoDB
|
||||
remembers internally where the latest SQL statement
|
||||
started, and if error handling requires rolling back the
|
||||
latest statement, InnoDB does a rollback to a savepoint. */
|
||||
|
||||
thd->transaction.stmt.innobase_tid =
|
||||
(void*)&innodb_dummy_stmt_trx_handle;
|
||||
thd->ha_data[innobase_hton.slot] = trx;
|
||||
} else {
|
||||
if (trx->magic_n != TRX_MAGIC_N) {
|
||||
mem_analyze_corruption((byte*)trx);
|
||||
@ -701,6 +711,12 @@ ha_innobase::update_thd(
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void register_trans(THD *thd)
|
||||
{
|
||||
trans_register_ha(thd, FALSE, &innobase_hton);
|
||||
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|
||||
trans_register_ha(thd, TRUE, &innobase_hton);
|
||||
}
|
||||
|
||||
/* BACKGROUND INFO: HOW THE MYSQL QUERY CACHE WORKS WITH INNODB
|
||||
------------------------------------------------------------
|
||||
@ -786,11 +802,7 @@ innobase_query_caching_of_table_permitted(
|
||||
return((my_bool)FALSE);
|
||||
}
|
||||
|
||||
trx = (trx_t*) thd->transaction.all.innobase_tid;
|
||||
|
||||
if (trx == NULL) {
|
||||
trx = check_trx_exists(thd);
|
||||
}
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
@ -837,7 +849,11 @@ innobase_query_caching_of_table_permitted(
|
||||
/* The call of row_search_.. will start a new transaction if it is
|
||||
not yet started */
|
||||
|
||||
thd->transaction.all.innodb_active_trans = 1;
|
||||
if (trx->active_trans == 0) {
|
||||
|
||||
register_trans(thd);
|
||||
trx->active_trans = 1;
|
||||
}
|
||||
|
||||
if (row_search_check_if_query_cache_permitted(trx, norm_name)) {
|
||||
|
||||
@ -945,7 +961,12 @@ ha_innobase::init_table_handle_for_HANDLER(void)
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active transaction */
|
||||
|
||||
current_thd->transaction.all.innodb_active_trans = 1;
|
||||
if (prebuilt->trx->active_trans == 0) {
|
||||
|
||||
register_trans(current_thd);
|
||||
|
||||
prebuilt->trx->active_trans = 1;
|
||||
}
|
||||
|
||||
/* We did the necessary inits in this function, no need to repeat them
|
||||
in row_search_for_mysql */
|
||||
@ -975,7 +996,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
|
||||
/*************************************************************************
|
||||
Opens an InnoDB database. */
|
||||
|
||||
bool
|
||||
handlerton *
|
||||
innobase_init(void)
|
||||
/*===============*/
|
||||
/* out: TRUE if error */
|
||||
@ -1050,7 +1071,7 @@ innobase_init(void)
|
||||
if (ret == FALSE) {
|
||||
sql_print_error(
|
||||
"InnoDB: syntax error in innodb_data_file_path");
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* -------------- Log files ---------------------------*/
|
||||
@ -1080,7 +1101,7 @@ innobase_init(void)
|
||||
"InnoDB: syntax error in innodb_log_group_home_dir\n"
|
||||
"InnoDB: or a wrong number of mirrored log groups\n");
|
||||
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------*/
|
||||
@ -1170,7 +1191,7 @@ innobase_init(void)
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
||||
DBUG_RETURN(1);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
(void) hash_init(&innobase_open_tables,system_charset_info, 32, 0, 0,
|
||||
@ -1193,7 +1214,7 @@ innobase_init(void)
|
||||
glob_mi.pos = trx_sys_mysql_master_log_pos;
|
||||
}
|
||||
*/
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(&innobase_hton);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -1317,7 +1338,12 @@ innobase_start_trx_and_assign_read_view(
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active transaction */
|
||||
|
||||
current_thd->transaction.all.innodb_active_trans = 1;
|
||||
if (trx->active_trans == 0) {
|
||||
|
||||
register_trans(current_thd);
|
||||
|
||||
trx->active_trans = 1;
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -1326,15 +1352,14 @@ innobase_start_trx_and_assign_read_view(
|
||||
Commits a transaction in an InnoDB database or marks an SQL statement
|
||||
ended. */
|
||||
|
||||
int
|
||||
static int
|
||||
innobase_commit(
|
||||
/*============*/
|
||||
/* out: 0 */
|
||||
THD* thd, /* in: MySQL thread handle of the user for whom
|
||||
the transaction should be committed */
|
||||
void* trx_handle)/* in: InnoDB trx handle or
|
||||
&innodb_dummy_stmt_trx_handle: the latter means
|
||||
that the current SQL statement ended */
|
||||
bool all) /* in: TRUE - commit transaction
|
||||
FALSE - the current SQL statement ended */
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
@ -1349,7 +1374,7 @@ innobase_commit(
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
/* The flag thd->transaction.all.innodb_active_trans is set to 1 in
|
||||
/* The flag trx->active_trans is set to 1 in
|
||||
|
||||
1. ::external_lock(),
|
||||
2. ::start_stmt(),
|
||||
@ -1363,23 +1388,22 @@ innobase_commit(
|
||||
For the time being, we play safe and do the cleanup though there should
|
||||
be nothing to clean up. */
|
||||
|
||||
if (thd->transaction.all.innodb_active_trans == 0
|
||||
if (trx->active_trans == 0
|
||||
&& trx->conc_state != TRX_NOT_STARTED) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: thd->transaction.all.innodb_active_trans == 0\n"
|
||||
"InnoDB: Error: trx->active_trans == 0\n"
|
||||
"InnoDB: but trx->conc_state != TRX_NOT_STARTED\n");
|
||||
}
|
||||
|
||||
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle
|
||||
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
|
||||
if (all || (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
|
||||
|
||||
/* We were instructed to commit the whole transaction, or
|
||||
this is an SQL statement end and autocommit is on */
|
||||
|
||||
innobase_commit_low(trx);
|
||||
|
||||
thd->transaction.all.innodb_active_trans = 0;
|
||||
trx->active_trans = 0;
|
||||
} else {
|
||||
/* We just mark the SQL statement ended and do not do a
|
||||
transaction commit */
|
||||
@ -1405,6 +1429,11 @@ innobase_commit(
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/*
|
||||
don't delete it - it may be re-enabled later
|
||||
as an optimization for the most common case InnoDB+binlog
|
||||
*/
|
||||
#if 0
|
||||
/*********************************************************************
|
||||
This is called when MySQL writes the binlog entry for the current
|
||||
transaction. Writes to the InnoDB tablespace info which tells where the
|
||||
@ -1442,6 +1471,39 @@ innobase_report_binlog_offset_and_commit(
|
||||
return(0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
This function stores the binlog offset and flushes logs. */
|
||||
|
||||
void
|
||||
innobase_store_binlog_offset_and_flush_log(
|
||||
/*=======================================*/
|
||||
char *binlog_name, /* in: binlog name */
|
||||
longlong offset) /* in: binlog offset */
|
||||
{
|
||||
mtr_t mtr;
|
||||
|
||||
assert(binlog_name != NULL);
|
||||
|
||||
/* Start a mini-transaction */
|
||||
mtr_start_noninline(&mtr);
|
||||
|
||||
/* Update the latest MySQL binlog name and offset info
|
||||
in trx sys header */
|
||||
|
||||
trx_sys_update_mysql_binlog_offset(
|
||||
binlog_name,
|
||||
offset,
|
||||
TRX_SYS_MYSQL_LOG_INFO, &mtr);
|
||||
|
||||
/* Commits the mini-transaction */
|
||||
mtr_commit(&mtr);
|
||||
|
||||
/* Syncronous flush of the log buffer to disk */
|
||||
log_buffer_flush_to_disk();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
This is called after MySQL has written the binlog entry for the current
|
||||
transaction. Flushes the InnoDB log files to disk if required. */
|
||||
@ -1450,20 +1512,23 @@ int
|
||||
innobase_commit_complete(
|
||||
/*=====================*/
|
||||
/* out: 0 */
|
||||
void* trx_handle) /* in: InnoDB trx handle */
|
||||
THD* thd) /* in: user thread */
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
trx = (trx_t*) thd->ha_data[innobase_hton.slot];
|
||||
|
||||
if (trx && trx->active_trans) {
|
||||
|
||||
trx->active_trans = 0;
|
||||
|
||||
if (srv_flush_log_at_trx_commit == 0) {
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
trx = (trx_t*)trx_handle;
|
||||
|
||||
ut_a(trx != NULL);
|
||||
|
||||
trx_commit_complete_for_mysql(trx);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -1471,15 +1536,14 @@ innobase_commit_complete(
|
||||
/*********************************************************************
|
||||
Rolls back a transaction or the latest SQL statement. */
|
||||
|
||||
int
|
||||
static int
|
||||
innobase_rollback(
|
||||
/*==============*/
|
||||
/* out: 0 or error number */
|
||||
THD* thd, /* in: handle to the MySQL thread of the user
|
||||
whose transaction should be rolled back */
|
||||
void* trx_handle)/* in: InnoDB trx handle or a dummy stmt handle;
|
||||
the latter means we roll back the latest SQL
|
||||
statement */
|
||||
bool all) /* in: TRUE - commit transaction
|
||||
FALSE - the current SQL statement ended */
|
||||
{
|
||||
int error = 0;
|
||||
trx_t* trx;
|
||||
@ -1503,11 +1567,10 @@ innobase_rollback(
|
||||
row_unlock_table_autoinc_for_mysql(trx);
|
||||
}
|
||||
|
||||
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle
|
||||
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
|
||||
if (all || (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
|
||||
|
||||
error = trx_rollback_for_mysql(trx);
|
||||
thd->transaction.all.innodb_active_trans = 0;
|
||||
trx->active_trans = 0;
|
||||
} else {
|
||||
error = trx_rollback_last_sql_stat_for_mysql(trx);
|
||||
}
|
||||
@ -1551,17 +1614,14 @@ innobase_rollback_trx(
|
||||
/*********************************************************************
|
||||
Rolls back a transaction to a savepoint. */
|
||||
|
||||
int
|
||||
static int
|
||||
innobase_rollback_to_savepoint(
|
||||
/*===========================*/
|
||||
/* out: 0 if success, HA_ERR_NO_SAVEPOINT if
|
||||
no savepoint with the given name */
|
||||
THD* thd, /* in: handle to the MySQL thread of the user
|
||||
whose transaction should be rolled back */
|
||||
char* savepoint_name, /* in: savepoint name */
|
||||
my_off_t* binlog_cache_pos)/* out: position which corresponds to the
|
||||
savepoint in the binlog cache of this
|
||||
transaction, not defined if error */
|
||||
void *savepoint) /* in: savepoint data */
|
||||
{
|
||||
ib_longlong mysql_binlog_cache_pos;
|
||||
int error = 0;
|
||||
@ -1577,27 +1637,22 @@ innobase_rollback_to_savepoint(
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
error = trx_rollback_to_savepoint_for_mysql(trx, savepoint_name,
|
||||
/* TODO: use provided savepoint data area to store savepoint data */
|
||||
char name[16]; sprintf(name, "s_%08lx", savepoint);
|
||||
error = trx_rollback_to_savepoint_for_mysql(trx, name,
|
||||
&mysql_binlog_cache_pos);
|
||||
*binlog_cache_pos = (my_off_t)mysql_binlog_cache_pos;
|
||||
|
||||
DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
Sets a transaction savepoint. */
|
||||
|
||||
int
|
||||
static int
|
||||
innobase_savepoint(
|
||||
/*===============*/
|
||||
/* out: always 0, that is, always succeeds */
|
||||
THD* thd, /* in: handle to the MySQL thread */
|
||||
char* savepoint_name, /* in: savepoint name */
|
||||
my_off_t binlog_cache_pos)/* in: offset up to which the current
|
||||
transaction has cached log entries to its
|
||||
binlog cache, not defined if no transaction
|
||||
active, or we are in the autocommit state, or
|
||||
binlogging is not switched on */
|
||||
void *savepoint) /* in: savepoint data */
|
||||
{
|
||||
int error = 0;
|
||||
trx_t* trx;
|
||||
@ -1618,14 +1673,12 @@ innobase_savepoint(
|
||||
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
/* Setting a savepoint starts a transaction inside InnoDB since
|
||||
it allocates resources for it (memory to store the savepoint name,
|
||||
for example) */
|
||||
/* cannot happen outside of transaction */
|
||||
DBUG_ASSERT(trx->active_trans);
|
||||
|
||||
thd->transaction.all.innodb_active_trans = 1;
|
||||
|
||||
error = trx_savepoint_for_mysql(trx, savepoint_name,
|
||||
(ib_longlong)binlog_cache_pos);
|
||||
/* TODO: use provided savepoint data area to store savepoint data */
|
||||
char name[16]; sprintf(name, "s_%08lx", savepoint);
|
||||
error = trx_savepoint_for_mysql(trx, name, (ib_longlong)0);
|
||||
|
||||
DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
|
||||
}
|
||||
@ -1633,25 +1686,14 @@ innobase_savepoint(
|
||||
/*********************************************************************
|
||||
Frees a possible InnoDB trx object associated with the current THD. */
|
||||
|
||||
int
|
||||
static int
|
||||
innobase_close_connection(
|
||||
/*======================*/
|
||||
/* out: 0 or error number */
|
||||
THD* thd) /* in: handle to the MySQL thread of the user
|
||||
whose transaction should be rolled back */
|
||||
whose resources should be free'd */
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
trx = (trx_t*)thd->transaction.all.innobase_tid;
|
||||
|
||||
if (NULL != trx) {
|
||||
innobase_rollback(thd, (void*)trx);
|
||||
|
||||
trx_free_for_mysql(trx);
|
||||
|
||||
thd->transaction.all.innobase_tid = NULL;
|
||||
}
|
||||
|
||||
trx_free_for_mysql((trx_t*)thd->ha_data[innobase_hton.slot]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -2447,19 +2489,19 @@ ha_innobase::write_row(
|
||||
DBUG_ENTER("ha_innobase::write_row");
|
||||
|
||||
if (prebuilt->trx !=
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid) {
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: the transaction object for the table handle is at\n"
|
||||
"InnoDB: %p, but for the current thread it is at %p\n",
|
||||
prebuilt->trx,
|
||||
current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
|
||||
ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
|
||||
fputs("\n"
|
||||
"InnoDB: Dump of 200 bytes around transaction.all: ",
|
||||
stderr);
|
||||
ut_print_buf(stderr,
|
||||
((byte*)(&(current_thd->transaction.all))) - 100, 200);
|
||||
((byte*)(&(current_thd->ha_data[innobase_hton.slot]))) - 100, 200);
|
||||
putc('\n', stderr);
|
||||
ut_error;
|
||||
}
|
||||
@ -2511,7 +2553,7 @@ ha_innobase::write_row(
|
||||
/* Altering to InnoDB format */
|
||||
innobase_commit(user_thd, prebuilt->trx);
|
||||
/* Note that this transaction is still active. */
|
||||
user_thd->transaction.all.innodb_active_trans = 1;
|
||||
prebuilt->trx->active_trans = 1;
|
||||
/* We will need an IX lock on the destination table. */
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
} else {
|
||||
@ -2526,7 +2568,7 @@ ha_innobase::write_row(
|
||||
locks, so they have to be acquired again. */
|
||||
innobase_commit(user_thd, prebuilt->trx);
|
||||
/* Note that this transaction is still active. */
|
||||
user_thd->transaction.all.innodb_active_trans = 1;
|
||||
prebuilt->trx->active_trans = 1;
|
||||
/* Re-acquire the table lock on the source table. */
|
||||
row_lock_table_for_mysql(prebuilt, src_table, mode);
|
||||
/* We will need an IX lock on the destination table. */
|
||||
@ -2814,7 +2856,7 @@ ha_innobase::update_row(
|
||||
DBUG_ENTER("ha_innobase::update_row");
|
||||
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
|
||||
table->timestamp_field->set_time();
|
||||
@ -2875,7 +2917,7 @@ ha_innobase::delete_row(
|
||||
DBUG_ENTER("ha_innobase::delete_row");
|
||||
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
if (last_query_id != user_thd->query_id) {
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
@ -3085,7 +3127,7 @@ ha_innobase::index_read(
|
||||
DBUG_ENTER("index_read");
|
||||
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
statistic_increment(current_thd->status_var.ha_read_key_count,
|
||||
&LOCK_status);
|
||||
@ -3200,7 +3242,7 @@ ha_innobase::change_active_index(
|
||||
|
||||
ut_ad(user_thd == current_thd);
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
active_index = keynr;
|
||||
|
||||
@ -3288,7 +3330,7 @@ ha_innobase::general_fetch(
|
||||
DBUG_ENTER("general_fetch");
|
||||
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
innodb_srv_conc_enter_innodb(prebuilt->trx);
|
||||
|
||||
@ -3514,7 +3556,7 @@ ha_innobase::rnd_pos(
|
||||
&LOCK_status);
|
||||
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
if (prebuilt->clust_index_was_generated) {
|
||||
/* No primary key was defined for the table and we
|
||||
@ -3563,7 +3605,7 @@ ha_innobase::position(
|
||||
uint len;
|
||||
|
||||
ut_ad(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
if (prebuilt->clust_index_was_generated) {
|
||||
/* No primary key was defined for the table and we
|
||||
@ -4053,7 +4095,7 @@ ha_innobase::discard_or_import_tablespace(
|
||||
|
||||
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
dict_table = prebuilt->table;
|
||||
trx = prebuilt->trx;
|
||||
@ -4719,7 +4761,7 @@ ha_innobase::check(
|
||||
|
||||
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
|
||||
if (prebuilt->mysql_template == NULL) {
|
||||
/* Build the template; we will use a dummy template
|
||||
@ -5156,7 +5198,11 @@ ha_innobase::start_stmt(
|
||||
}
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active transaction */
|
||||
thd->transaction.all.innodb_active_trans = 1;
|
||||
if (trx->active_trans == 0) {
|
||||
|
||||
register_trans(thd);
|
||||
trx->active_trans = 1;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -5237,7 +5283,11 @@ ha_innobase::external_lock(
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active
|
||||
transaction */
|
||||
thd->transaction.all.innodb_active_trans = 1;
|
||||
if (trx->active_trans == 0) {
|
||||
|
||||
register_trans(thd);
|
||||
trx->active_trans = 1;
|
||||
}
|
||||
|
||||
trx->n_mysql_tables_in_use++;
|
||||
prebuilt->mysql_has_locked = TRUE;
|
||||
@ -5308,8 +5358,8 @@ ha_innobase::external_lock(
|
||||
innobase_release_stat_resources(trx);
|
||||
|
||||
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
|
||||
if (thd->transaction.all.innodb_active_trans != 0) {
|
||||
innobase_commit(thd, trx);
|
||||
if (trx->active_trans != 0) {
|
||||
innobase_commit(thd, TRUE);
|
||||
}
|
||||
} else {
|
||||
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
|
||||
@ -5573,7 +5623,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
|
||||
|
||||
ut_a(prebuilt);
|
||||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->transaction.all.innobase_tid);
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
ut_a(prebuilt->table);
|
||||
|
||||
/* In case MySQL calls this in the middle of a SELECT query, release
|
||||
@ -5683,37 +5733,6 @@ ha_innobase::get_auto_increment()
|
||||
return((ulonglong) nr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
This function stores the binlog offset and flushes logs. */
|
||||
|
||||
void
|
||||
innobase_store_binlog_offset_and_flush_log(
|
||||
/*=======================================*/
|
||||
char *binlog_name, /* in: binlog name */
|
||||
longlong offset) /* in: binlog offset */
|
||||
{
|
||||
mtr_t mtr;
|
||||
|
||||
assert(binlog_name != NULL);
|
||||
|
||||
/* Start a mini-transaction */
|
||||
mtr_start_noninline(&mtr);
|
||||
|
||||
/* Update the latest MySQL binlog name and offset info
|
||||
in trx sys header */
|
||||
|
||||
trx_sys_update_mysql_binlog_offset(
|
||||
binlog_name,
|
||||
offset,
|
||||
TRX_SYS_MYSQL_LOG_INFO, &mtr);
|
||||
|
||||
/* Commits the mini-transaction */
|
||||
mtr_commit(&mtr);
|
||||
|
||||
/* Syncronous flush of the log buffer to disk */
|
||||
log_buffer_flush_to_disk();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ha_innobase::cmp_ref(
|
||||
@ -5896,9 +5915,7 @@ int innobase_xa_prepare(
|
||||
|
||||
trx = check_trx_exists(thd);
|
||||
|
||||
/* TODO: Get X/Open XA Transaction Identification from MySQL*/
|
||||
memset(&trx->xid, 0, sizeof(trx->xid));
|
||||
trx->xid.formatID = -1;
|
||||
trx->xid=thd->transaction.xid;
|
||||
|
||||
/* Release a possible FIFO ticket and search latch. Since we will
|
||||
reserve the kernel mutex, we have to release the search system latch
|
||||
@ -5909,7 +5926,7 @@ int innobase_xa_prepare(
|
||||
if (trx->active_trans == 0 && trx->conc_state != TRX_NOT_STARTED) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: thd->transaction.all.innodb_active_trans == 0\n"
|
||||
"InnoDB: Error: trx->active_trans == 0\n"
|
||||
"InnoDB: but trx->conc_state != TRX_NOT_STARTED\n");
|
||||
}
|
||||
|
||||
|
@ -216,36 +216,32 @@ extern ulong srv_max_purge_lag;
|
||||
|
||||
extern TYPELIB innobase_lock_typelib;
|
||||
|
||||
bool innobase_init(void);
|
||||
handlerton *innobase_init(void);
|
||||
bool innobase_end(void);
|
||||
bool innobase_flush_logs(void);
|
||||
uint innobase_get_free_space(void);
|
||||
|
||||
int innobase_commit(THD *thd, void* trx_handle);
|
||||
/*
|
||||
don't delete it - it may be re-enabled later
|
||||
as an optimization for the most common case InnoDB+binlog
|
||||
*/
|
||||
#if 0
|
||||
int innobase_report_binlog_offset_and_commit(
|
||||
THD* thd,
|
||||
void* trx_handle,
|
||||
char* log_file_name,
|
||||
my_off_t end_offset);
|
||||
int innobase_commit_complete(
|
||||
void* trx_handle);
|
||||
int innobase_rollback(THD *thd, void* trx_handle);
|
||||
int innobase_rollback_to_savepoint(
|
||||
THD* thd,
|
||||
char* savepoint_name,
|
||||
my_off_t* binlog_cache_pos);
|
||||
int innobase_savepoint(
|
||||
THD* thd,
|
||||
char* savepoint_name,
|
||||
my_off_t binlog_cache_pos);
|
||||
int innobase_close_connection(THD *thd);
|
||||
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
|
||||
int innobase_commit_complete(void* trx_handle);
|
||||
#endif
|
||||
|
||||
int innobase_drop_database(char *path);
|
||||
bool innodb_show_status(THD* thd);
|
||||
void innodb_export_status(void);
|
||||
|
||||
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
|
||||
uint full_name_len);
|
||||
void innobase_release_temporary_latches(void* innobase_tid);
|
||||
void innobase_release_temporary_latches(THD *thd);
|
||||
|
||||
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
|
||||
|
||||
|
878
sql/handler.cc
878
sql/handler.cc
File diff suppressed because it is too large
Load Diff
153
sql/handler.h
153
sql/handler.h
@ -92,6 +92,11 @@
|
||||
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
|
||||
#define HA_KEY_SWITCH_ALL_SAVE 3
|
||||
|
||||
/*
|
||||
Note: the following includes binlog and closing 0.
|
||||
so: innodb+bdb+ndb+binlog+0
|
||||
*/
|
||||
#define MAX_HA 5
|
||||
|
||||
/*
|
||||
Bits in index_ddl_flags(KEY *wanted_index)
|
||||
@ -190,16 +195,12 @@ 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 struct st_thd_trans {
|
||||
void *bdb_tid;
|
||||
void *innobase_tid;
|
||||
bool innodb_active_trans;
|
||||
void *ndb_tid;
|
||||
} THD_TRANS;
|
||||
typedef ulong my_xid;
|
||||
#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))
|
||||
#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))
|
||||
|
||||
#ifndef XIDDATASIZE /* no xa.h included */
|
||||
|
||||
/* XXX - may be we should disable xa completely in this case ? */
|
||||
#define XIDDATASIZE 128
|
||||
#define MAXGTRIDSIZE 64
|
||||
#define MAXBQUALSIZE 64
|
||||
@ -208,17 +209,49 @@ struct xid_t {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
long bqual_length;
|
||||
char data[XIDDATASIZE];
|
||||
};
|
||||
char data[XIDDATASIZE]; // not \0-terminated !
|
||||
|
||||
bool eq(LEX_STRING *l) { return eq(l->length, 0, l->str); }
|
||||
bool eq(long g, long b, const char *d)
|
||||
{ return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }
|
||||
void set(LEX_STRING *l) { set(l->length, 0, l->str); }
|
||||
void set(ulong l)
|
||||
{
|
||||
set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
|
||||
*(ulong*)(data+MYSQL_XID_PREFIX_LEN)=server_id;
|
||||
*(ulong*)(data+MYSQL_XID_OFFSET)=l;
|
||||
gtrid_length=MYSQL_XID_GTRID_LEN;
|
||||
}
|
||||
void set(long g, long b, const char *d)
|
||||
{
|
||||
formatID=1;
|
||||
gtrid_length= g;
|
||||
bqual_length= b;
|
||||
memcpy(data, d, g+b);
|
||||
}
|
||||
bool is_null() { return formatID == -1; }
|
||||
void null() { formatID= -1; }
|
||||
my_xid quick_get_my_xid()
|
||||
{
|
||||
return *(ulong*)(data+MYSQL_XID_OFFSET);
|
||||
}
|
||||
my_xid get_my_xid()
|
||||
{
|
||||
return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
|
||||
*(ulong*)(data+MYSQL_XID_PREFIX_LEN) == server_id &&
|
||||
!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
|
||||
quick_get_my_xid() : 0;
|
||||
}
|
||||
};
|
||||
typedef struct xid_t XID;
|
||||
|
||||
|
||||
#endif
|
||||
/* for recover() handlerton call */
|
||||
#define MIN_XID_LIST_SIZE 128
|
||||
#define MAX_XID_LIST_SIZE (1024*128)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte slot;
|
||||
uint slot;
|
||||
uint savepoint_offset;
|
||||
int (*close_connection)(THD *thd);
|
||||
int (*savepoint_set)(THD *thd, void *sv);
|
||||
@ -232,6 +265,13 @@ typedef struct
|
||||
int (*rollback_by_xid)(XID *xid);
|
||||
} handlerton;
|
||||
|
||||
typedef struct st_thd_trans
|
||||
{
|
||||
uint nht;
|
||||
bool no_2pc;
|
||||
handlerton *ht[MAX_HA];
|
||||
} THD_TRANS;
|
||||
|
||||
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
|
||||
ISO_REPEATABLE_READ, ISO_SERIALIZABLE};
|
||||
|
||||
@ -266,6 +306,9 @@ typedef struct st_table TABLE;
|
||||
struct st_foreign_key_info;
|
||||
typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
|
||||
|
||||
typedef struct st_savepoint SAVEPOINT;
|
||||
extern ulong savepoint_alloc_size;
|
||||
|
||||
typedef struct st_ha_check_opt
|
||||
{
|
||||
ulong sort_buffer_size;
|
||||
@ -584,58 +627,76 @@ public:
|
||||
extern struct show_table_type_st sys_table_types[];
|
||||
extern const char *ha_row_type[];
|
||||
extern TYPELIB tx_isolation_typelib;
|
||||
extern handlerton *handlertons[MAX_HA];
|
||||
extern ulong total_ha, total_ha_2pc;
|
||||
|
||||
/* Wrapper functions */
|
||||
#define ha_commit_stmt(thd) (ha_commit_trans((thd), &((thd)->transaction.stmt)))
|
||||
#define ha_rollback_stmt(thd) (ha_rollback_trans((thd), &((thd)->transaction.stmt)))
|
||||
#define ha_commit(thd) (ha_commit_trans((thd), &((thd)->transaction.all)))
|
||||
#define ha_rollback(thd) (ha_rollback_trans((thd), &((thd)->transaction.all)))
|
||||
#define ha_commit_stmt(thd) (ha_commit_trans((thd), FALSE))
|
||||
#define ha_rollback_stmt(thd) (ha_rollback_trans((thd), FALSE))
|
||||
#define ha_commit(thd) (ha_commit_trans((thd), TRUE))
|
||||
#define ha_rollback(thd) (ha_rollback_trans((thd), TRUE))
|
||||
|
||||
#define ha_supports_generate(T) (T != DB_TYPE_INNODB && \
|
||||
T != DB_TYPE_BERKELEY_DB && \
|
||||
T != DB_TYPE_NDBCLUSTER)
|
||||
|
||||
/* query cache */
|
||||
bool ha_caching_allowed(THD* thd, char* table_key,
|
||||
uint key_length, uint8 cache_type);
|
||||
|
||||
/* lookups */
|
||||
enum db_type ha_resolve_by_name(const char *name, uint namelen);
|
||||
const char *ha_get_storage_engine(enum db_type db_type);
|
||||
handler *get_new_handler(TABLE *table, enum db_type db_type);
|
||||
my_off_t ha_get_ptr(byte *ptr, uint pack_length);
|
||||
void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos);
|
||||
int ha_init(void);
|
||||
int ha_panic(enum ha_panic_function flag);
|
||||
void ha_close_connection(THD* thd);
|
||||
enum db_type ha_checktype(enum db_type database_type);
|
||||
|
||||
/* basic stuff */
|
||||
int ha_init(void);
|
||||
TYPELIB *ha_known_exts(void);
|
||||
int ha_panic(enum ha_panic_function flag);
|
||||
int ha_update_statistics();
|
||||
void ha_close_connection(THD* thd);
|
||||
bool ha_flush_logs(void);
|
||||
void ha_drop_database(char* path);
|
||||
int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
|
||||
bool update_create_info);
|
||||
int ha_delete_table(enum db_type db_type, const char *path);
|
||||
|
||||
/* discovery */
|
||||
int ha_create_table_from_engine(THD* thd, const char *db, const char *name,
|
||||
bool create_if_found);
|
||||
int ha_delete_table(enum db_type db_type, const char *path);
|
||||
void ha_drop_database(char* path);
|
||||
int ha_discover(THD* thd, const char* dbname, const char* name,
|
||||
const void** frmblob, uint* frmlen);
|
||||
int ha_find_files(THD *thd,const char *db,const char *path,
|
||||
const char *wild, bool dir,List<char>* files);
|
||||
int ha_table_exists(THD* thd, const char* db, const char* name);
|
||||
|
||||
/* key cache */
|
||||
int ha_init_key_cache(const char *name, KEY_CACHE *key_cache);
|
||||
int ha_resize_key_cache(KEY_CACHE *key_cache);
|
||||
int ha_change_key_cache_param(KEY_CACHE *key_cache);
|
||||
int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache);
|
||||
int ha_end_key_cache(KEY_CACHE *key_cache);
|
||||
int ha_start_stmt(THD *thd);
|
||||
int ha_report_binlog_offset_and_commit(THD *thd, char *log_file_name,
|
||||
my_off_t end_offset);
|
||||
int ha_commit_complete(THD *thd);
|
||||
|
||||
/* weird stuff */
|
||||
int ha_release_temporary_latches(THD *thd);
|
||||
int ha_update_statistics();
|
||||
int ha_commit_trans(THD *thd, THD_TRANS *trans);
|
||||
int ha_rollback_trans(THD *thd, THD_TRANS *trans);
|
||||
int ha_rollback_to_savepoint(THD *thd, char *savepoint_name);
|
||||
int ha_savepoint(THD *thd, char *savepoint_name);
|
||||
int ha_autocommit_or_rollback(THD *thd, int error);
|
||||
void ha_set_spin_retries(uint retries);
|
||||
bool ha_flush_logs(void);
|
||||
int ha_enable_transaction(THD *thd, bool on);
|
||||
int ha_change_key_cache(KEY_CACHE *old_key_cache,
|
||||
KEY_CACHE *new_key_cache);
|
||||
int ha_discover(THD* thd, const char* dbname, const char* name,
|
||||
const void** frmblob, uint* frmlen);
|
||||
int ha_find_files(THD *thd,const char *db,const char *path,
|
||||
const char *wild, bool dir,List<char>* files);
|
||||
int ha_table_exists(THD* thd, const char* db, const char* name);
|
||||
TYPELIB *ha_known_exts(void);
|
||||
|
||||
/* transactions: interface to handlerton functions */
|
||||
int ha_start_consistent_snapshot(THD *thd);
|
||||
int ha_commit_or_rollback_by_xid(LEX_STRING *ident, bool commit);
|
||||
int ha_commit_one_phase(THD *thd, bool all);
|
||||
int ha_rollback_trans(THD *thd, bool all);
|
||||
int ha_prepare(THD *thd);
|
||||
int ha_recover(HASH *commit_list);
|
||||
|
||||
/* transactions: these functions never call handlerton functions directly */
|
||||
int ha_commit_trans(THD *thd, bool all);
|
||||
int ha_autocommit_or_rollback(THD *thd, int error);
|
||||
int ha_enable_transaction(THD *thd, bool on);
|
||||
void trans_register_ha(THD *thd, bool all, handlerton *ht);
|
||||
|
||||
/* savepoints */
|
||||
int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv);
|
||||
int ha_savepoint(THD *thd, SAVEPOINT *sv);
|
||||
int ha_release_savepoint(THD *thd, SAVEPOINT *sv);
|
||||
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
#include "lex_symbol.h"
|
||||
|
||||
/* We don't want to include sql_yacc.h into gen_lex_hash */
|
||||
SYM_GROUP sym_group_common= {"", ""};
|
||||
SYM_GROUP sym_group_geom= {"Spatial extentions", "HAVE_SPATIAL"};
|
||||
SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
|
||||
|
||||
/* We don't want to include sql_yacc.h into gen_lex_hash */
|
||||
#ifdef NO_YACC_SYMBOLS
|
||||
#define SYM_OR_NULL(A) 0
|
||||
#else
|
||||
@ -311,6 +311,7 @@ static SYMBOL symbols[] = {
|
||||
{ "MERGE", SYM(MERGE_SYM)},
|
||||
{ "MICROSECOND", SYM(MICROSECOND_SYM)},
|
||||
{ "MIDDLEINT", SYM(MEDIUMINT)}, /* For powerbuilder */
|
||||
{ "MIGRATE", SYM(MIGRATE_SYM)},
|
||||
{ "MINUTE", SYM(MINUTE_SYM)},
|
||||
{ "MINUTE_MICROSECOND", SYM(MINUTE_MICROSECOND_SYM)},
|
||||
{ "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM)},
|
||||
@ -342,6 +343,7 @@ static SYMBOL symbols[] = {
|
||||
{ "OFFSET", SYM(OFFSET_SYM)},
|
||||
{ "OLD_PASSWORD", SYM(OLD_PASSWORD)},
|
||||
{ "ON", SYM(ON)},
|
||||
{ "ONE", SYM(ONE_SYM)},
|
||||
{ "ONE_SHOT", SYM(ONE_SHOT_SYM)},
|
||||
{ "OPEN", SYM(OPEN_SYM)},
|
||||
{ "OPTIMIZE", SYM(OPTIMIZE)},
|
||||
@ -355,6 +357,7 @@ static SYMBOL symbols[] = {
|
||||
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
|
||||
{ "PARTIAL", SYM(PARTIAL)},
|
||||
{ "PASSWORD", SYM(PASSWORD)},
|
||||
{ "PHASE", SYM(PHASE_SYM)},
|
||||
{ "POINT", SYM(POINT_SYM)},
|
||||
{ "POLYGON", SYM(POLYGON)},
|
||||
{ "PRECISION", SYM(PRECISION)},
|
||||
@ -376,6 +379,7 @@ static SYMBOL symbols[] = {
|
||||
{ "READ", SYM(READ_SYM)},
|
||||
{ "READS", SYM(READS_SYM)},
|
||||
{ "REAL", SYM(REAL)},
|
||||
{ "RECOVER", SYM(RECOVER_SYM)},
|
||||
{ "REFERENCES", SYM(REFERENCES)},
|
||||
{ "REGEXP", SYM(REGEXP)},
|
||||
{ "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM)},
|
||||
@ -392,6 +396,7 @@ static SYMBOL symbols[] = {
|
||||
{ "RESET", SYM(RESET_SYM)},
|
||||
{ "RESTORE", SYM(RESTORE_SYM)},
|
||||
{ "RESTRICT", SYM(RESTRICT)},
|
||||
{ "RESUME", SYM(RESUME_SYM)},
|
||||
{ "RETURN", SYM(RETURN_SYM)},
|
||||
{ "RETURNS", SYM(RETURNS_SYM)},
|
||||
{ "REVOKE", SYM(REVOKE)},
|
||||
@ -460,6 +465,7 @@ static SYMBOL symbols[] = {
|
||||
{ "STRIPED", SYM(RAID_STRIPED_SYM)},
|
||||
{ "SUBJECT", SYM(SUBJECT_SYM)},
|
||||
{ "SUPER", SYM(SUPER_SYM)},
|
||||
{ "SUSPEND", SYM(SUSPEND_SYM)},
|
||||
{ "TABLE", SYM(TABLE_SYM)},
|
||||
{ "TABLES", SYM(TABLES)},
|
||||
{ "TABLESPACE", SYM(TABLESPACE)},
|
||||
@ -521,6 +527,7 @@ static SYMBOL symbols[] = {
|
||||
{ "WRITE", SYM(WRITE_SYM)},
|
||||
{ "X509", SYM(X509_SYM)},
|
||||
{ "XOR", SYM(XOR)},
|
||||
{ "XA", SYM(XA_SYM)},
|
||||
{ "YEAR", SYM(YEAR_SYM)},
|
||||
{ "YEAR_MONTH", SYM(YEAR_MONTH_SYM)},
|
||||
{ "ZEROFILL", SYM(ZEROFILL)},
|
||||
|
1170
sql/log.cc
1170
sql/log.cc
File diff suppressed because it is too large
Load Diff
103
sql/log_event.cc
103
sql/log_event.cc
@ -269,9 +269,10 @@ const char* Log_event::get_type_str()
|
||||
case DELETE_FILE_EVENT: return "Delete_file";
|
||||
case EXEC_LOAD_EVENT: return "Exec_load";
|
||||
case RAND_EVENT: return "RAND";
|
||||
case XID_EVENT: return "Xid";
|
||||
case USER_VAR_EVENT: return "User var";
|
||||
case FORMAT_DESCRIPTION_EVENT: return "Format_desc";
|
||||
default: return "Unknown"; /* impossible */
|
||||
default: return "Unknown"; /* impossible */
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,6 +287,7 @@ Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
|
||||
{
|
||||
server_id= thd->server_id;
|
||||
when= thd->start_time;
|
||||
cache_stmt= using_trans;
|
||||
cache_stmt= (using_trans &&
|
||||
(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)));
|
||||
}
|
||||
@ -646,11 +648,9 @@ end:
|
||||
#ifndef MYSQL_CLIENT
|
||||
#define UNLOCK_MUTEX if (log_lock) pthread_mutex_unlock(log_lock);
|
||||
#define LOCK_MUTEX if (log_lock) pthread_mutex_lock(log_lock);
|
||||
#define max_allowed_packet current_thd->variables.max_allowed_packet
|
||||
#else
|
||||
#define UNLOCK_MUTEX
|
||||
#define LOCK_MUTEX
|
||||
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -667,7 +667,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file,
|
||||
#else
|
||||
Log_event* Log_event::read_log_event(IO_CACHE* file,
|
||||
const Format_description_log_event *description_event)
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
DBUG_ASSERT(description_event);
|
||||
char head[LOG_EVENT_MINIMAL_HEADER_LEN];
|
||||
@ -675,8 +675,8 @@ Log_event* Log_event::read_log_event(IO_CACHE* file,
|
||||
First we only want to read at most LOG_EVENT_MINIMAL_HEADER_LEN, just to
|
||||
check the event for sanity and to know its length; no need to really parse
|
||||
it. We say "at most" because this could be a 3.23 master, which has header
|
||||
of 13 bytes, whereas LOG_EVENT_MINIMAL_HEADER_LEN is 19 bytes (it's "minimal"
|
||||
over the set {MySQL >=4.0}).
|
||||
of 13 bytes, whereas LOG_EVENT_MINIMAL_HEADER_LEN is 19 bytes (it's
|
||||
"minimal" over the set {MySQL >=4.0}).
|
||||
*/
|
||||
uint header_size= min(description_event->common_header_len,
|
||||
LOG_EVENT_MINIMAL_HEADER_LEN);
|
||||
@ -700,6 +700,10 @@ failed my_b_read"));
|
||||
char *buf= 0;
|
||||
const char *error= 0;
|
||||
Log_event *res= 0;
|
||||
#ifndef max_allowed_packet
|
||||
THD *thd=current_thd;
|
||||
uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~0;
|
||||
#endif
|
||||
|
||||
if (data_len > max_allowed_packet)
|
||||
{
|
||||
@ -726,8 +730,7 @@ failed my_b_read"));
|
||||
error = "read error";
|
||||
goto err;
|
||||
}
|
||||
if ((res= read_log_event(buf, data_len, &error,
|
||||
description_event)))
|
||||
if ((res= read_log_event(buf, data_len, &error, description_event)))
|
||||
res->register_temp_buf(buf);
|
||||
|
||||
err:
|
||||
@ -772,7 +775,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
|
||||
*error="Sanity check failed"; // Needed to free buffer
|
||||
DBUG_RETURN(NULL); // general sanity check - will fail on a partial read
|
||||
}
|
||||
|
||||
|
||||
switch(buf[EVENT_TYPE_OFFSET]) {
|
||||
case QUERY_EVENT:
|
||||
ev = new Query_log_event(buf, event_len, description_event);
|
||||
@ -806,14 +809,15 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
|
||||
case START_EVENT_V3: /* this is sent only by MySQL <=4.x */
|
||||
ev = new Start_log_event_v3(buf, description_event);
|
||||
break;
|
||||
#ifdef HAVE_REPLICATION
|
||||
case STOP_EVENT:
|
||||
ev = new Stop_log_event(buf, description_event);
|
||||
break;
|
||||
#endif /* HAVE_REPLICATION */
|
||||
case INTVAR_EVENT:
|
||||
ev = new Intvar_log_event(buf, description_event);
|
||||
break;
|
||||
case XID_EVENT:
|
||||
ev = new Xid_log_event(buf, description_event);
|
||||
break;
|
||||
case RAND_EVENT:
|
||||
ev = new Rand_log_event(buf, description_event);
|
||||
break;
|
||||
@ -1067,8 +1071,8 @@ bool Query_log_event::write(IO_CACHE* file)
|
||||
|
||||
return (write_header(file, event_length) ||
|
||||
my_b_safe_write(file, (byte*) buf, (uint) (start-buf)) ||
|
||||
my_b_safe_write(file, (db) ? (byte*) db : (byte*)"", db_len + 1) ||
|
||||
my_b_safe_write(file, (byte*) query, q_len)) ? 1 : 0;
|
||||
my_b_safe_write(file, (db) ? (byte*) db : (byte*)"", db_len + 1) ||
|
||||
my_b_safe_write(file, (byte*) query, q_len)) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1080,7 +1084,7 @@ bool Query_log_event::write(IO_CACHE* file)
|
||||
Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
||||
ulong query_length, bool using_trans,
|
||||
bool suppress_use)
|
||||
:Log_event(thd_arg,
|
||||
:Log_event(thd_arg,
|
||||
((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0)
|
||||
| (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)),
|
||||
using_trans),
|
||||
@ -1392,7 +1396,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
thd->query_length= q_len;
|
||||
thd->query = (char*)query;
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id = query_id++;
|
||||
thd->query_id = next_query_id();
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
thd->variables.pseudo_thread_id= thread_id; // for temp tables
|
||||
mysql_log.write(thd,COM_QUERY,"%s",thd->query);
|
||||
@ -1762,8 +1766,7 @@ binary log.");
|
||||
*/
|
||||
|
||||
Format_description_log_event::
|
||||
Format_description_log_event(uint8 binlog_ver,
|
||||
const char* server_ver)
|
||||
Format_description_log_event(uint8 binlog_ver, const char* server_ver)
|
||||
:Start_log_event_v3()
|
||||
{
|
||||
created= when;
|
||||
@ -1775,7 +1778,7 @@ Format_description_log_event(uint8 binlog_ver,
|
||||
number_of_event_types= LOG_EVENT_TYPES;
|
||||
/* we'll catch my_malloc() error in is_valid() */
|
||||
post_header_len=(uint8*) my_malloc(number_of_event_types*sizeof(uint8),
|
||||
MYF(0));
|
||||
MYF(MY_ZEROFILL));
|
||||
/*
|
||||
This long list of assignments is not beautiful, but I see no way to
|
||||
make it nicer, as the right members are #defines, not array members, so
|
||||
@ -1785,18 +1788,13 @@ Format_description_log_event(uint8 binlog_ver,
|
||||
{
|
||||
post_header_len[START_EVENT_V3-1]= START_V3_HEADER_LEN;
|
||||
post_header_len[QUERY_EVENT-1]= QUERY_HEADER_LEN;
|
||||
post_header_len[STOP_EVENT-1]= 0;
|
||||
post_header_len[ROTATE_EVENT-1]= ROTATE_HEADER_LEN;
|
||||
post_header_len[INTVAR_EVENT-1]= 0;
|
||||
post_header_len[LOAD_EVENT-1]= LOAD_HEADER_LEN;
|
||||
post_header_len[SLAVE_EVENT-1]= 0;
|
||||
post_header_len[CREATE_FILE_EVENT-1]= CREATE_FILE_HEADER_LEN;
|
||||
post_header_len[APPEND_BLOCK_EVENT-1]= APPEND_BLOCK_HEADER_LEN;
|
||||
post_header_len[EXEC_LOAD_EVENT-1]= EXEC_LOAD_HEADER_LEN;
|
||||
post_header_len[DELETE_FILE_EVENT-1]= DELETE_FILE_HEADER_LEN;
|
||||
post_header_len[NEW_LOAD_EVENT-1]= post_header_len[LOAD_EVENT-1];
|
||||
post_header_len[RAND_EVENT-1]= 0;
|
||||
post_header_len[USER_VAR_EVENT-1]= 0;
|
||||
post_header_len[FORMAT_DESCRIPTION_EVENT-1]= FORMAT_DESCRIPTION_HEADER_LEN;
|
||||
}
|
||||
break;
|
||||
@ -1883,8 +1881,7 @@ Format_description_log_event(const char* buf,
|
||||
/* If alloc fails, we'll detect it in is_valid() */
|
||||
post_header_len= (uint8*) my_memdup((byte*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
|
||||
number_of_event_types*
|
||||
sizeof(*post_header_len),
|
||||
MYF(0));
|
||||
sizeof(*post_header_len), MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -2475,7 +2472,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
|
||||
{
|
||||
thd->set_time((time_t)when);
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id = query_id++;
|
||||
thd->query_id = next_query_id();
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
/*
|
||||
Initing thd->row_count is not necessary in theory as this variable has no
|
||||
@ -2976,6 +2973,60 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
#endif /* !MYSQL_CLIENT */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
Xid_log_event methods
|
||||
**************************************************************************/
|
||||
|
||||
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||
void Xid_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf[64], *pos;
|
||||
pos= strmov(buf, "xid=");
|
||||
pos= int10_to_str(xid, pos, 10);
|
||||
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
|
||||
}
|
||||
#endif
|
||||
|
||||
Xid_log_event::Xid_log_event(const char* buf,
|
||||
const Format_description_log_event* description_event)
|
||||
:Log_event(buf, description_event)
|
||||
{
|
||||
buf+= description_event->common_header_len;
|
||||
xid=*((my_xid *)buf);
|
||||
}
|
||||
|
||||
|
||||
bool Xid_log_event::write(IO_CACHE* file)
|
||||
{
|
||||
return write_header(file, sizeof(xid)) ||
|
||||
my_b_safe_write(file, (byte*) &xid, sizeof(xid));
|
||||
}
|
||||
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
void Xid_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
|
||||
{
|
||||
char buf[512];
|
||||
if (!short_form)
|
||||
{
|
||||
print_header(file);
|
||||
fprintf(file, "\tXid\n");
|
||||
}
|
||||
fprintf(file, "/* == %lu == */\n", xid);
|
||||
fflush(file);
|
||||
}
|
||||
#endif /* MYSQL_CLIENT */
|
||||
|
||||
|
||||
#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();
|
||||
return 0;
|
||||
}
|
||||
#endif /* !MYSQL_CLIENT */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
User_var_log_event methods
|
||||
**************************************************************************/
|
||||
|
@ -301,6 +301,15 @@ struct sql_ex_info
|
||||
#define LOG_EVENT_TIME_F 0x1
|
||||
#define LOG_EVENT_FORCED_ROTATE_F 0x2
|
||||
#endif
|
||||
|
||||
/*
|
||||
This flag only makes sense for Format_description_log_event.
|
||||
It is set not when the event is written, but when a binlog file
|
||||
is closed.
|
||||
*/
|
||||
|
||||
#define LOG_EVENT_BINLOG_CLOSED_F 0x1
|
||||
|
||||
/*
|
||||
If the query depends on the thread (for example: TEMPORARY TABLE).
|
||||
Currently this is used by mysqlbinlog to know it must print
|
||||
@ -309,6 +318,19 @@ struct sql_ex_info
|
||||
*/
|
||||
#define LOG_EVENT_THREAD_SPECIFIC_F 0x4
|
||||
|
||||
/*
|
||||
Suppress the generation of 'USE' statements before the actual
|
||||
statement. This flag should be set for any events that does not need
|
||||
the current database set to function correctly. Most notable cases
|
||||
are 'CREATE DATABASE' and 'DROP DATABASE'.
|
||||
|
||||
This flags should only be used in exceptional circumstances, since
|
||||
it introduce a significant change in behaviour regarding the
|
||||
replication logic together with the flags --binlog-do-db and
|
||||
--replicated-do-db.
|
||||
*/
|
||||
#define LOG_EVENT_SUPPRESS_USE_F 0x8
|
||||
|
||||
/*
|
||||
OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must be written
|
||||
to the binlog. OPTIONS_WRITTEN_TO_BINLOG could be written into the
|
||||
@ -329,19 +351,6 @@ struct sql_ex_info
|
||||
#define OPTIONS_WRITTEN_TO_BIN_LOG (OPTION_AUTO_IS_NULL | \
|
||||
OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS)
|
||||
|
||||
/*
|
||||
Suppress the generation of 'USE' statements before the actual
|
||||
statement. This flag should be set for any events that does not need
|
||||
the current database set to function correctly. Most notable cases
|
||||
are 'CREATE DATABASE' and 'DROP DATABASE'.
|
||||
|
||||
This flags should only be used in exceptional circumstances, since
|
||||
it introduce a significant change in behaviour regarding the
|
||||
replication logic together with the flags --binlog-do-db and
|
||||
--replicated-do-db.
|
||||
*/
|
||||
#define LOG_EVENT_SUPPRESS_USE_F 0x8
|
||||
|
||||
enum Log_event_type
|
||||
{
|
||||
/*
|
||||
@ -357,7 +366,7 @@ enum Log_event_type
|
||||
allowing multibyte TERMINATED BY etc; both types share the same class
|
||||
(Load_log_event)
|
||||
*/
|
||||
NEW_LOAD_EVENT,
|
||||
NEW_LOAD_EVENT, XID_EVENT,
|
||||
RAND_EVENT, USER_VAR_EVENT,
|
||||
FORMAT_DESCRIPTION_EVENT,
|
||||
ENUM_END_EVENT /* end marker */
|
||||
@ -458,10 +467,8 @@ public:
|
||||
uint32 server_id;
|
||||
|
||||
/*
|
||||
Some 16 flags. Only one is really used now; look above for
|
||||
LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F,
|
||||
LOG_EVENT_THREAD_SPECIFIC_F, and LOG_EVENT_SUPPRESS_USE_F for
|
||||
notes.
|
||||
Some 16 flags. Look above for LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F,
|
||||
LOG_EVENT_THREAD_SPECIFIC_F, and LOG_EVENT_SUPPRESS_USE_F for notes.
|
||||
*/
|
||||
uint16 flags;
|
||||
|
||||
@ -557,11 +564,11 @@ public:
|
||||
temp_buf = 0;
|
||||
}
|
||||
}
|
||||
virtual int get_data_size() { return 0;}
|
||||
/*
|
||||
Get event length for simple events. For complicated events the length
|
||||
is calculated during write()
|
||||
*/
|
||||
virtual int get_data_size() { return 0;}
|
||||
static Log_event* read_log_event(const char* buf, uint event_len,
|
||||
const char **error,
|
||||
const Format_description_log_event
|
||||
@ -1026,6 +1033,40 @@ class Rand_log_event: public Log_event
|
||||
bool is_valid() const { return 1; }
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Xid Log Event class
|
||||
|
||||
Logs xid of the transaction-to-be-committed in the 2pc protocol.
|
||||
Has no meaning in replication, slaves ignore it.
|
||||
|
||||
****************************************************************************/
|
||||
#ifdef MYSQL_CLIENT
|
||||
typedef ulong my_xid;
|
||||
#endif
|
||||
|
||||
class Xid_log_event: public Log_event
|
||||
{
|
||||
public:
|
||||
my_xid xid;
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {}
|
||||
#ifdef HAVE_REPLICATION
|
||||
void pack_info(Protocol* protocol);
|
||||
int exec_event(struct st_relay_log_info* rli);
|
||||
#endif /* HAVE_REPLICATION */
|
||||
#else
|
||||
void print(FILE* file, bool short_form = 0, LAST_EVENT_INFO* last_event_info= 0);
|
||||
#endif
|
||||
|
||||
Xid_log_event(const char* buf, const Format_description_log_event* description_event);
|
||||
~Xid_log_event() {}
|
||||
Log_event_type get_type_code() { return XID_EVENT;}
|
||||
int get_data_size() { return sizeof(xid); }
|
||||
bool write(IO_CACHE* file);
|
||||
bool is_valid() const { return 1; }
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@ -1075,8 +1116,6 @@ public:
|
||||
Stop Log Event class
|
||||
|
||||
****************************************************************************/
|
||||
#ifdef HAVE_REPLICATION
|
||||
|
||||
class Stop_log_event: public Log_event
|
||||
{
|
||||
public:
|
||||
@ -1096,14 +1135,11 @@ public:
|
||||
bool is_valid() const { return 1; }
|
||||
};
|
||||
|
||||
#endif /* HAVE_REPLICATION */
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Rotate Log Event class
|
||||
|
||||
This will be depricated when we move to using sequence ids.
|
||||
This will be deprecated when we move to using sequence ids.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -399,6 +399,11 @@ inline THD *_current_thd(void)
|
||||
}
|
||||
#define current_thd _current_thd()
|
||||
|
||||
/*
|
||||
External variables
|
||||
*/
|
||||
extern ulong server_id, concurrency;
|
||||
|
||||
#include "sql_string.h"
|
||||
#include "sql_list.h"
|
||||
#include "sql_map.h"
|
||||
@ -554,6 +559,8 @@ bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
|
||||
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
|
||||
KEY_CACHE *dst_cache);
|
||||
|
||||
bool mysql_xa_recover(THD *thd);
|
||||
|
||||
bool check_simple_select();
|
||||
|
||||
SORT_FIELD * make_unireg_sortorder(ORDER *order, uint *length);
|
||||
@ -928,6 +935,9 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
|
||||
const char *index_file_name,
|
||||
enum_log_type type, bool read_append,
|
||||
bool no_auto_events, ulong max_size);
|
||||
File open_binlog(IO_CACHE *log, const char *log_file_name,
|
||||
const char **errmsg);
|
||||
handlerton *binlog_init();
|
||||
|
||||
/* mysqld.cc */
|
||||
extern void yyerror(const char*);
|
||||
@ -981,7 +991,7 @@ extern double last_query_cost;
|
||||
extern double log_10[32];
|
||||
extern ulonglong log_10_int[20];
|
||||
extern ulonglong keybuff_size;
|
||||
extern ulong refresh_version,flush_version, thread_id,query_id;
|
||||
extern ulong refresh_version,flush_version, thread_id;
|
||||
extern ulong binlog_cache_use, binlog_cache_disk_use;
|
||||
extern ulong aborted_threads,aborted_connects;
|
||||
extern ulong delayed_insert_timeout;
|
||||
@ -991,8 +1001,6 @@ extern ulong delayed_rows_in_use,delayed_insert_errors;
|
||||
extern ulong slave_open_temp_tables;
|
||||
extern ulong query_cache_size, query_cache_min_res_unit;
|
||||
extern ulong thd_startup_options, slow_launch_threads, slow_launch_time;
|
||||
extern ulong server_id, concurrency;
|
||||
extern ulong ha_read_count, ha_discover_count;
|
||||
extern ulong table_cache_size;
|
||||
extern ulong max_connections,max_connect_errors, connect_timeout;
|
||||
extern ulong slave_net_timeout;
|
||||
@ -1032,6 +1040,7 @@ extern uint opt_large_page_size;
|
||||
|
||||
extern MYSQL_LOG mysql_log,mysql_slow_log,mysql_bin_log;
|
||||
extern FILE *bootstrap_file;
|
||||
extern int bootstrap_error;
|
||||
extern pthread_key(MEM_ROOT**,THR_MALLOC);
|
||||
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
|
||||
LOCK_thread_count,LOCK_mapped_file,LOCK_user_locks, LOCK_status,
|
||||
@ -1236,6 +1245,29 @@ SQL_CRYPT *get_crypt_for_frm(void);
|
||||
|
||||
#include "sql_view.h"
|
||||
|
||||
/* query_id */
|
||||
|
||||
typedef ulong query_id_t;
|
||||
extern query_id_t query_id;
|
||||
|
||||
/*
|
||||
increment query_id and return it.
|
||||
but be sure it's never a 0
|
||||
(2^32 at 1000 q/s rate will means an overflow every ~50 days.
|
||||
*/
|
||||
inline query_id_t next_query_id()
|
||||
{
|
||||
if (sizeof(query_id_t) <= 5) // assuming the compiler optimizes dead code away
|
||||
{
|
||||
query_id_t old_query_id=query_id;
|
||||
if (unlikely(++query_id == 0))
|
||||
query_id=1;
|
||||
return old_query_id;
|
||||
}
|
||||
else
|
||||
return query_id++;
|
||||
}
|
||||
|
||||
/* Some inline functions for more speed */
|
||||
|
||||
inline bool add_item_to_list(THD *thd, Item *item)
|
||||
|
331
sql/mysqld.cc
331
sql/mysqld.cc
@ -246,6 +246,10 @@ const char *sql_mode_names[] =
|
||||
};
|
||||
TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"",
|
||||
sql_mode_names, NULL };
|
||||
const char *tc_heuristic_recover_names[]= { "COMMIT", "ROLLBACK", NullS };
|
||||
TYPELIB tc_heuristic_recover_typelib=
|
||||
{ array_elements(tc_heuristic_recover_names)-1,"",
|
||||
tc_heuristic_recover_names, NULL };
|
||||
const char *first_keyword= "first", *binary_keyword= "BINARY";
|
||||
const char *my_localhost= "localhost", *delayed_user= "DELAYED";
|
||||
#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
|
||||
@ -295,15 +299,14 @@ my_bool opt_secure_auth= 0;
|
||||
my_bool opt_short_log_format= 0;
|
||||
my_bool opt_log_queries_not_using_indexes= 0;
|
||||
my_bool lower_case_file_system= 0;
|
||||
my_bool opt_innodb_safe_binlog= 0;
|
||||
my_bool opt_large_pages= 0;
|
||||
uint opt_large_page_size= 0;
|
||||
volatile bool mqh_used = 0;
|
||||
uint opt_large_page_size= 0;
|
||||
volatile bool mqh_used= 0;
|
||||
|
||||
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
|
||||
uint delay_key_write_options, protocol_version;
|
||||
uint lower_case_table_names;
|
||||
uint opt_crash_binlog_innodb;
|
||||
uint tc_heuristic_recover= 0;
|
||||
uint volatile thread_count, thread_running, kill_cached_threads, wake_thread;
|
||||
|
||||
ulong back_log, connect_timeout, concurrency;
|
||||
@ -315,7 +318,7 @@ ulong slave_net_timeout;
|
||||
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
|
||||
ulong query_cache_size=0;
|
||||
ulong refresh_version, flush_version; /* Increments on each reload */
|
||||
ulong query_id;
|
||||
query_id_t query_id;
|
||||
ulong aborted_threads, killed_threads, aborted_connects;
|
||||
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
|
||||
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
|
||||
@ -370,6 +373,7 @@ Le_creator le_creator;
|
||||
|
||||
|
||||
FILE *bootstrap_file;
|
||||
int bootstrap_error;
|
||||
|
||||
I_List<i_string_pair> replicate_rewrite_db;
|
||||
I_List<i_string> replicate_do_db, replicate_ignore_db;
|
||||
@ -432,7 +436,7 @@ static my_bool opt_do_pstack, opt_noacl, opt_bootstrap, opt_myisam_log;
|
||||
static int cleanup_done;
|
||||
static ulong opt_specialflag, opt_myisam_block_size;
|
||||
static char *opt_logname, *opt_update_logname, *opt_binlog_index_name;
|
||||
static char *opt_slow_logname;
|
||||
static char *opt_slow_logname, *opt_tc_log_file, *opt_tc_heuristic_recover;
|
||||
static char *mysql_home_ptr, *pidfile_name_ptr;
|
||||
static char **defaults_argv;
|
||||
static char *opt_bin_logname;
|
||||
@ -514,7 +518,7 @@ static char *get_relative_path(const char *path);
|
||||
static void fix_paths(void);
|
||||
extern "C" pthread_handler_decl(handle_connections_sockets,arg);
|
||||
extern "C" pthread_handler_decl(kill_server_thread,arg);
|
||||
static int bootstrap(FILE *file);
|
||||
static void bootstrap(FILE *file);
|
||||
static void close_server_sock();
|
||||
static bool read_init_file(char *file_name);
|
||||
#ifdef __NT__
|
||||
@ -956,6 +960,8 @@ void clean_up(bool print_message)
|
||||
udf_free();
|
||||
#endif
|
||||
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */
|
||||
if (tc_log)
|
||||
tc_log->close();
|
||||
delete_elements(&key_caches, (void (*)(const char*, gptr)) free_key_cache);
|
||||
multi_keycache_free();
|
||||
end_thr_alarm(1); /* Free allocated memory */
|
||||
@ -1561,11 +1567,11 @@ void mysql_down_server_cb(void *, void *)
|
||||
|
||||
// destroy callback resources
|
||||
void mysql_cb_destroy(void *)
|
||||
{
|
||||
UnRegisterEventNotification(eh); // cleanup down event notification
|
||||
{
|
||||
UnRegisterEventNotification(eh); // cleanup down event notification
|
||||
NX_UNWRAP_INTERFACE(ref);
|
||||
/* Deregister NSS volume deactivation event */
|
||||
NX_UNWRAP_INTERFACE(refneb);
|
||||
/* Deregister NSS volume deactivation event */
|
||||
NX_UNWRAP_INTERFACE(refneb);
|
||||
if (neb_consumer_id)
|
||||
UnRegisterConsumer(neb_consumer_id, NULL);
|
||||
}
|
||||
@ -1686,7 +1692,6 @@ ulong neb_event_callback(struct EventBlock *eblock)
|
||||
nw_panic = TRUE;
|
||||
event_flag= TRUE;
|
||||
kill_server(0);
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -1744,7 +1749,7 @@ static void getvolumeID(BYTE *volumeName)
|
||||
datavolid.clockSeqLow= info.vol.volumeID.clockSeqLow;
|
||||
/* This is guranteed to be 6-byte length (but sizeof() would be better) */
|
||||
memcpy(datavolid.node, info.vol.volumeID.node, (unsigned int) 6);
|
||||
|
||||
|
||||
exit:
|
||||
if (rootKey)
|
||||
zClose(rootKey);
|
||||
@ -2666,30 +2671,20 @@ version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
|
||||
with --log-bin instead.");
|
||||
}
|
||||
}
|
||||
if (opt_slow_log)
|
||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
||||
NullS, LOG_NORMAL, 0, 0, 0);
|
||||
|
||||
if (opt_bin_log)
|
||||
{
|
||||
open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
|
||||
opt_binlog_index_name, LOG_BIN, 0, 0, max_binlog_size);
|
||||
using_update_log=1;
|
||||
#ifdef HAVE_REPLICATION
|
||||
if (expire_logs_days)
|
||||
{
|
||||
long purge_time= time(0) - expire_logs_days*24*60*60;
|
||||
if (purge_time >= 0)
|
||||
mysql_bin_log.purge_logs_before_date(purge_time);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (opt_log_slave_updates)
|
||||
{
|
||||
sql_print_warning("\
|
||||
you need to use --log-bin to make --log-slave-updates work. \
|
||||
Now disabling --log-slave-updates.");
|
||||
}
|
||||
|
||||
if (opt_slow_log)
|
||||
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
|
||||
NullS, LOG_NORMAL, 0, 0, 0);
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
if (opt_log_slave_updates && replicate_same_server_id)
|
||||
@ -2721,61 +2716,35 @@ server.");
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_innodb_safe_binlog)
|
||||
{
|
||||
if (have_innodb != SHOW_OPTION_YES)
|
||||
sql_print_warning("--innodb-safe-binlog is meaningful only if "
|
||||
"the InnoDB storage engine is enabled in the server.");
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
if (innobase_flush_log_at_trx_commit != 1)
|
||||
{
|
||||
sql_print_warning("--innodb-safe-binlog is meaningful only if "
|
||||
"innodb_flush_log_at_trx_commit is 1; now setting it "
|
||||
"to 1.");
|
||||
innobase_flush_log_at_trx_commit= 1;
|
||||
}
|
||||
if (innobase_unix_file_flush_method)
|
||||
{
|
||||
/*
|
||||
This option has so many values that it's hard to know which value is
|
||||
good (especially "littlesync", and on Windows... see
|
||||
srv/srv0start.c).
|
||||
*/
|
||||
sql_print_warning("--innodb-safe-binlog requires that "
|
||||
"the innodb_flush_method actually synchronizes the "
|
||||
"InnoDB log to disk; it is your responsibility "
|
||||
"to verify that the method you chose does it.");
|
||||
}
|
||||
if (sync_binlog_period != 1)
|
||||
{
|
||||
sql_print_warning("--innodb-safe-binlog is meaningful only if "
|
||||
"the global sync_binlog variable is 1; now setting it "
|
||||
"to 1.");
|
||||
sync_binlog_period= 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ha_init())
|
||||
{
|
||||
{
|
||||
sql_print_error("Can't init databases");
|
||||
unireg_abort(1);
|
||||
}
|
||||
|
||||
tc_log= total_ha_2pc > 1 ? opt_bin_log ?
|
||||
(TC_LOG *)&mysql_bin_log :
|
||||
(TC_LOG *)&tc_log_mmap :
|
||||
(TC_LOG *)&tc_log_dummy;
|
||||
|
||||
if (tc_log->open(opt_tc_log_file))
|
||||
{
|
||||
sql_print_error("Can't init tc log");
|
||||
unireg_abort(1);
|
||||
}
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
if (opt_bin_log && expire_logs_days)
|
||||
{
|
||||
long purge_time= time(0) - expire_logs_days*24*60*60;
|
||||
if (purge_time >= 0)
|
||||
mysql_bin_log.purge_logs_before_date(purge_time);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (opt_myisam_log)
|
||||
(void) mi_log(1);
|
||||
|
||||
/*
|
||||
Now that InnoDB is initialized, we can know the last good binlog position
|
||||
and cut the binlog if needed. This function does nothing if there was no
|
||||
crash recovery by InnoDB.
|
||||
*/
|
||||
if (opt_innodb_safe_binlog)
|
||||
{
|
||||
/* not fatal if fails (but print errors) */
|
||||
mysql_bin_log.cut_spurious_tail();
|
||||
}
|
||||
mysql_bin_log.report_pos_in_innodb();
|
||||
|
||||
/* call ha_init_key_cache() on all key caches to init them */
|
||||
process_key_caches(&ha_init_key_cache);
|
||||
/* We must set dflt_key_cache in case we are using ISAM tables */
|
||||
@ -3083,9 +3052,9 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
||||
|
||||
if (opt_bootstrap)
|
||||
{
|
||||
int error=bootstrap(stdin);
|
||||
bootstrap(stdin);
|
||||
end_thr_alarm(1); // Don't allow alarms
|
||||
unireg_abort(error ? 1 : 0);
|
||||
unireg_abort(bootstrap_error ? 1 : 0);
|
||||
}
|
||||
if (opt_init_file)
|
||||
{
|
||||
@ -3381,7 +3350,7 @@ int main(int argc, char **argv)
|
||||
create MySQL privilege tables without having to start a full MySQL server.
|
||||
*/
|
||||
|
||||
static int bootstrap(FILE *file)
|
||||
static void bootstrap(FILE *file)
|
||||
{
|
||||
int error= 0;
|
||||
DBUG_ENTER("bootstrap");
|
||||
@ -3401,7 +3370,8 @@ static int bootstrap(FILE *file)
|
||||
(void*) thd))
|
||||
{
|
||||
sql_print_warning("Can't create thread to handle bootstrap");
|
||||
DBUG_RETURN(-1);
|
||||
bootstrap_error=-1;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
/* Wait for thread to die */
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
@ -3416,13 +3386,7 @@ static int bootstrap(FILE *file)
|
||||
handle_bootstrap((void *)thd);
|
||||
#endif
|
||||
|
||||
error= thd->is_fatal_error;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
net_end(&thd->net);
|
||||
#endif
|
||||
thd->cleanup();
|
||||
delete thd;
|
||||
DBUG_RETURN(error);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
@ -3433,7 +3397,7 @@ static bool read_init_file(char *file_name)
|
||||
DBUG_PRINT("enter",("name: %s",file_name));
|
||||
if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
|
||||
return(1);
|
||||
bootstrap(file); /* Ignore errors from this */
|
||||
bootstrap(file);
|
||||
(void) my_fclose(file,MYF(MY_WME));
|
||||
return 0;
|
||||
}
|
||||
@ -4076,7 +4040,7 @@ enum options_mysqld
|
||||
OPT_MASTER_HOST, OPT_MASTER_USER,
|
||||
OPT_MASTER_PASSWORD, OPT_MASTER_PORT,
|
||||
OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
|
||||
OPT_MASTER_RETRY_COUNT,
|
||||
OPT_MASTER_RETRY_COUNT, OPT_LOG_TC, OPT_LOG_TC_SIZE,
|
||||
OPT_MASTER_SSL, OPT_MASTER_SSL_KEY,
|
||||
OPT_MASTER_SSL_CERT, OPT_MASTER_SSL_CAPATH,
|
||||
OPT_MASTER_SSL_CIPHER, OPT_MASTER_SSL_CA,
|
||||
@ -4090,7 +4054,7 @@ enum options_mysqld
|
||||
OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE,
|
||||
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
|
||||
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
|
||||
OPT_DISCONNECT_SLAVE_EVENT_COUNT,
|
||||
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
|
||||
OPT_ABORT_SLAVE_EVENT_COUNT,
|
||||
OPT_INNODB_DATA_HOME_DIR,
|
||||
OPT_INNODB_DATA_FILE_PATH,
|
||||
@ -4490,6 +4454,14 @@ Disable with --skip-isam.",
|
||||
"Log slow queries to this log file. Defaults logging to hostname-slow.log file.",
|
||||
(gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"log-tc", OPT_LOG_TC,
|
||||
"Path to transaction coordinator log (used for transactions that affect "
|
||||
"more than one storage engine, when binary log is disabled)",
|
||||
(gptr*) &opt_tc_log_file, (gptr*) &opt_tc_log_file, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.",
|
||||
(gptr*) &opt_tc_log_size, (gptr*) &opt_tc_log_size, 0, GET_ULONG,
|
||||
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ~0, 0, TC_LOG_PAGE_SIZE, 0},
|
||||
{"log-update", OPT_UPDATE_LOG,
|
||||
"The update log is deprecated since version 5.0, is replaced by the binary \
|
||||
log and this option justs turns on --log-bin instead.",
|
||||
@ -4795,6 +4767,10 @@ log and this option does nothing anymore.",
|
||||
{"symbolic-links", 's', "Enable symbolic link support.",
|
||||
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
|
||||
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
|
||||
{"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER,
|
||||
"Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK",
|
||||
(gptr*) &opt_tc_heuristic_recover, (gptr*) &opt_tc_heuristic_recover,
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"temp-pool", OPT_TEMP_POOL,
|
||||
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
|
||||
(gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
|
||||
@ -4861,12 +4837,6 @@ log and this option does nothing anymore.",
|
||||
"The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.",
|
||||
(gptr*) &connect_timeout, (gptr*) &connect_timeout,
|
||||
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
|
||||
#ifdef HAVE_REPLICATION
|
||||
{"crash_binlog_innodb", OPT_CRASH_BINLOG_INNODB,
|
||||
"Used only for testing, to crash when writing Nth event to binlog.",
|
||||
(gptr*) &opt_crash_binlog_innodb, (gptr*) &opt_crash_binlog_innodb,
|
||||
0, GET_UINT, REQUIRED_ARG, 0, 0, ~(uint)0, 0, 1, 0},
|
||||
#endif
|
||||
{ "date_format", OPT_DATE_FORMAT,
|
||||
"The DATE format (For future).",
|
||||
(gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
|
||||
@ -4980,26 +4950,6 @@ log and this option does nothing anymore.",
|
||||
"How many files at the maximum InnoDB keeps open at the same time.",
|
||||
(gptr*) &innobase_open_files, (gptr*) &innobase_open_files, 0,
|
||||
GET_LONG, REQUIRED_ARG, 300L, 10L, ~0L, 0, 1L, 0},
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
Disabled for the 4.1.3 release. Disabling just this paragraph of code is
|
||||
enough, as then user can't set it to 1 so it will always be ignored in the
|
||||
rest of code.
|
||||
*/
|
||||
#if MYSQL_VERSION_ID >= 40103
|
||||
/*
|
||||
innodb_safe_binlog is not a variable, just an option. Does not make
|
||||
sense to make it a variable, as it is only used at startup (and so the
|
||||
value would be lost at next startup, so setting it on the fly would have no
|
||||
effect).
|
||||
*/
|
||||
{"innodb_safe_binlog", OPT_INNODB_SAFE_BINLOG,
|
||||
"After a crash recovery by InnoDB, truncate the binary log after the last "
|
||||
"not-rolled-back statement/transaction.",
|
||||
(gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
|
||||
#endif
|
||||
#endif
|
||||
{"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
|
||||
"Helps in performance tuning in heavily concurrent environments.",
|
||||
(gptr*) &innobase_thread_concurrency, (gptr*) &innobase_thread_concurrency,
|
||||
@ -5368,12 +5318,9 @@ struct show_var_st status_vars[]= {
|
||||
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
|
||||
{"Binlog_cache_disk_use", (char*) &binlog_cache_disk_use, SHOW_LONG},
|
||||
{"Binlog_cache_use", (char*) &binlog_cache_use, SHOW_LONG},
|
||||
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Com_admin_commands", (char*) offsetof(STATUS_VAR, com_other),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONG_STATUS},
|
||||
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONG_STATUS},
|
||||
{"Com_admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
|
||||
{"Com_alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
|
||||
{"Com_alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
|
||||
{"Com_analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
|
||||
@ -5460,115 +5407,77 @@ struct show_var_st status_vars[]= {
|
||||
{"Com_unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
|
||||
{"Com_update", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
|
||||
{"Com_update_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE_MULTI]), SHOW_LONG_STATUS},
|
||||
{"Com_xa_commit", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_COMMIT]),SHOW_LONG_STATUS},
|
||||
{"Com_xa_end", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_END]),SHOW_LONG_STATUS},
|
||||
{"Com_xa_prepare", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_PREPARE]),SHOW_LONG_STATUS},
|
||||
{"Com_xa_recover", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_RECOVER]),SHOW_LONG_STATUS},
|
||||
{"Com_xa_rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_ROLLBACK]),SHOW_LONG_STATUS},
|
||||
{"Com_xa_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_START]),SHOW_LONG_STATUS},
|
||||
{"Connections", (char*) &thread_id, SHOW_LONG_CONST},
|
||||
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR,
|
||||
created_tmp_disk_tables),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS},
|
||||
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG},
|
||||
{"Created_tmp_tables", (char*) offsetof(STATUS_VAR,
|
||||
created_tmp_tables),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables), SHOW_LONG_STATUS},
|
||||
{"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG},
|
||||
{"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_CONST},
|
||||
{"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG},
|
||||
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_CONST},
|
||||
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_discover", (char*) &ha_discover_count, SHOW_LONG},
|
||||
{"Handler_read_first", (char*) offsetof(STATUS_VAR,
|
||||
ha_read_first_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_read_next", (char*) offsetof(STATUS_VAR,
|
||||
ha_read_next_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_read_prev", (char*) offsetof(STATUS_VAR,
|
||||
ha_read_prev_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR,
|
||||
ha_read_rnd_next_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_rollback", (char*) offsetof(STATUS_VAR, ha_rollback_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
|
||||
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
|
||||
{"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS},
|
||||
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS},
|
||||
{"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR, ha_read_rnd_next_count), SHOW_LONG_STATUS},
|
||||
{"Handler_rollback", (char*) offsetof(STATUS_VAR, ha_rollback_count), SHOW_LONG_STATUS},
|
||||
{"Handler_savepoint", (char*) offsetof(STATUS_VAR, ha_savepoint_count), SHOW_LONG_STATUS},
|
||||
{"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS},
|
||||
{"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS},
|
||||
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS},
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
{"Innodb_", (char*) &innodb_status_variables, SHOW_VARS},
|
||||
#endif /*HAVE_INNOBASE_DB*/
|
||||
{"Key_blocks_not_flushed", (char*) &dflt_key_cache_var.global_blocks_changed,
|
||||
SHOW_KEY_CACHE_LONG},
|
||||
{"Key_blocks_unused", (char*) &dflt_key_cache_var.blocks_unused,
|
||||
SHOW_KEY_CACHE_CONST_LONG},
|
||||
{"Key_blocks_used", (char*) &dflt_key_cache_var.blocks_used,
|
||||
SHOW_KEY_CACHE_CONST_LONG},
|
||||
{"Key_read_requests", (char*) &dflt_key_cache_var.global_cache_r_requests,
|
||||
SHOW_KEY_CACHE_LONG},
|
||||
{"Key_reads", (char*) &dflt_key_cache_var.global_cache_read,
|
||||
SHOW_KEY_CACHE_LONG},
|
||||
{"Key_write_requests", (char*) &dflt_key_cache_var.global_cache_w_requests,
|
||||
SHOW_KEY_CACHE_LONG},
|
||||
{"Key_writes", (char*) &dflt_key_cache_var.global_cache_write,
|
||||
SHOW_KEY_CACHE_LONG},
|
||||
{"Key_blocks_not_flushed", (char*) &dflt_key_cache_var.global_blocks_changed, SHOW_KEY_CACHE_LONG},
|
||||
{"Key_blocks_unused", (char*) &dflt_key_cache_var.blocks_unused, SHOW_KEY_CACHE_CONST_LONG},
|
||||
{"Key_blocks_used", (char*) &dflt_key_cache_var.blocks_used, SHOW_KEY_CACHE_CONST_LONG},
|
||||
{"Key_read_requests", (char*) &dflt_key_cache_var.global_cache_r_requests, SHOW_KEY_CACHE_LONG},
|
||||
{"Key_reads", (char*) &dflt_key_cache_var.global_cache_read, SHOW_KEY_CACHE_LONG},
|
||||
{"Key_write_requests", (char*) &dflt_key_cache_var.global_cache_w_requests, SHOW_KEY_CACHE_LONG},
|
||||
{"Key_writes", (char*) &dflt_key_cache_var.global_cache_write, SHOW_KEY_CACHE_LONG},
|
||||
{"Last_query_cost", (char*) &last_query_cost, SHOW_DOUBLE},
|
||||
{"Max_used_connections", (char*) &max_used_connections, SHOW_LONG},
|
||||
{"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_CONST},
|
||||
{"Open_files", (char*) &my_file_opened, SHOW_LONG_CONST},
|
||||
{"Open_streams", (char*) &my_stream_opened, SHOW_LONG_CONST},
|
||||
{"Open_tables", (char*) 0, SHOW_OPENTABLES},
|
||||
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
{"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks,
|
||||
SHOW_LONG_CONST},
|
||||
{"Qcache_free_memory", (char*) &query_cache.free_memory,
|
||||
SHOW_LONG_CONST},
|
||||
{"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_CONST},
|
||||
{"Qcache_free_memory", (char*) &query_cache.free_memory, SHOW_LONG_CONST},
|
||||
{"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG},
|
||||
{"Qcache_inserts", (char*) &query_cache.inserts, SHOW_LONG},
|
||||
{"Qcache_lowmem_prunes", (char*) &query_cache.lowmem_prunes, SHOW_LONG},
|
||||
{"Qcache_not_cached", (char*) &query_cache.refused, SHOW_LONG},
|
||||
{"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST},
|
||||
{"Qcache_total_blocks", (char*) &query_cache.total_blocks,
|
||||
SHOW_LONG_CONST},
|
||||
{"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_CONST},
|
||||
#endif /*HAVE_QUERY_CACHE*/
|
||||
{"Questions", (char*) 0, SHOW_QUESTION},
|
||||
{"Rpl_status", (char*) 0, SHOW_RPL_STATUS},
|
||||
{"Select_full_join", (char*) offsetof(STATUS_VAR,
|
||||
select_full_join_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Select_full_range_join", (char*) offsetof(STATUS_VAR,
|
||||
select_full_range_join_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Select_range", (char*) offsetof(STATUS_VAR,
|
||||
select_range_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Select_range_check", (char*) offsetof(STATUS_VAR,
|
||||
select_range_check_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS},
|
||||
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS},
|
||||
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
|
||||
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
|
||||
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
|
||||
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG},
|
||||
{"Slave_running", (char*) 0, SHOW_SLAVE_RUNNING},
|
||||
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
|
||||
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR,
|
||||
filesort_merge_passes),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Sort_range", (char*) offsetof(STATUS_VAR,
|
||||
filesort_range_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Sort_scan", (char*) offsetof(STATUS_VAR,
|
||||
filesort_scan_count),
|
||||
SHOW_LONG_STATUS},
|
||||
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
|
||||
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
|
||||
{"Sort_range", (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS},
|
||||
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS},
|
||||
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
|
||||
#ifdef HAVE_OPENSSL
|
||||
{"Ssl_accept_renegotiates", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE},
|
||||
{"Ssl_accepts", (char*) 0, SHOW_SSL_CTX_SESS_ACCEPT},
|
||||
@ -5596,6 +5505,9 @@ struct show_var_st status_vars[]= {
|
||||
#endif /* HAVE_OPENSSL */
|
||||
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG},
|
||||
{"Table_locks_waited", (char*) &locks_waited, SHOW_LONG},
|
||||
{"Tc_log_max_pages_used", (char*) &tc_log_max_pages_used, SHOW_LONG},
|
||||
{"Tc_log_page_size", (char*) &tc_log_page_size, SHOW_LONG},
|
||||
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG},
|
||||
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST},
|
||||
{"Threads_connected", (char*) &thread_count, SHOW_INT_CONST},
|
||||
{"Threads_created", (char*) &thread_created, SHOW_LONG_CONST},
|
||||
@ -5688,7 +5600,8 @@ static void mysql_init_variables(void)
|
||||
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
|
||||
opt_log= opt_update_log= opt_bin_log= opt_slow_log= 0;
|
||||
opt_disable_networking= opt_skip_show_db=0;
|
||||
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname=0;
|
||||
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
|
||||
opt_tc_log_file= "mysqld-tc.log"; // no hostname in tc_log file name !
|
||||
opt_secure_auth= 0;
|
||||
opt_bootstrap= opt_myisam_log= 0;
|
||||
mqh_used= 0;
|
||||
@ -6380,6 +6293,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
|
||||
break;
|
||||
}
|
||||
case OPT_TC_HEURISTIC_RECOVER:
|
||||
{
|
||||
if ((tc_heuristic_recover=find_type(argument,
|
||||
&tc_heuristic_recover_typelib, 2)) <=0)
|
||||
{
|
||||
fprintf(stderr, "Unknown option to tc-heuristic-recover: %s\n",argument);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OPT_SQL_MODE:
|
||||
{
|
||||
sql_mode_str= argument;
|
||||
|
@ -762,7 +762,7 @@ public:
|
||||
} save_result;
|
||||
LEX_STRING base; /* for structs */
|
||||
|
||||
set_var(enum_var_type type_arg, sys_var *var_arg, LEX_STRING *base_name_arg,
|
||||
set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg,
|
||||
Item *value_arg)
|
||||
:var(var_arg), type(type_arg), base(*base_name_arg)
|
||||
{
|
||||
|
@ -5232,3 +5232,15 @@ ER_CANNOT_USER
|
||||
eng "Operation %s failed for %.256s"
|
||||
ger "Das Kommando %s scheiterte für %.256s"
|
||||
norwegian-ny "Operation %s failed for '%.256s'"
|
||||
ER_XAER_NOTA XAE04
|
||||
eng "XAER_NOTA: Unknown XID"
|
||||
ER_XAER_INVAL XAE05
|
||||
eng "XAER_INVAL: Invalid arguments (or unsupported command)"
|
||||
ER_XAER_RMFAIL XAE07
|
||||
eng "XAER_RMFAIL: The command cannot be executed in this state"
|
||||
ER_XAER_OUTSIDE XAE09
|
||||
eng "XAER_OUTSIDE: Some work is done outside global transaction"
|
||||
ER_XAER_RMERR XAE03
|
||||
eng "XAER_RMERR: fatal error occurred in the transaction branch - check your data for consistency"
|
||||
ER_XA_RBROLLBACK XA100
|
||||
eng "XA_RBROLLBACK: Transaction branch was rolled back"
|
||||
|
@ -1200,7 +1200,7 @@ sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
|
||||
thd->free_list= NULL;
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id= query_id++;
|
||||
thd->query_id= next_query_id();
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
|
||||
reset_stmt_for_execute(thd, lex);
|
||||
|
@ -380,8 +380,8 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived,
|
||||
{
|
||||
TABLE *table, *next;
|
||||
/*
|
||||
Close all derived tables generated from questions like
|
||||
SELECT * from (select * from t1))
|
||||
Close all derived tables generated in queries like
|
||||
SELECT * FROM (SELECT * FROM t1)
|
||||
*/
|
||||
for (table= thd->derived_tables ; table ; table= next)
|
||||
{
|
||||
@ -401,6 +401,18 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived,
|
||||
mysql_unlock_tables(thd, thd->lock);
|
||||
thd->lock=0;
|
||||
}
|
||||
/*
|
||||
assume handlers auto-commit (if some doesn't - transaction handling
|
||||
in MySQL should be redesigned to support it; it's a big change,
|
||||
and it's not worth it - better to commit explicitly only writing
|
||||
transactions, read-only ones should better take care of themselves.
|
||||
saves some work in 2pc too)
|
||||
see also sql_parse.cc - dispatch_command()
|
||||
*/
|
||||
bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
|
||||
if (!thd->active_transaction())
|
||||
thd->transaction.xid.null();
|
||||
|
||||
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */
|
||||
if (!lock_in_use)
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
@ -1812,7 +1824,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
-1 - error
|
||||
|
||||
NOTE
|
||||
The lock will automaticly be freed by close_thread_tables()
|
||||
The lock will automaticaly be freed by close_thread_tables()
|
||||
*/
|
||||
|
||||
int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
@ -1839,7 +1851,7 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
TRUE - error
|
||||
|
||||
NOTE
|
||||
The lock will automaticly be freed by close_thread_tables()
|
||||
The lock will automaticaly be freed by close_thread_tables()
|
||||
*/
|
||||
|
||||
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
|
@ -195,6 +195,7 @@ THD::THD()
|
||||
file_id = 0;
|
||||
warn_id= 0;
|
||||
db_charset= global_system_variables.collation_database;
|
||||
bzero(ha_data, sizeof(ha_data));
|
||||
mysys_var=0;
|
||||
#ifndef DBUG_OFF
|
||||
dbug_sentry=THD_SENTRY_MAGIC;
|
||||
@ -206,7 +207,6 @@ THD::THD()
|
||||
ull=0;
|
||||
system_thread= cleanup_done= abort_on_warning= 0;
|
||||
peer_port= 0; // For SHOW PROCESSLIST
|
||||
transaction.changed_tables = 0;
|
||||
#ifdef __WIN__
|
||||
real_id = 0;
|
||||
#endif
|
||||
@ -241,9 +241,7 @@ THD::THD()
|
||||
/* For user vars replication*/
|
||||
if (opt_bin_log)
|
||||
my_init_dynamic_array(&user_var_events,
|
||||
sizeof(BINLOG_USER_VAR_EVENT *),
|
||||
16,
|
||||
16);
|
||||
sizeof(BINLOG_USER_VAR_EVENT *), 16, 16);
|
||||
else
|
||||
bzero((char*) &user_var_events, sizeof(user_var_events));
|
||||
|
||||
@ -253,26 +251,8 @@ THD::THD()
|
||||
protocol_prep.init(this);
|
||||
|
||||
tablespace_op=FALSE;
|
||||
#ifdef USING_TRANSACTIONS
|
||||
bzero((char*) &transaction,sizeof(transaction));
|
||||
/*
|
||||
Binlog is always open (if needed) before a THD is created (including
|
||||
bootstrap).
|
||||
*/
|
||||
if (opt_using_transactions && mysql_bin_log.is_open())
|
||||
{
|
||||
if (open_cached_file(&transaction.trans_log,
|
||||
mysql_tmpdir, LOG_PREFIX, binlog_cache_size,
|
||||
MYF(MY_WME)))
|
||||
killed= KILL_CONNECTION;
|
||||
transaction.trans_log.end_of_file= max_binlog_cache_size;
|
||||
}
|
||||
#endif
|
||||
init_sql_alloc(&transaction.mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
|
||||
{
|
||||
ulong tmp=sql_rnd_with_mutex();
|
||||
randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -321,9 +301,12 @@ void THD::init_for_queries()
|
||||
|
||||
reset_root_defaults(mem_root, variables.query_alloc_block_size,
|
||||
variables.query_prealloc_size);
|
||||
#ifdef USING_TRANSACTIONS
|
||||
reset_root_defaults(&transaction.mem_root,
|
||||
variables.trans_alloc_block_size,
|
||||
variables.trans_prealloc_size);
|
||||
#endif
|
||||
transaction.xid.null();
|
||||
}
|
||||
|
||||
|
||||
@ -408,13 +391,8 @@ THD::~THD()
|
||||
#endif
|
||||
if (!cleanup_done)
|
||||
cleanup();
|
||||
#ifdef USING_TRANSACTIONS
|
||||
if (opt_using_transactions)
|
||||
{
|
||||
close_cached_file(&transaction.trans_log);
|
||||
|
||||
ha_close_connection(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
sp_cache_clear(&sp_proc_cache);
|
||||
sp_cache_clear(&sp_func_cache);
|
||||
@ -427,7 +405,9 @@ THD::~THD()
|
||||
safeFree(ip);
|
||||
safeFree(db);
|
||||
free_root(&warn_root,MYF(0));
|
||||
#ifdef USING_TRANSACTIONS
|
||||
free_root(&transaction.mem_root,MYF(0));
|
||||
#endif
|
||||
mysys_var=0; // Safety (shouldn't be needed)
|
||||
pthread_mutex_destroy(&LOCK_delete);
|
||||
#ifndef DBUG_OFF
|
||||
@ -867,7 +847,6 @@ bool select_send::send_data(List<Item> &items)
|
||||
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
|
||||
by thd
|
||||
*/
|
||||
if (thd->transaction.all.innobase_tid)
|
||||
ha_release_temporary_latches(thd);
|
||||
#endif
|
||||
|
||||
@ -902,7 +881,6 @@ bool select_send::send_eof()
|
||||
/* We may be passing the control from mysqld to the client: release the
|
||||
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
|
||||
by thd */
|
||||
if (thd->transaction.all.innobase_tid)
|
||||
ha_release_temporary_latches(thd);
|
||||
#endif
|
||||
|
||||
|
170
sql/sql_class.h
170
sql/sql_class.h
@ -43,6 +43,101 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN,
|
||||
extern char internal_table_name[2];
|
||||
extern const char **errmesg;
|
||||
|
||||
#define TC_LOG_PAGE_SIZE 8192
|
||||
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
|
||||
extern uint opt_tc_log_size;
|
||||
extern uint tc_log_max_pages_used;
|
||||
extern uint tc_log_page_size;
|
||||
extern uint tc_log_page_waits;
|
||||
|
||||
#define TC_HEURISTIC_RECOVER_COMMIT 1
|
||||
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
|
||||
extern uint tc_heuristic_recover;
|
||||
|
||||
/*
|
||||
Transaction Coordinator log - a base abstract class
|
||||
for two different implementations
|
||||
*/
|
||||
class TC_LOG
|
||||
{
|
||||
public:
|
||||
int using_heuristic_recover();
|
||||
TC_LOG() {}
|
||||
virtual ~TC_LOG() {}
|
||||
|
||||
virtual int open(const char *opt_name)=0;
|
||||
virtual void close()=0;
|
||||
virtual int log(THD *thd, my_xid xid)=0;
|
||||
virtual void unlog(ulong cookie, my_xid xid)=0;
|
||||
};
|
||||
|
||||
class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
|
||||
{
|
||||
public:
|
||||
int open(const char *opt_name) { return 0; }
|
||||
void close() { }
|
||||
int log(THD *thd, my_xid xid) { return 1; }
|
||||
void unlog(ulong cookie, my_xid xid) { }
|
||||
};
|
||||
|
||||
class TC_LOG_MMAP: public TC_LOG
|
||||
{
|
||||
private:
|
||||
|
||||
typedef enum {
|
||||
POOL, // page is in pool
|
||||
ERROR, // last sync failed
|
||||
DIRTY // new xids added since last sync
|
||||
} PAGE_STATE;
|
||||
|
||||
typedef struct st_page {
|
||||
struct st_page *next; // page a linked in a fifo queue
|
||||
my_xid *start, *end; // usable area of a page
|
||||
my_xid *ptr; // next xid will be written here
|
||||
int size, free; // max and current number of free xid slots on the page
|
||||
int waiters; // number of waiters on condition
|
||||
PAGE_STATE state; // see above
|
||||
pthread_mutex_t lock; // to access page data or control structure
|
||||
pthread_cond_t cond; // to wait for a sync
|
||||
} PAGE;
|
||||
|
||||
char logname[FN_REFLEN];
|
||||
File fd;
|
||||
uint file_length, npages, inited;
|
||||
uchar *data;
|
||||
struct st_page *pages, *in_sync, *active, *pool, *pool_last;
|
||||
pthread_mutex_t LOCK_active, LOCK_pool, LOCK_sync;
|
||||
pthread_cond_t COND_pool, COND_active;
|
||||
|
||||
public:
|
||||
TC_LOG_MMAP(): inited(0) {}
|
||||
int open(const char *opt_name);
|
||||
void close();
|
||||
int log(THD *thd, my_xid xid);
|
||||
void unlog(ulong cookie, my_xid xid);
|
||||
int recover();
|
||||
|
||||
private:
|
||||
void get_active_from_pool();
|
||||
int sync();
|
||||
int overflow();
|
||||
void compact_active();
|
||||
void lock_queue(pthread_mutex_t *lock)
|
||||
{
|
||||
if (in_sync)
|
||||
pthread_mutex_lock(lock);
|
||||
}
|
||||
void unlock_queue(pthread_mutex_t *lock)
|
||||
{
|
||||
if (in_sync)
|
||||
pthread_mutex_unlock(lock);
|
||||
}
|
||||
};
|
||||
|
||||
extern TC_LOG *tc_log;
|
||||
extern TC_LOG_MMAP tc_log_mmap;
|
||||
extern TC_LOG_DUMMY tc_log_dummy;
|
||||
|
||||
/* log info errors */
|
||||
#define LOG_INFO_EOF -1
|
||||
#define LOG_INFO_IO -2
|
||||
@ -81,8 +176,18 @@ typedef struct st_user_var_events
|
||||
|
||||
class Log_event;
|
||||
|
||||
class MYSQL_LOG
|
||||
{
|
||||
/*
|
||||
TODO split MYSQL_LOG into base MYSQL_LOG and
|
||||
MYSQL_QUERY_LOG, MYSQL_SLOW_LOG, MYSQL_BIN_LOG
|
||||
most of the code from MYSQL_LOG should be in the MYSQL_BIN_LOG
|
||||
only (TC_LOG included)
|
||||
|
||||
TODO use mmap instead of IO_CACHE for binlog
|
||||
(mmap+fsync is two times faster than write+fsync)
|
||||
*/
|
||||
|
||||
class MYSQL_LOG: public TC_LOG
|
||||
{
|
||||
private:
|
||||
/* LOCK_log and LOCK_index are inited by init_pthread_objects() */
|
||||
pthread_mutex_t LOCK_log, LOCK_index;
|
||||
@ -108,8 +213,8 @@ class MYSQL_LOG
|
||||
etc. So in 4.x this is 1 for relay logs, 0 for binlogs.
|
||||
In 5.0 it's 0 for relay logs too!
|
||||
*/
|
||||
bool no_auto_events;
|
||||
/*
|
||||
bool no_auto_events;
|
||||
/*
|
||||
The max size before rotation (usable only if log_type == LOG_BIN: binary
|
||||
logs and relay logs).
|
||||
For a binlog, max_size should be max_binlog_size.
|
||||
@ -117,16 +222,26 @@ class MYSQL_LOG
|
||||
max_binlog_size otherwise.
|
||||
max_size is set in init(), and dynamically changed (when one does SET
|
||||
GLOBAL MAX_BINLOG_SIZE|MAX_RELAY_LOG_SIZE) by fix_max_binlog_size and
|
||||
fix_max_relay_log_size).
|
||||
fix_max_relay_log_size).
|
||||
*/
|
||||
ulong max_size;
|
||||
|
||||
ulong prepared_xids; /* for tc log - number of xids to remember */
|
||||
pthread_mutex_t LOCK_prep_xids;
|
||||
pthread_cond_t COND_prep_xids;
|
||||
friend class Log_event;
|
||||
|
||||
public:
|
||||
MYSQL_LOG();
|
||||
~MYSQL_LOG();
|
||||
|
||||
/*
|
||||
int open(const char *opt_name);
|
||||
void close();
|
||||
int log(THD *thd, my_xid xid);
|
||||
void unlog(ulong cookie, my_xid xid);
|
||||
int recover(IO_CACHE *log, Format_description_log_event *fdle);
|
||||
|
||||
/*
|
||||
These describe the log's format. This is used only for relay logs.
|
||||
_for_exec is used by the SQL thread, _for_queue by the I/O thread. It's
|
||||
necessary to have 2 distinct objects, because the I/O thread may be reading
|
||||
@ -193,8 +308,6 @@ public:
|
||||
int purge_first_log(struct st_relay_log_info* rli, bool included);
|
||||
bool reset_logs(THD* thd);
|
||||
void close(uint exiting);
|
||||
bool cut_spurious_tail();
|
||||
void report_pos_in_innodb();
|
||||
|
||||
// iterating through the log index file
|
||||
int find_log_pos(LOG_INFO* linfo, const char* log_name,
|
||||
@ -479,6 +592,10 @@ typedef struct system_status_var
|
||||
ulong ha_rollback_count;
|
||||
ulong ha_update_count;
|
||||
ulong ha_write_count;
|
||||
ulong ha_prepare_count;
|
||||
ulong ha_discover_count;
|
||||
ulong ha_savepoint_count;
|
||||
ulong ha_savepoint_rollback_count;
|
||||
|
||||
/* KEY_CACHE parts. These are copies of the original */
|
||||
ulong key_blocks_changed;
|
||||
@ -757,6 +874,13 @@ private:
|
||||
Statement *last_found_statement;
|
||||
};
|
||||
|
||||
struct st_savepoint {
|
||||
struct st_savepoint *prev;
|
||||
char *name;
|
||||
uint length, nht;
|
||||
};
|
||||
|
||||
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED};
|
||||
|
||||
/*
|
||||
A registry for item tree transformations performed during
|
||||
@ -899,15 +1023,15 @@ public:
|
||||
thr_lock_type update_lock_default;
|
||||
delayed_insert *di;
|
||||
my_bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */
|
||||
/* container for handler's private per-connection data */
|
||||
void *ha_data[MAX_HA];
|
||||
struct st_transactions {
|
||||
IO_CACHE trans_log; // Inited ONLY if binlog is open !
|
||||
SAVEPOINT *savepoints;
|
||||
THD_TRANS all; // Trans since BEGIN WORK
|
||||
THD_TRANS stmt; // Trans for current statement
|
||||
uint bdb_lock_count;
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
void* thd_ndb;
|
||||
#endif
|
||||
bool on;
|
||||
XID xid;
|
||||
enum xa_states xa_state;
|
||||
/*
|
||||
Tables changed in transaction (that must be invalidated in query cache).
|
||||
List contain only transactional tables, that not invalidated in query
|
||||
@ -918,8 +1042,18 @@ public:
|
||||
void cleanup()
|
||||
{
|
||||
changed_tables = 0;
|
||||
#ifdef USING_TRANSACTIONS
|
||||
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
#endif
|
||||
}
|
||||
#ifdef USING_TRANSACTIONS
|
||||
st_transactions()
|
||||
{
|
||||
bzero((char*)this, sizeof(*this));
|
||||
xid.null();
|
||||
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
|
||||
}
|
||||
#endif
|
||||
} transaction;
|
||||
Field *dupp_field;
|
||||
#ifndef __WIN__
|
||||
@ -1115,7 +1249,7 @@ public:
|
||||
inline ulonglong insert_id(void)
|
||||
{
|
||||
if (!last_insert_id_used)
|
||||
{
|
||||
{
|
||||
last_insert_id_used=1;
|
||||
current_insert_id=last_insert_id;
|
||||
}
|
||||
@ -1124,13 +1258,11 @@ public:
|
||||
inline ulonglong found_rows(void)
|
||||
{
|
||||
return limit_found_rows;
|
||||
}
|
||||
}
|
||||
inline bool active_transaction()
|
||||
{
|
||||
#ifdef USING_TRANSACTIONS
|
||||
return (transaction.all.bdb_tid != 0 ||
|
||||
transaction.all.innodb_active_trans != 0 ||
|
||||
transaction.all.ndb_tid != 0);
|
||||
#ifdef USING_TRANSACTIONS
|
||||
return server_status & SERVER_STATUS_IN_TRANS;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -438,7 +438,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
/*
|
||||
Invalidate the table in the query cache if something changed.
|
||||
For the transactional algorithm to work the invalidation must be
|
||||
before binlog writing and ha_autocommit_...
|
||||
before binlog writing and ha_autocommit_or_rollback
|
||||
*/
|
||||
if (info.copied || info.deleted || info.updated)
|
||||
{
|
||||
@ -1930,7 +1930,7 @@ bool select_insert::send_eof()
|
||||
|
||||
/*
|
||||
We must invalidate the table in the query cache before binlog writing
|
||||
and ha_autocommit_...
|
||||
and ha_autocommit_or_rollback
|
||||
*/
|
||||
|
||||
if (info.copied || info.deleted || info.updated)
|
||||
|
@ -148,7 +148,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
|
||||
lex->view_prepare_mode= FALSE;
|
||||
lex->derived_tables= 0;
|
||||
lex->lock_option= TL_READ;
|
||||
lex->found_colon= 0;
|
||||
lex->found_semicolon= 0;
|
||||
lex->safe_to_cache_query= 1;
|
||||
lex->time_zone_tables_used= 0;
|
||||
lex->leaf_tables_insert= lex->proc_table= lex->query_tables= 0;
|
||||
@ -951,7 +951,7 @@ int yylex(void *arg, void *yythd)
|
||||
if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) &&
|
||||
(thd->command != COM_PREPARE))
|
||||
{
|
||||
lex->found_colon=(char*)lex->ptr;
|
||||
lex->found_semicolon=(char*)lex->ptr;
|
||||
thd->server_status |= SERVER_MORE_RESULTS_EXISTS;
|
||||
lex->next_state=MY_LEX_END;
|
||||
return(END_OF_INPUT);
|
||||
|
@ -87,6 +87,8 @@ enum enum_sql_command {
|
||||
SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE,
|
||||
SQLCOM_CREATE_VIEW, SQLCOM_DROP_VIEW,
|
||||
SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER,
|
||||
SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE,
|
||||
SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER,
|
||||
/* This should be the last !!! */
|
||||
SQLCOM_END
|
||||
};
|
||||
@ -634,6 +636,9 @@ struct st_trg_chistics
|
||||
|
||||
extern sys_var_long_ptr trg_new_row_fake_var;
|
||||
|
||||
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
|
||||
XA_SUSPEND, XA_FOR_MIGRATE};
|
||||
|
||||
/* The state of the lex parsing. This is saved in the THD struct */
|
||||
|
||||
typedef struct st_lex
|
||||
@ -653,12 +658,12 @@ typedef struct st_lex
|
||||
char *backup_dir; /* For RESTORE/BACKUP */
|
||||
char* to_log; /* For PURGE MASTER LOGS TO */
|
||||
char* x509_subject,*x509_issuer,*ssl_cipher;
|
||||
char* found_colon; /* For multi queries - next query */
|
||||
char* found_semicolon; /* For multi queries - next query */
|
||||
String *wild;
|
||||
sql_exchange *exchange;
|
||||
select_result *result;
|
||||
Item *default_value, *on_update_value;
|
||||
LEX_STRING *comment, name_and_length;
|
||||
LEX_STRING comment, ident;
|
||||
LEX_USER *grant_user;
|
||||
gptr yacc_yyss,yacc_yyvs;
|
||||
THD *thd;
|
||||
@ -688,7 +693,6 @@ typedef struct st_lex
|
||||
List<LEX_STRING> view_list; // view list (list of field names in view)
|
||||
SQL_LIST proc_list, auxilliary_table_list, save_list;
|
||||
create_field *last_field;
|
||||
char *savepoint_name; // Transaction savepoint id
|
||||
udf_func udf;
|
||||
HA_CHECK_OPT check_opt; // check/repair options
|
||||
HA_CREATE_INFO create_info;
|
||||
@ -702,7 +706,10 @@ typedef struct st_lex
|
||||
enum enum_duplicates duplicates;
|
||||
enum enum_tx_isolation tx_isolation;
|
||||
enum enum_ha_read_modes ha_read_mode;
|
||||
union {
|
||||
enum ha_rkey_function ha_rkey_mode;
|
||||
enum xa_option_words xa_opt;
|
||||
};
|
||||
enum enum_var_type option_type;
|
||||
enum enum_view_create_mode create_view_mode;
|
||||
enum enum_drop_mode drop_mode;
|
||||
|
343
sql/sql_parse.cc
343
sql/sql_parse.cc
@ -535,23 +535,23 @@ void init_update_queries(void)
|
||||
uc_update_queries[SQLCOM_CREATE_TABLE]=1;
|
||||
uc_update_queries[SQLCOM_CREATE_INDEX]=1;
|
||||
uc_update_queries[SQLCOM_ALTER_TABLE]=1;
|
||||
uc_update_queries[SQLCOM_UPDATE]=1;
|
||||
uc_update_queries[SQLCOM_INSERT]=1;
|
||||
uc_update_queries[SQLCOM_INSERT_SELECT]=1;
|
||||
uc_update_queries[SQLCOM_DELETE]=1;
|
||||
uc_update_queries[SQLCOM_UPDATE]=2;
|
||||
uc_update_queries[SQLCOM_UPDATE_MULTI]=2;
|
||||
uc_update_queries[SQLCOM_INSERT]=2;
|
||||
uc_update_queries[SQLCOM_INSERT_SELECT]=2;
|
||||
uc_update_queries[SQLCOM_DELETE]=2;
|
||||
uc_update_queries[SQLCOM_DELETE_MULTI]=2;
|
||||
uc_update_queries[SQLCOM_TRUNCATE]=1;
|
||||
uc_update_queries[SQLCOM_DROP_TABLE]=1;
|
||||
uc_update_queries[SQLCOM_LOAD]=1;
|
||||
uc_update_queries[SQLCOM_CREATE_DB]=1;
|
||||
uc_update_queries[SQLCOM_DROP_DB]=1;
|
||||
uc_update_queries[SQLCOM_REPLACE]=1;
|
||||
uc_update_queries[SQLCOM_REPLACE_SELECT]=1;
|
||||
uc_update_queries[SQLCOM_REPLACE]=2;
|
||||
uc_update_queries[SQLCOM_REPLACE_SELECT]=2;
|
||||
uc_update_queries[SQLCOM_RENAME_TABLE]=1;
|
||||
uc_update_queries[SQLCOM_BACKUP_TABLE]=1;
|
||||
uc_update_queries[SQLCOM_RESTORE_TABLE]=1;
|
||||
uc_update_queries[SQLCOM_DELETE_MULTI]=1;
|
||||
uc_update_queries[SQLCOM_DROP_INDEX]=1;
|
||||
uc_update_queries[SQLCOM_UPDATE_MULTI]=1;
|
||||
uc_update_queries[SQLCOM_CREATE_VIEW]=1;
|
||||
uc_update_queries[SQLCOM_DROP_VIEW]=1;
|
||||
}
|
||||
@ -559,7 +559,7 @@ void init_update_queries(void)
|
||||
bool is_update_query(enum enum_sql_command command)
|
||||
{
|
||||
DBUG_ASSERT(command >= 0 && command <= SQLCOM_END);
|
||||
return uc_update_queries[command];
|
||||
return uc_update_queries[command] > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1147,24 +1147,25 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
|
||||
We don't need to obtain LOCK_thread_count here because in bootstrap
|
||||
mode we have only one thread.
|
||||
*/
|
||||
thd->query_id=query_id++;
|
||||
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
|
||||
{
|
||||
thd->net.error = 0;
|
||||
close_thread_tables(thd); // Free tables
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
break;
|
||||
}
|
||||
thd->query_id=next_query_id();
|
||||
mysql_parse(thd,thd->query,length);
|
||||
close_thread_tables(thd); // Free tables
|
||||
if (thd->is_fatal_error)
|
||||
break;
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
#ifdef USING_TRANSACTIONS
|
||||
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* thd->fatal_error should be set in case something went wrong */
|
||||
end:
|
||||
bootstrap_error= thd->is_fatal_error;
|
||||
|
||||
net_end(&thd->net);
|
||||
thd->cleanup();
|
||||
delete thd;
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
thread_count--;
|
||||
@ -1173,7 +1174,7 @@ end:
|
||||
my_thread_end();
|
||||
pthread_exit(0);
|
||||
#endif
|
||||
DBUG_RETURN(0); // Never reached
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* This works because items are allocated with sql_alloc() */
|
||||
@ -1239,7 +1240,6 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
|
||||
my_error(ER_GET_ERRNO, MYF(0), error);
|
||||
|
||||
err:
|
||||
close_thread_tables(thd);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
@ -1355,7 +1355,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id=query_id;
|
||||
if (command != COM_STATISTICS && command != COM_PING)
|
||||
query_id++;
|
||||
next_query_id();
|
||||
thread_running++;
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
@ -1511,9 +1511,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
DBUG_PRINT("query",("%-.4096s",thd->query));
|
||||
mysql_parse(thd,thd->query, thd->query_length);
|
||||
|
||||
while (!thd->killed && thd->lex->found_colon && !thd->net.report_error)
|
||||
while (!thd->killed && thd->lex->found_semicolon && !thd->net.report_error)
|
||||
{
|
||||
char *packet= thd->lex->found_colon;
|
||||
char *packet= thd->lex->found_semicolon;
|
||||
/*
|
||||
Multiple queries exits, execute them individually
|
||||
in embedded server - just store them to be executed later
|
||||
@ -1533,7 +1533,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_length= length;
|
||||
thd->query= packet;
|
||||
thd->query_id= query_id++;
|
||||
thd->query_id= next_query_id();
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
@ -1845,6 +1845,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->proc_info="closing tables";
|
||||
close_thread_tables(thd); /* Free tables */
|
||||
}
|
||||
/*
|
||||
assume handlers auto-commit (if some doesn't - transaction handling
|
||||
in MySQL should be redesigned to support it; it's a big change,
|
||||
and it's not worth it - better to commit explicitly only writing
|
||||
transactions, read-only ones should better take care of themselves.
|
||||
saves some work in 2pc too)
|
||||
see also sql_base.cc - close_thread_tables()
|
||||
*/
|
||||
bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
|
||||
if (!thd->active_transaction())
|
||||
thd->transaction.xid.null();
|
||||
|
||||
/* report error issued during command execution */
|
||||
if (thd->killed_errno() && !thd->net.report_error)
|
||||
@ -2407,7 +2418,7 @@ mysql_execute_command(THD *thd)
|
||||
{
|
||||
if (check_global_access(thd, REPL_SLAVE_ACL))
|
||||
goto error;
|
||||
res = show_binlog_events(thd);
|
||||
res = mysql_show_binlog_events(thd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -2442,7 +2453,7 @@ mysql_execute_command(THD *thd)
|
||||
check_access(thd, INDEX_ACL, first_table->db,
|
||||
&first_table->grant.privilege, 0, 0))
|
||||
goto error;
|
||||
res= mysql_assign_to_keycache(thd, first_table, &lex->name_and_length);
|
||||
res= mysql_assign_to_keycache(thd, first_table, &lex->ident);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_PRELOAD_KEYS:
|
||||
@ -3056,7 +3067,7 @@ create_error:
|
||||
first_table->ancestor && first_table->ancestor->next_local);
|
||||
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
|
||||
first_table->view_db.str, first_table->view_name.str);
|
||||
res= -1;
|
||||
res= FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3080,7 +3091,6 @@ create_error:
|
||||
}
|
||||
else
|
||||
res= TRUE;
|
||||
close_thread_tables(thd);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_DROP_TABLE:
|
||||
@ -3375,12 +3385,6 @@ create_error:
|
||||
}
|
||||
if (check_access(thd,SELECT_ACL,lex->name,0,1,0))
|
||||
break;
|
||||
if (thd->locked_tables || thd->active_transaction())
|
||||
{
|
||||
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
|
||||
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
|
||||
goto error;
|
||||
}
|
||||
res=mysqld_show_create_db(thd,lex->name,&lex->create_info);
|
||||
break;
|
||||
}
|
||||
@ -3611,18 +3615,12 @@ create_error:
|
||||
*/
|
||||
if (check_db_used(thd, all_tables))
|
||||
goto error;
|
||||
res= mysql_ha_read(thd, first_table, lex->ha_read_mode, lex->backup_dir,
|
||||
res= mysql_ha_read(thd, first_table, lex->ha_read_mode, lex->ident.str,
|
||||
lex->insert_list, lex->ha_rkey_mode, select_lex->where,
|
||||
select_lex->select_limit, select_lex->offset_limit);
|
||||
break;
|
||||
|
||||
case SQLCOM_BEGIN:
|
||||
if (thd->locked_tables)
|
||||
{
|
||||
thd->lock=thd->locked_tables;
|
||||
thd->locked_tables=0; // Will be automatically closed
|
||||
close_thread_tables(thd); // Free tables
|
||||
}
|
||||
if (end_active_trans(thd))
|
||||
goto error;
|
||||
else
|
||||
@ -3634,6 +3632,7 @@ create_error:
|
||||
!(res= ha_start_consistent_snapshot(thd)))
|
||||
send_ok(thd);
|
||||
}
|
||||
unlock_locked_tables(thd); // imply UNLOCK TABLES
|
||||
break;
|
||||
case SQLCOM_COMMIT:
|
||||
/*
|
||||
@ -3654,44 +3653,87 @@ create_error:
|
||||
}
|
||||
case SQLCOM_ROLLBACK:
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
if (!ha_rollback(thd))
|
||||
{
|
||||
/*
|
||||
If a non-transactional table was updated, warn; don't warn if this is a
|
||||
slave thread (because when a slave thread executes a ROLLBACK, it has
|
||||
been read from the binary log, so it's 100% sure and normal to produce
|
||||
error ER_WARNING_NOT_COMPLETE_ROLLBACK. If we sent the warning to the
|
||||
slave SQL thread, it would not stop the thread but just be printed in
|
||||
the error log; but we don't want users to wonder why they have this
|
||||
message in the error log, so we don't send it.
|
||||
*/
|
||||
if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && !thd->slave_thread)
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||
ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
|
||||
send_ok(thd);
|
||||
}
|
||||
else
|
||||
if (ha_rollback(thd))
|
||||
res= TRUE;
|
||||
else
|
||||
send_ok(thd);
|
||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
break;
|
||||
case SQLCOM_ROLLBACK_TO_SAVEPOINT:
|
||||
if (!ha_rollback_to_savepoint(thd, lex->savepoint_name))
|
||||
{
|
||||
SAVEPOINT **sv;
|
||||
for (sv=&thd->transaction.savepoints; *sv; sv=&(*sv)->prev)
|
||||
{
|
||||
if (my_strnncoll(system_charset_info,
|
||||
(uchar *)lex->ident.str, lex->ident.length,
|
||||
(uchar *)(*sv)->name, (*sv)->length) == 0)
|
||||
break;
|
||||
}
|
||||
if (*sv)
|
||||
{
|
||||
if (ha_rollback_to_savepoint(thd, *sv))
|
||||
res= TRUE; // cannot happen
|
||||
else
|
||||
{
|
||||
if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && !thd->slave_thread)
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||
ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
|
||||
send_ok(thd);
|
||||
}
|
||||
*sv= 0;
|
||||
}
|
||||
else
|
||||
goto error;
|
||||
{
|
||||
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "SAVEPOINT", lex->ident.str);
|
||||
res= TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SAVEPOINT:
|
||||
if (!ha_savepoint(thd, lex->savepoint_name))
|
||||
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
|
||||
!opt_using_transactions)
|
||||
send_ok(thd);
|
||||
else
|
||||
goto error;
|
||||
{
|
||||
SAVEPOINT **sv, *newsv;
|
||||
for (sv=&thd->transaction.savepoints; *sv; sv=&(*sv)->prev)
|
||||
{
|
||||
if (my_strnncoll(system_charset_info,
|
||||
(uchar *)lex->ident.str, lex->ident.length,
|
||||
(uchar *)(*sv)->name, (*sv)->length) == 0)
|
||||
break;
|
||||
}
|
||||
if (*sv) /* old savepoint of the same name exists */
|
||||
{
|
||||
newsv=*sv;
|
||||
ha_release_savepoint(thd, *sv); // it cannot fail
|
||||
*sv=(*sv)->prev;
|
||||
}
|
||||
else if ((newsv=(SAVEPOINT *) alloc_root(&thd->transaction.mem_root,
|
||||
savepoint_alloc_size)) == 0)
|
||||
{
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0));
|
||||
res= TRUE;
|
||||
break;
|
||||
}
|
||||
newsv->name=strmake_root(&thd->transaction.mem_root,
|
||||
lex->ident.str, lex->ident.length);
|
||||
newsv->length=lex->ident.length;
|
||||
/*
|
||||
if we'll get an error here, don't add new savepoint to the list.
|
||||
we'll lose a little bit of memory in transaction mem_root, but it'll
|
||||
be free'd when transaction ends anyway
|
||||
*/
|
||||
if (ha_savepoint(thd, newsv))
|
||||
res= TRUE;
|
||||
else
|
||||
{
|
||||
newsv->prev=thd->transaction.savepoints;
|
||||
thd->transaction.savepoints=newsv;
|
||||
send_ok(thd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SQLCOM_CREATE_PROCEDURE:
|
||||
case SQLCOM_CREATE_SPFUNCTION:
|
||||
@ -4013,7 +4055,156 @@ create_error:
|
||||
res= mysql_create_or_drop_trigger(thd, all_tables, 0);
|
||||
break;
|
||||
}
|
||||
default: /* Impossible */
|
||||
case SQLCOM_XA_START:
|
||||
res= FALSE;
|
||||
if (thd->transaction.xa_state == XA_IDLE && thd->lex->xa_opt == XA_RESUME)
|
||||
{
|
||||
if (! thd->transaction.xid.eq(&thd->lex->ident))
|
||||
{
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
break;
|
||||
}
|
||||
thd->transaction.xa_state=XA_ACTIVE;
|
||||
send_ok(thd);
|
||||
res=0;
|
||||
break;
|
||||
}
|
||||
if (thd->lex->ident.length > MAXGTRIDSIZE || thd->lex->xa_opt != XA_NONE)
|
||||
{ // JOIN is not supported yet. TODO
|
||||
my_error(ER_XAER_INVAL, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (thd->transaction.xa_state != XA_NOTR)
|
||||
{
|
||||
my_error(ER_XAER_RMFAIL, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (thd->active_transaction() || thd->locked_tables)
|
||||
{
|
||||
my_error(ER_XAER_OUTSIDE, MYF(0));
|
||||
break;
|
||||
}
|
||||
DBUG_ASSERT(thd->transaction.xid.is_null());
|
||||
thd->transaction.xa_state=XA_ACTIVE;
|
||||
thd->transaction.xid.set(&thd->lex->ident);
|
||||
thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
|
||||
OPTION_BEGIN);
|
||||
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
||||
send_ok(thd);
|
||||
res=0;
|
||||
break;
|
||||
case SQLCOM_XA_END:
|
||||
/* fake it */
|
||||
res= FALSE;
|
||||
if (thd->lex->xa_opt != XA_NONE)
|
||||
{ // SUSPEND and FOR MIGRATE are not supported yet. TODO
|
||||
my_error(ER_XAER_INVAL, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (thd->transaction.xa_state != XA_ACTIVE)
|
||||
{
|
||||
my_error(ER_XAER_RMFAIL, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (!thd->transaction.xid.eq(&thd->lex->ident))
|
||||
{
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
break;
|
||||
}
|
||||
thd->transaction.xa_state=XA_IDLE;
|
||||
send_ok(thd);
|
||||
res=0;
|
||||
break;
|
||||
case SQLCOM_XA_PREPARE:
|
||||
res= FALSE;
|
||||
if (thd->transaction.xa_state != XA_IDLE)
|
||||
{
|
||||
my_error(ER_XAER_RMFAIL, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (!thd->transaction.xid.eq(&thd->lex->ident))
|
||||
{
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (ha_prepare(thd))
|
||||
{
|
||||
my_error(ER_XA_RBROLLBACK, MYF(0));
|
||||
thd->transaction.xa_state=XA_NOTR;
|
||||
break;
|
||||
}
|
||||
res=0;
|
||||
thd->transaction.xa_state=XA_PREPARED;
|
||||
send_ok(thd);
|
||||
break;
|
||||
case SQLCOM_XA_COMMIT:
|
||||
if (!thd->transaction.xid.eq(&thd->lex->ident))
|
||||
{
|
||||
if (!(res= !ha_commit_or_rollback_by_xid(&thd->lex->ident, 1)))
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (thd->transaction.xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
|
||||
{
|
||||
if (res=ha_commit(thd))
|
||||
{
|
||||
my_error(res==1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0));
|
||||
res= FALSE;
|
||||
}
|
||||
else
|
||||
send_ok(thd);
|
||||
}
|
||||
else
|
||||
if (thd->transaction.xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE)
|
||||
{
|
||||
if (ha_commit_one_phase(thd, 1))
|
||||
{
|
||||
my_error(ER_XAER_RMERR, MYF(0));
|
||||
res= FALSE;
|
||||
}
|
||||
else
|
||||
send_ok(thd);
|
||||
}
|
||||
else
|
||||
{
|
||||
res= FALSE;
|
||||
my_error(ER_XAER_RMFAIL, MYF(0));
|
||||
break;
|
||||
}
|
||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
thd->transaction.xa_state=XA_NOTR;
|
||||
break;
|
||||
case SQLCOM_XA_ROLLBACK:
|
||||
if (!thd->transaction.xid.eq(&thd->lex->ident))
|
||||
{
|
||||
if (!(res= !ha_commit_or_rollback_by_xid(&thd->lex->ident, 0)))
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (thd->transaction.xa_state != XA_IDLE &&
|
||||
thd->transaction.xa_state != XA_PREPARED)
|
||||
{
|
||||
res= FALSE;
|
||||
my_error(ER_XAER_RMFAIL, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (ha_rollback(thd))
|
||||
{
|
||||
my_error(ER_XAER_RMERR, MYF(0));
|
||||
res= FALSE;
|
||||
}
|
||||
else
|
||||
send_ok(thd);
|
||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
thd->transaction.xa_state=XA_NOTR;
|
||||
break;
|
||||
case SQLCOM_XA_RECOVER:
|
||||
res= mysql_xa_recover(thd);
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0); /* Impossible */
|
||||
send_ok(thd);
|
||||
break;
|
||||
}
|
||||
@ -4048,20 +4239,8 @@ create_error:
|
||||
the statement is not DELETE, INSERT or UPDATE (or a CALL executing
|
||||
such a statement), but -1 is what JDBC and ODBC wants.
|
||||
*/
|
||||
switch (lex->sql_command) {
|
||||
case SQLCOM_UPDATE:
|
||||
case SQLCOM_UPDATE_MULTI:
|
||||
case SQLCOM_REPLACE:
|
||||
case SQLCOM_INSERT:
|
||||
case SQLCOM_REPLACE_SELECT:
|
||||
case SQLCOM_INSERT_SELECT:
|
||||
case SQLCOM_DELETE:
|
||||
case SQLCOM_DELETE_MULTI:
|
||||
case SQLCOM_CALL:
|
||||
break;
|
||||
default:
|
||||
if (lex->sql_command != SQLCOM_CALL && uc_update_queries[lex->sql_command]<2)
|
||||
thd->row_count_func= -1;
|
||||
}
|
||||
|
||||
DBUG_RETURN(res || thd->net.report_error);
|
||||
|
||||
@ -4830,17 +5009,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
||||
new_field->charset=cs;
|
||||
new_field->geom_type= (Field::geometry_type) uint_geom_type;
|
||||
|
||||
if (!comment)
|
||||
{
|
||||
new_field->comment.str=0;
|
||||
new_field->comment.length=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In this case comment is always of type Item_string */
|
||||
new_field->comment.str= (char*) comment->str;
|
||||
new_field->comment.length=comment->length;
|
||||
}
|
||||
new_field->comment=*comment;
|
||||
/*
|
||||
Set flag if this field doesn't have a default value
|
||||
Enum values has always the first value as a default (set in
|
||||
|
@ -26,27 +26,7 @@ int max_binlog_dump_events = 0; // unlimited
|
||||
my_bool opt_sporadic_binlog_dump_fail = 0;
|
||||
static int binlog_dump_count = 0;
|
||||
|
||||
int check_binlog_magic(IO_CACHE* log, const char** errmsg)
|
||||
{
|
||||
char magic[4];
|
||||
DBUG_ASSERT(my_b_tell(log) == 0);
|
||||
|
||||
if (my_b_read(log, (byte*) magic, sizeof(magic)))
|
||||
{
|
||||
*errmsg = "I/O error reading the header from the binary log";
|
||||
sql_print_error("%s, errno=%d, io cache code=%d", *errmsg, my_errno,
|
||||
log->error);
|
||||
return 1;
|
||||
}
|
||||
if (memcmp(magic, BINLOG_MAGIC, sizeof(magic)))
|
||||
{
|
||||
*errmsg = "Binlog has bad magic number; It's not a binary log file that can be used by this version of MySQL";
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
fake_rotate_event() builds a fake (=which does not exist physically in any
|
||||
binlog) Rotate event, which contains the name of the binlog we are going to
|
||||
send to the slave (because the slave may not know it if it just asked for
|
||||
@ -165,41 +145,6 @@ static int send_file(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
File open_binlog(IO_CACHE *log, const char *log_file_name,
|
||||
const char **errmsg)
|
||||
{
|
||||
File file;
|
||||
DBUG_ENTER("open_binlog");
|
||||
|
||||
if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
|
||||
{
|
||||
sql_print_error("Failed to open log (\
|
||||
file '%s', errno %d)", log_file_name, my_errno);
|
||||
*errmsg = "Could not open log file"; // This will not be sent
|
||||
goto err;
|
||||
}
|
||||
if (init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
|
||||
MYF(MY_WME | MY_DONT_CHECK_FILESIZE)))
|
||||
{
|
||||
sql_print_error("Failed to create a cache on log (\
|
||||
file '%s')", log_file_name);
|
||||
*errmsg = "Could not open log file"; // This will not be sent
|
||||
goto err;
|
||||
}
|
||||
if (check_binlog_magic(log,errmsg))
|
||||
goto err;
|
||||
DBUG_RETURN(file);
|
||||
|
||||
err:
|
||||
if (file >= 0)
|
||||
{
|
||||
my_close(file,MYF(0));
|
||||
end_io_cache(log);
|
||||
}
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Adjust the position pointer in the binary log file for all running slaves
|
||||
|
||||
@ -1289,7 +1234,7 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
|
||||
}
|
||||
|
||||
|
||||
bool show_binlog_events(THD* thd)
|
||||
bool mysql_show_binlog_events(THD* thd)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlog_events");
|
||||
|
@ -38,13 +38,10 @@ extern my_bool opt_sporadic_binlog_dump_fail;
|
||||
|
||||
#define KICK_SLAVE(thd) { pthread_mutex_lock(&(thd)->LOCK_delete); (thd)->awake(THD::NOT_KILLED); pthread_mutex_unlock(&(thd)->LOCK_delete); }
|
||||
|
||||
File open_binlog(IO_CACHE *log, const char *log_file_name,
|
||||
const char **errmsg);
|
||||
|
||||
int start_slave(THD* thd, MASTER_INFO* mi, bool net_report);
|
||||
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report);
|
||||
bool change_master(THD* thd, MASTER_INFO* mi);
|
||||
bool show_binlog_events(THD* thd);
|
||||
bool mysql_show_binlog_events(THD* thd);
|
||||
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
|
||||
const char* log_file_name2, ulonglong log_pos2);
|
||||
int reset_slave(THD *thd, MASTER_INFO* mi);
|
||||
|
@ -149,7 +149,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
|
||||
/* Let us check if trigger with the same name exists */
|
||||
while ((name= it++))
|
||||
{
|
||||
if (my_strcasecmp(system_charset_info, lex->name_and_length.str,
|
||||
if (my_strcasecmp(system_charset_info, lex->ident.str,
|
||||
name->str) == 0)
|
||||
{
|
||||
my_message(ER_TRG_ALREADY_EXISTS, ER(ER_TRG_ALREADY_EXISTS), MYF(0));
|
||||
@ -239,7 +239,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
it_def++;
|
||||
|
||||
if (my_strcasecmp(system_charset_info, lex->name_and_length.str,
|
||||
if (my_strcasecmp(system_charset_info, lex->ident.str,
|
||||
name->str) == 0)
|
||||
{
|
||||
/*
|
||||
@ -429,15 +429,15 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
|
||||
if (!(trg_name_buff= alloc_root(&table->mem_root,
|
||||
sizeof(LEX_STRING) +
|
||||
lex.name_and_length.length + 1)))
|
||||
lex.ident.length + 1)))
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
trg_name_str= (LEX_STRING *)trg_name_buff;
|
||||
trg_name_buff+= sizeof(LEX_STRING);
|
||||
memcpy(trg_name_buff, lex.name_and_length.str,
|
||||
lex.name_and_length.length + 1);
|
||||
memcpy(trg_name_buff, lex.ident.str,
|
||||
lex.ident.length + 1);
|
||||
trg_name_str->str= trg_name_buff;
|
||||
trg_name_str->length= lex.name_and_length.length;
|
||||
trg_name_str->length= lex.ident.length;
|
||||
|
||||
if (triggers->names_list.push_back(trg_name_str, &table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
|
1147
sql/sql_yacc.yy
1147
sql/sql_yacc.yy
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user