Skip to content

Commit 1d0cade

Browse files
committed
Refining the BinlogPrimaryController interface docs
1 parent 940c0e4 commit 1d0cade

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

sql/binlogreplication/binlog_replication.go

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,38 @@ type BinlogReplicaController interface {
6464
ResetReplica(ctx *sql.Context, resetAll bool) error
6565
}
6666

67-
// BinlogPrimaryController allows GMS to coordinate with a binlog primary server. Providers built on go-mysql-server may
68-
// optionally implement this interface and use it when constructing a SQL engine in order to receive callbacks when
69-
// replication statements for a primary server are received (e.g. SHOW BINARY LOG STATUS) or when MySQL protocol
70-
// commands related to replication are received (e.g. COM_REGISTER_REPLICA).
67+
// BinlogPrimaryController allows an integrator to extend GMS with support for operating as a binlog primary server.
68+
// Providers built on go-mysql-server may optionally implement this interface and use it when constructing a SQL
69+
// engine in order to receive callbacks when replication statements for a primary server are received
70+
// (e.g. SHOW BINARY LOG STATUS) or when MySQL protocol commands related to replication are received
71+
// (e.g. COM_REGISTER_REPLICA).
7172
type BinlogPrimaryController interface {
7273
// RegisterReplica tells the binlog primary controller to register a new replica on connection |c| with the
7374
// primary server. |replicaHost| and |replicaPort| specify where the replica can be accessed, and are returned
74-
// from the SHOW REPLICAS statement.
75+
// from the SHOW REPLICAS statement. Integrators should return from this method as soon as the replica is
76+
// registered.
7577
RegisterReplica(ctx *sql.Context, c *mysql.Conn, replicaHost string, replicaPort uint16) error
7678

77-
// BinlogDumpGtid tells the binlog primary controller to start streaming binlog events to the replica over
78-
// connection |c|. |gtidSet| specifies the point at which to start replication, or if it is nil, then it indicates
79-
// the complete history of all transactions should be sent over the connection.
79+
// BinlogDumpGtid tells this binlog primary controller to start streaming binlog events to the replica over the
80+
// current connection, |c|. |gtidSet| specifies the point at which to start replication, or if it is nil, then
81+
// it indicates the complete history of all transactions should be sent over the connection. Note that unlike
82+
// other methods, this method does NOT return immediately (unless an error is encountered) – the connection is
83+
// left open for the duration of the replication stream, which could be days, or longer.
8084
BinlogDumpGtid(ctx *sql.Context, c *mysql.Conn, gtidSet mysql.GTIDSet) error
8185

82-
// ListReplicas is called when the SHOW REPLICAS statement is executed.
86+
// ListReplicas is called when the SHOW REPLICAS statement is executed. The integrator should return a list
87+
// of all registered replicas who are healthy and still responsive. Note that this function will be expanded
88+
// with an additional response parameter once it is wired up to the SQL engine.
8389
ListReplicas(ctx *sql.Context) error
8490

85-
// ListBinaryLogs is called when the SHOW BINARY LOGS statement is executed.
91+
// ListBinaryLogs is called when the SHOW BINARY LOGS statement is executed. The integrator should return a list
92+
// of the binary logs currently being managed. Note that this function will be expanded
93+
// with an additional response parameter once it is wired up to the SQL engine.
8694
ListBinaryLogs(ctx *sql.Context) error
8795

88-
// GetBinaryLogStatus is called when the SHOW BINARY LOG STATUS statement is executed.
96+
// GetBinaryLogStatus is called when the SHOW BINARY LOG STATUS statement is executed. The integrator should return
97+
// the current status of the binary log. Note that this function will be expanded
98+
// with an additional response parameter once it is wired up to the SQL engine.
8999
GetBinaryLogStatus(ctx *sql.Context) error
90100
}
91101

0 commit comments

Comments
 (0)