From 4a0aa63ea529015e960ac8e1a057dcac4ee01489 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 15 Nov 2023 19:22:39 +0200 Subject: [PATCH] MysqlCtl: implement missing `ReadBinlogFilesTimestamps` function (#14525) Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/test/endtoend/mysqlctld/mysqlctld_test.go | 8 ++++++++ go/vt/mysqlctl/grpcmysqlctlserver/server.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/go/test/endtoend/mysqlctld/mysqlctld_test.go b/go/test/endtoend/mysqlctld/mysqlctld_test.go index 908a870d6f0..e1577acfc52 100644 --- a/go/test/endtoend/mysqlctld/mysqlctld_test.go +++ b/go/test/endtoend/mysqlctld/mysqlctld_test.go @@ -28,6 +28,7 @@ import ( "vitess.io/vitess/go/constants/sidecar" "vitess.io/vitess/go/vt/mysqlctl/mysqlctlclient" + "vitess.io/vitess/go/vt/proto/mysqlctl" "vitess.io/vitess/go/test/endtoend/cluster" ) @@ -169,3 +170,10 @@ func TestVersionString(t *testing.T) { require.NoError(t, err) require.NotEmpty(t, version) } + +func TestReadBinlogFilesTimestamps(t *testing.T) { + client, err := mysqlctlclient.New("unix", primaryTablet.MysqlctldProcess.SocketFile) + require.NoError(t, err) + _, err = client.ReadBinlogFilesTimestamps(context.Background(), &mysqlctl.ReadBinlogFilesTimestampsRequest{}) + require.ErrorContains(t, err, "empty binlog list in ReadBinlogFilesTimestampsRequest") +} diff --git a/go/vt/mysqlctl/grpcmysqlctlserver/server.go b/go/vt/mysqlctl/grpcmysqlctlserver/server.go index 84953020534..ac3b5092f19 100644 --- a/go/vt/mysqlctl/grpcmysqlctlserver/server.go +++ b/go/vt/mysqlctl/grpcmysqlctlserver/server.go @@ -56,6 +56,11 @@ func (s *server) ApplyBinlogFile(ctx context.Context, request *mysqlctlpb.ApplyB return &mysqlctlpb.ApplyBinlogFileResponse{}, s.mysqld.ApplyBinlogFile(ctx, request) } +// ReadBinlogFilesTimestamps implements the server side of the MysqlctlClient interface. +func (s *server) ReadBinlogFilesTimestamps(ctx context.Context, request *mysqlctlpb.ReadBinlogFilesTimestampsRequest) (*mysqlctlpb.ReadBinlogFilesTimestampsResponse, error) { + return s.mysqld.ReadBinlogFilesTimestamps(ctx, request) +} + // ReinitConfig implements the server side of the MysqlctlClient interface. func (s *server) ReinitConfig(ctx context.Context, request *mysqlctlpb.ReinitConfigRequest) (*mysqlctlpb.ReinitConfigResponse, error) { return &mysqlctlpb.ReinitConfigResponse{}, s.mysqld.ReinitConfig(ctx, s.cnf)