zkfan / tungsten-replicator

Automatically exported from code.google.com/p/tungsten-replicator
0 stars 0 forks source link

MySQL extractor fails to extract server_id value from first transaction in new binlog file #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The MySQL extractor on occasion fails to set the server_id value correctly.  
When this occurs, you will see a transaction that looks like the following: 

SEQ# = 5133442 / FRAG# = 0 (last frag)
- TIME = 2011-06-06 18:44:49.0
- EVENTID = 000856:0000000000002728;12685900
- SOURCEID = db1
- STATUS = COMPLETED(2)
- METADATA = [mysql_server_id=0;service=db1;shard=test5]
- TYPE = com.continuent.tungsten.replicator.event.ReplDBMSEvent
- OPTIONS = [##charset = ISO8859_1, autocommit = 1, sql_auto_is_null = 1, 
foreign_key_checks = 1, unique_checks = 1, sql_mode = 'STRICT_TRANS_TABLES', 
character_set_client = 8, collation_connection = 8, collation_server = 8]
- SCHEMA = test5
- SQL(0) = etc.

However, the binlog clearly shows the server ID, as shown by the following 
example:  

/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#110606 18:44:49 server id 21901  end_log_pos 98    Start: binlog v 4, serve
r v 5.0.91-community-log created 110606 18:44:49
# at 98
#110606 18:44:49 server id 8201  end_log_pos 157    Query   thread_id=126859
00  exec_time=0 error_code=0
SET TIMESTAMP=1307411089/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
ue_checks=1/*!*/;
SET @@session.sql_mode=2097152/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.
collation_server=8/*!*/;
BEGIN
/*!*/;
# at 157
#110606 18:44:49 server id 8201  end_log_pos 459    Query   thread_id=126859
00  exec_time=0 error_code=0
use test5/*!*/;
SET TIMESTAMP=1307411089/*!*/;
[...sql...]
/*!*/;
[...omitted transactions...]
# at 2701
#110606 18:44:49 server id 8201  end_log_pos 2728   Xid = 533571647
COMMIT/*!*/;

It looks as if we may be misinterpreting the server ID on the first transaction 
in the binlog.  

Original issue reported on code.google.com by berkeley...@gmail.com on 9 Jun 2011 at 9:56

GoogleCodeExporter commented 9 years ago
There is a simple way to reproduce this problem. 

1. Login to MySQL and issue FLUSH LOGS to rotate to next binlog. 
2. Issue 'trepctl heartbeat' command to create a transaction in the log. 
3. List the log.  The heartbeat transaction will have mysql_server_id=0 in the 
binlog. 

If you issue additional heartbeats they will have the correct server ID. 

Original comment by berkeley...@gmail.com on 9 Jun 2011 at 10:02

GoogleCodeExporter commented 9 years ago

Original comment by berkeley...@gmail.com on 12 Jun 2011 at 1:51

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r288.

Original comment by stephane...@gtempaccount.com on 4 Jul 2011 at 9:16