From 9f4c887bab038bb3454411a68b9d9684368c487e Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Mon, 18 Dec 2023 12:42:13 +0200 Subject: [PATCH 1/3] ApplySchema: log selected flags Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/cmd/vtctldclient/command/schema.go | 9 +++++++-- go/vt/vtctl/vtctl.go | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/go/cmd/vtctldclient/command/schema.go b/go/cmd/vtctldclient/command/schema.go index 2d31e3500c1..7a6f86179e7 100644 --- a/go/cmd/vtctldclient/command/schema.go +++ b/go/cmd/vtctldclient/command/schema.go @@ -27,6 +27,7 @@ import ( "vitess.io/vitess/go/cmd/vtctldclient/cli" "vitess.io/vitess/go/protoutil" + "vitess.io/vitess/go/vt/log" "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/schema" "vitess.io/vitess/go/vt/sqlparser" @@ -137,7 +138,7 @@ func commandApplySchema(cmd *cobra.Command, args []string) error { ks := cmd.Flags().Arg(0) - resp, err := client.ApplySchema(commandCtx, &vtctldatapb.ApplySchemaRequest{ + req := &vtctldatapb.ApplySchemaRequest{ Keyspace: ks, DdlStrategy: applySchemaOptions.DDLStrategy, Sql: parts, @@ -146,7 +147,11 @@ func commandApplySchema(cmd *cobra.Command, args []string) error { WaitReplicasTimeout: protoutil.DurationToProto(applySchemaOptions.WaitReplicasTimeout), CallerId: cid, BatchSize: applySchemaOptions.BatchSize, - }) + } + + log.Infof("Calling ApplySchema on VtctldServer: keyspace=%s, migrationContext=%v, ddlStrategy=%v, batchSize=%v", req.Keyspace, req.MigrationContext, req.DdlStrategy, req.BatchSize) + + resp, err := client.ApplySchema(commandCtx, req) if err != nil { return err } diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go index 96d8bf9e9be..4f41427cc5d 100644 --- a/go/vt/vtctl/vtctl.go +++ b/go/vt/vtctl/vtctl.go @@ -2926,7 +2926,7 @@ func commandApplySchema(ctx context.Context, wr *wrangler.Wrangler, subFlags *pf return err } - log.Info("Calling ApplySchema on VtctldServer") + log.Infof("Calling ApplySchema on VtctldServer: keyspace=%s, migrationContext=%v, ddlStrategy=%v, batchSize=%v", keyspace, *migrationContext, *ddlStrategy, *batchSize) resp, err := wr.VtctldServer().ApplySchema(ctx, &vtctldatapb.ApplySchemaRequest{ Keyspace: keyspace, @@ -3068,7 +3068,7 @@ func commandOnlineDDL(ctx context.Context, wr *wrangler.Wrangler, subFlags *pfla } if applySchemaQuery != "" { - log.Info("Calling ApplySchema on VtctldServer") + log.Infof("Calling ApplySchema on VtctldServer: keyspace=%s", keyspace) resp, err := wr.VtctldServer().ApplySchema(ctx, &vtctldatapb.ApplySchemaRequest{ Keyspace: keyspace, From 1650c39516e696bd25f1f892304f13ed6379e7e6 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Mon, 18 Dec 2023 13:30:04 +0200 Subject: [PATCH 2/3] logging from inside VtctldServer.ApplySchema Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vtctl/grpcvtctldserver/server.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index b0b7bd370f7..722f56d56a1 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -221,6 +221,8 @@ func (s *VtctldServer) ApplyShardRoutingRules(ctx context.Context, req *vtctldat // ApplySchema is part of the vtctlservicepb.VtctldServer interface. func (s *VtctldServer) ApplySchema(ctx context.Context, req *vtctldatapb.ApplySchemaRequest) (resp *vtctldatapb.ApplySchemaResponse, err error) { + log.Infof("VtctldServer.ApplySchema: keyspace=%s, migrationContext=%v, ddlStrategy=%v, batchSize=%v", req.Keyspace, req.MigrationContext, req.DdlStrategy, req.BatchSize) + span, ctx := trace.NewSpan(ctx, "VtctldServer.ApplySchema") defer span.Finish() From 33581e74a6d592ebee5abeda989e59c68b9796bf Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Mon, 18 Dec 2023 13:30:43 +0200 Subject: [PATCH 3/3] reverting original commits Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/cmd/vtctldclient/command/schema.go | 9 ++------- go/vt/vtctl/vtctl.go | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/go/cmd/vtctldclient/command/schema.go b/go/cmd/vtctldclient/command/schema.go index 7a6f86179e7..2d31e3500c1 100644 --- a/go/cmd/vtctldclient/command/schema.go +++ b/go/cmd/vtctldclient/command/schema.go @@ -27,7 +27,6 @@ import ( "vitess.io/vitess/go/cmd/vtctldclient/cli" "vitess.io/vitess/go/protoutil" - "vitess.io/vitess/go/vt/log" "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/schema" "vitess.io/vitess/go/vt/sqlparser" @@ -138,7 +137,7 @@ func commandApplySchema(cmd *cobra.Command, args []string) error { ks := cmd.Flags().Arg(0) - req := &vtctldatapb.ApplySchemaRequest{ + resp, err := client.ApplySchema(commandCtx, &vtctldatapb.ApplySchemaRequest{ Keyspace: ks, DdlStrategy: applySchemaOptions.DDLStrategy, Sql: parts, @@ -147,11 +146,7 @@ func commandApplySchema(cmd *cobra.Command, args []string) error { WaitReplicasTimeout: protoutil.DurationToProto(applySchemaOptions.WaitReplicasTimeout), CallerId: cid, BatchSize: applySchemaOptions.BatchSize, - } - - log.Infof("Calling ApplySchema on VtctldServer: keyspace=%s, migrationContext=%v, ddlStrategy=%v, batchSize=%v", req.Keyspace, req.MigrationContext, req.DdlStrategy, req.BatchSize) - - resp, err := client.ApplySchema(commandCtx, req) + }) if err != nil { return err } diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go index 4f41427cc5d..96d8bf9e9be 100644 --- a/go/vt/vtctl/vtctl.go +++ b/go/vt/vtctl/vtctl.go @@ -2926,7 +2926,7 @@ func commandApplySchema(ctx context.Context, wr *wrangler.Wrangler, subFlags *pf return err } - log.Infof("Calling ApplySchema on VtctldServer: keyspace=%s, migrationContext=%v, ddlStrategy=%v, batchSize=%v", keyspace, *migrationContext, *ddlStrategy, *batchSize) + log.Info("Calling ApplySchema on VtctldServer") resp, err := wr.VtctldServer().ApplySchema(ctx, &vtctldatapb.ApplySchemaRequest{ Keyspace: keyspace, @@ -3068,7 +3068,7 @@ func commandOnlineDDL(ctx context.Context, wr *wrangler.Wrangler, subFlags *pfla } if applySchemaQuery != "" { - log.Infof("Calling ApplySchema on VtctldServer: keyspace=%s", keyspace) + log.Info("Calling ApplySchema on VtctldServer") resp, err := wr.VtctldServer().ApplySchema(ctx, &vtctldatapb.ApplySchemaRequest{ Keyspace: keyspace,