⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
server
/
mysql
/
mysql-test
/
suite
/
ndb_binlog
/
r
/
View File Name :
ndb_binlog_flush_tables_with_read_lock.result
reset master; reset master; Initial setup Create some tables and put some data in them use test; create table test.ndbt1 (a int primary key, b int) engine=ndb; create table test.myisamt3s1 (a int primary key, b int) engine=myisam; create table test.myisamt3s2 (a int primary key, b int) engine=myisam; insert into ndbt1 values (1,1); Show + reset Binlog contents on Server 1 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # use `test`; create table test.ndbt1 (a int primary key, b int) engine=ndb mysqld-bin.000001 # Query # # use `test`; create table test.myisamt3s1 (a int primary key, b int) engine=myisam mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.ndbt1) mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT reset master; Show + reset Binlog contents on Server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # use `test`; create table test.ndbt1 (a int primary key, b int) engine=ndb mysqld-bin.000001 # Query # # use `test`; create table test.myisamt3s2 (a int primary key, b int) engine=myisam mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.ndbt1) mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT reset master; Now perform MyIsam table change followed by flush tables with read lock on Server 1 insert into test.myisamt3s1 values (3,3); FLUSH TABLES WITH READ LOCK; The MyIsam change definitely will be in the local binlog as it occurred 'before' the lock include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.myisamt3s1) mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT Show that Ndb and local tables are still Read-Write from Server2 use test; insert into ndbt1 values (4,4); Look at the Binlog events on Server 2 - contains rows written at Server2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.ndbt1) mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT insert into myisamt3s2 values (5,5); Look at the Binlog events on Server 2 - contains rows written at Server2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.ndbt1) mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.myisamt3s2) mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT Now look at the Binlog events on Server 1 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.myisamt3s1) mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT Now remove the read lock at server 1 unlock tables; Local event to ensure show binlog events sees 'latest' binlog insert into ndbt1 values (6,6); Show that server 1 binlog now contains all the relevant events. include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.myisamt3s1) mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.ndbt1) mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT mysqld-bin.000001 # Query # # BEGIN mysqld-bin.000001 # Table_map # # table_id: # (test.ndbt1) mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows # # table_id: # mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query # # COMMIT Reset both binlogs; reset master; reset master; Now show that a Server 1 Ndb update can be committed, but won't always make it to the Binlog This is not 100% guaranteed as in theory a commit can occur, and be Binlogged before the read lock stops the binlog injector. but in reality its very likely To remove any uncertainty we loop until we see a case where a committed ndb insert is not binlogged by the server. We do this work on Server2 as it doesn't have a read lock :) create table ndbt2 (a int primary key, b varchar(100)) engine=ndb; Outcome Server 1 has insert : 0 Server 2 has insert : 1 Now cleanup drop table ndbt1; drop table ndbt2; drop table myisamt3s1; drop table myisamt3s2;