Skip to content

Commit

Permalink
Add getters to BinlogSyncer for the previous GTID set, the current GT…
Browse files Browse the repository at this point in the history
…ID, if it's running and the last connection id
  • Loading branch information
Dylan Terry committed Sep 11, 2024
1 parent 3a665d0 commit 3ea0579
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions replication/binlogsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -918,3 +918,31 @@ func (b *BinlogSyncer) killConnection(conn *client.Conn, id uint32) {
}
b.cfg.Logger.Infof("kill last connection id %d", id)
}

// GetPrevGset returns the previous GTID set.
func (b *BinlogSyncer) GetPrevGset() GTIDSet {
b.m.RLock()
defer b.m.RUnlock()
return b.prevGset
}

// GetCurrGset returns the current GTID set.
func (b *BinlogSyncer) GetCurrGset() GTIDSet {
b.m.RLock()
defer b.m.RUnlock()
return b.currGset
}

// IsRunning returns whether the BinlogSyncer is running.
func (b *BinlogSyncer) IsRunning() bool {
b.m.RLock()
defer b.m.RUnlock()
return b.running
}

// GetLastConnectionID returns the last connection ID.
func (b *BinlogSyncer) GetLastConnectionID() uint32 {
b.m.RLock()
defer b.m.RUnlock()
return b.lastConnectionID
}

0 comments on commit 3ea0579

Please sign in to comment.