[MDEV-11798] gtid function BINLOG_GTID_POS Created: 2017-01-15  Updated: 2017-01-16  Resolved: 2017-01-16

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.2.3
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: jinlong.cai Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: replication
Environment:

mariadb-10.2.3



 Description   

When we use BINLOG_GTID_POS to get gtid from binlog file/position ,it call the function to get gtid(in sql_repl.cc):

    gtid_state_from_pos:
             .......
            if ({color:red}gtid_state->load((const rpl_gtid *)NULL, 0){color})
            {
             errormsg= "Internal error (out of memory?) initializing slave state "
            "while scanning binlog to find start position";
             return errormsg;
             }

But ,the function gtid_state->load((const rpl_gtid *)NULL, 0) is always true (because count==0):

          int   slave_connection_state::load(const rpl_gtid *gtid_list, uint32 count)
          {
            uint32 i; 
            reset();
            for (i= 0; i < count; ++i)
                if (update(&gtid_list[i]))
                    return 1;
          return 0;
          }

Why we need this ??



 Comments   
Comment by jinlong.cai [ 2017-01-15 ]

I think if you want reset binlog state,why you don't call reset function directly ??

Comment by Elena Stepanova [ 2017-01-16 ]

knielsen, would you want to handle this?

Comment by Kristian Nielsen [ 2017-01-16 ]

My guess is that this is just for consistency with the
gtid_state->load(gtid_list, list_len) call done later in the loop for
GTID_LIST_EVENT. Start by loading the empty state, and then when the
GTID_LIST_EVENT is found, load those GTIDs on top.

It's just a matter of style. As you say, just calling reset() would be
equivalent.

  • Kristian.
Generated at Thu Feb 08 07:52:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.