From 2692bb195b2d2ccdea52cf8b9f2b56f931cff878 Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Thu, 31 Oct 2024 13:53:31 +0100 Subject: [PATCH] print more Signed-off-by: Andres Taylor --- go/test/endtoend/cluster/cluster_process.go | 62 +++++++++---------- go/test/endtoend/cluster/mysqlctl_process.go | 2 +- go/test/endtoend/cluster/mysqlctld_process.go | 2 +- go/test/endtoend/cluster/topo_process.go | 16 ++--- go/test/endtoend/cluster/vtctl_process.go | 2 +- go/test/endtoend/cluster/vtctld_process.go | 4 +- .../endtoend/cluster/vtctldclient_process.go | 2 +- go/test/endtoend/cluster/vtgate_process.go | 2 +- go/test/endtoend/cluster/vtorc_process.go | 4 +- go/test/endtoend/cluster/vttablet_process.go | 2 +- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index ea7abdf6ef6..f120b84c7f7 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -251,7 +251,7 @@ func (cluster *LocalProcessCluster) StartTopo() (err error) { cluster.VtctlProcess = *VtctlProcessInstance(cluster.TopoProcess.Port, cluster.Hostname) if !cluster.ReusingVTDATAROOT { if err = cluster.VtctlProcess.AddCellInfo(cluster.Cell); err != nil { - log.Error(err) + log.Error(err.Error()) return } cluster.VtctlProcess.LogDir = cluster.TmpDirectory @@ -409,7 +409,7 @@ func (cluster *LocalProcessCluster) startKeyspace(keyspace Keyspace, shardNames // Apply Schema SQL if keyspace.SchemaSQL != "" { if err = cluster.VtctldClientProcess.ApplySchema(keyspace.Name, keyspace.SchemaSQL); err != nil { - log.Errorf("error applying schema: %v, %v", keyspace.SchemaSQL, err) + log.Errorf("error applying schema: %v, %v", keyspace.SchemaSQL, err.Error()) return } } @@ -417,7 +417,7 @@ func (cluster *LocalProcessCluster) startKeyspace(keyspace Keyspace, shardNames // Apply VSchema if keyspace.VSchema != "" { if err = cluster.VtctldClientProcess.ApplyVSchema(keyspace.Name, keyspace.VSchema); err != nil { - log.Errorf("error applying vschema: %v, %v", keyspace.VSchema, err) + log.Errorf("error applying vschema: %v, %v", keyspace.VSchema, err.Error()) return } } @@ -426,7 +426,7 @@ func (cluster *LocalProcessCluster) startKeyspace(keyspace Keyspace, shardNames err = cluster.StartVTOrc(keyspace.Name) if err != nil { - log.Errorf("Error starting VTOrc - %v", err) + log.Errorf("Error starting VTOrc - %v", err.Error()) return err } } @@ -471,7 +471,7 @@ func (cluster *LocalProcessCluster) AddShard(keyspaceName string, shardName stri tablet.MysqlctlProcess = *mysqlctlProcess proc, err := tablet.MysqlctlProcess.StartProcess() if err != nil { - log.Errorf("error starting mysqlctl process: %v, %v", tablet.MysqlctldProcess, err) + log.Errorf("error starting mysqlctl process: %v, %v", tablet.MysqlctldProcess, err.Error()) return nil, err } mysqlctlProcessList = append(mysqlctlProcessList, proc) @@ -515,7 +515,7 @@ func (cluster *LocalProcessCluster) AddShard(keyspaceName string, shardName stri // wait till all mysqlctl is instantiated for _, proc := range mysqlctlProcessList { if err := proc.wait(); err != nil { - log.Errorf("unable to start mysql process %v: %v", proc, err) + log.Errorf("unable to start mysql process\n%v\n%s", proc.proc.String(), err.Error()) return nil, err } } @@ -523,14 +523,14 @@ func (cluster *LocalProcessCluster) AddShard(keyspaceName string, shardName stri log.Infof("Starting vttablet for tablet uid %d, grpc port %d", tablet.TabletUID, tablet.GrpcPort) if err := tablet.VttabletProcess.Setup(); err != nil { - log.Errorf("error starting vttablet for tablet uid %d, grpc port %d: %v", tablet.TabletUID, tablet.GrpcPort, err) + log.Errorf("error starting vttablet for tablet uid %d, grpc port %d: %w", tablet.TabletUID, tablet.GrpcPort, err.Error()) return nil, err } } // Make first tablet as primary if err := cluster.VtctldClientProcess.InitializeShard(keyspaceName, shardName, cluster.Cell, shard.Vttablets[0].TabletUID); err != nil { - log.Errorf("error running InitializeShard on keyspace %v, shard %v: %v", keyspaceName, shardName, err) + log.Errorf("error running InitializeShard on keyspace %v, shard %v: %v", keyspaceName, shardName, err.Error()) return nil, err } return shard, nil @@ -592,7 +592,7 @@ func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shard tablet.MysqlctlProcess = *mysqlctlProcess proc, err := tablet.MysqlctlProcess.StartProcess() if err != nil { - log.Errorf("error starting mysqlctl process: %v, %v", tablet.MysqlctldProcess, err) + log.Errorf("error starting mysqlctl process: %v, %v", tablet.MysqlctldProcess, err.Error()) return err } mysqlctlProcessList = append(mysqlctlProcessList, proc) @@ -630,14 +630,14 @@ func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shard // wait till all mysqlctl is instantiated for _, proc := range mysqlctlProcessList { if err = proc.wait(); err != nil { - log.Errorf("unable to start mysql process %v: %v", proc, err) + log.Errorf("unable to start mysql process %v: %v", proc, err.Error()) return err } } for _, tablet := range shard.Vttablets { if !cluster.ReusingVTDATAROOT { if _, err = tablet.VttabletProcess.QueryTablet(fmt.Sprintf("create database vt_%s", keyspace.Name), keyspace.Name, false); err != nil { - log.Errorf("error creating database for keyspace %v: %v", keyspace.Name, err) + log.Errorf("error creating database for keyspace %v: %v", keyspace.Name, err.Error()) return } } @@ -645,14 +645,14 @@ func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shard log.Infof("Starting vttablet for tablet uid %d, grpc port %d", tablet.TabletUID, tablet.GrpcPort) if err = tablet.VttabletProcess.Setup(); err != nil { - log.Errorf("error starting vttablet for tablet uid %d, grpc port %d: %v", tablet.TabletUID, tablet.GrpcPort, err) + log.Errorf("error starting vttablet for tablet uid %d, grpc port %d: %v", tablet.TabletUID, tablet.GrpcPort, err.Error()) return } } // Make first tablet as primary if err = cluster.VtctldClientProcess.InitShardPrimary(keyspace.Name, shardName, cluster.Cell, shard.Vttablets[0].TabletUID); err != nil { - log.Errorf("error running ISM on keyspace %v, shard %v: %v", keyspace.Name, shardName, err) + log.Errorf("error running ISM on keyspace %v, shard %v: %v", keyspace.Name, shardName, err.Error()) return } keyspace.Shards = append(keyspace.Shards, *shard) @@ -672,7 +672,7 @@ func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shard // Apply Schema SQL if keyspace.SchemaSQL != "" { if err = cluster.VtctldClientProcess.ApplySchema(keyspace.Name, keyspace.SchemaSQL); err != nil { - log.Errorf("error applying schema: %v, %v", keyspace.SchemaSQL, err) + log.Errorf("error applying schema: %v, %v", keyspace.SchemaSQL, err.Error()) return } } @@ -680,7 +680,7 @@ func (cluster *LocalProcessCluster) StartKeyspaceLegacy(keyspace Keyspace, shard // Apply VSchema if keyspace.VSchema != "" { if err = cluster.VtctldClientProcess.ApplyVSchema(keyspace.Name, keyspace.VSchema); err != nil { - log.Errorf("error applying vschema: %v, %v", keyspace.VSchema, err) + log.Errorf("error applying vschema: %v, %v", keyspace.VSchema, err.Error()) return } } @@ -704,7 +704,7 @@ func (cluster *LocalProcessCluster) SetupCluster(keyspace *Keyspace, shards []Sh // Create Keyspace err = cluster.VtctlProcess.CreateKeyspace(keyspace.Name, keyspace.SidecarDBName, keyspace.DurabilityPolicy) if err != nil { - log.Error(err) + log.Error(err.Error()) return } } @@ -818,7 +818,7 @@ func NewCluster(cell string, hostname string) *LocalProcessCluster { err := cluster.populateVersionInfo() if err != nil { - log.Errorf("Error populating version information - %v", err) + log.Errorf("Error populating version information - %v", err.Error()) } return cluster } @@ -853,12 +853,12 @@ func GetMajorVersion(binaryName string) (int, error) { func (cluster *LocalProcessCluster) RestartVtgate() (err error) { err = cluster.VtgateProcess.TearDown() if err != nil { - log.Errorf("error stopping vtgate %v: %v", cluster.VtgateProcess, err) + log.Errorf("error stopping vtgate %v: %v", cluster.VtgateProcess, err.Error()) return } err = cluster.StartVtgate() if err != nil { - log.Errorf("error starting vtgate %v: %v", cluster.VtgateProcess, err) + log.Errorf("error starting vtgate %v: %v", cluster.VtgateProcess, err.Error()) return } return err @@ -930,7 +930,7 @@ func (cluster *LocalProcessCluster) ExecOnTablet(ctx context.Context, vttablet * return nil, err } - conn, err := tabletconn.GetDialer()(ctx, tablet, grpcclient.FailFast(false)) + conn, err := tabletconn.GetDialer()(ctx, tablet, false) if err != nil { return nil, err } @@ -1052,12 +1052,12 @@ func (cluster *LocalProcessCluster) Teardown() { cluster.CancelFunc() } if err := cluster.VtgateProcess.TearDown(); err != nil { - log.Errorf("Error in vtgate teardown: %v", err) + log.Errorf("Error in vtgate teardown: %v", err.Error()) } for _, vtorcProcess := range cluster.VTOrcProcesses { if err := vtorcProcess.TearDown(); err != nil { - log.Errorf("Error in vtorc teardown: %v", err) + log.Errorf("Error in vtorc teardown: %v", err.Error()) } } @@ -1068,7 +1068,7 @@ func (cluster *LocalProcessCluster) Teardown() { for _, tablet := range shard.Vttablets { if tablet.MysqlctlProcess.TabletUID > 0 { if proc, err := tablet.MysqlctlProcess.StopProcess(); err != nil { - log.Errorf("Error in mysqlctl teardown: %v", err) + log.Errorf("Error in mysqlctl teardown: %v", err.Error()) } else { mysqlctlProcessList = append(mysqlctlProcessList, proc) mysqlctlTabletUIDs = append(mysqlctlTabletUIDs, tablet.MysqlctlProcess.TabletUID) @@ -1076,12 +1076,12 @@ func (cluster *LocalProcessCluster) Teardown() { } if tablet.MysqlctldProcess.TabletUID > 0 { if err := tablet.MysqlctldProcess.Stop(); err != nil { - log.Errorf("Error in mysqlctl teardown: %v", err) + log.Errorf("Error in mysqlctl teardown: %v", err.Error()) } } if err := tablet.VttabletProcess.TearDown(); err != nil { - log.Errorf("Error in vttablet teardown: %v", err) + log.Errorf("Error in vttablet teardown: %v", err.Error()) } } } @@ -1094,11 +1094,11 @@ func (cluster *LocalProcessCluster) Teardown() { cluster.waitForMySQLProcessToExit(mysqlctlProcessList, mysqlctlTabletUIDs) if err := cluster.VtctldProcess.TearDown(); err != nil { - log.Errorf("Error in vtctld teardown: %v", err) + log.Errorf("Error in vtctld teardown: %v", err.Error()) } if err := cluster.TopoProcess.TearDown(cluster.Cell, cluster.OriginalVTDATAROOT, cluster.CurrentVTDATAROOT, *keepData, *topoFlavor); err != nil { - log.Errorf("Error in topo server teardown: %v", err) + log.Errorf("Error in topo server teardown: %v", err.Error()) } // reset the VTDATAROOT path. @@ -1126,7 +1126,7 @@ func (cluster *LocalProcessCluster) waitForMySQLProcessToExit(mysqlctlProcessLis if err == nil { return } - log.Errorf("Error in mysqlctl teardown wait: %v", err) + log.Errorf("Error in mysqlctl teardown wait: %v", err.Error()) break } pidFile := path.Join(os.Getenv("VTDATAROOT"), fmt.Sprintf("/vt_%010d/mysql.pid", tabletUID)) @@ -1138,12 +1138,12 @@ func (cluster *LocalProcessCluster) waitForMySQLProcessToExit(mysqlctlProcessLis } pid, err := strconv.Atoi(strings.TrimSpace(string(pidBytes))) if err != nil { - log.Errorf("Error in conversion to integer: %v", err) + log.Errorf("Error in conversion to integer: %v", err.Error()) return } err = syscallutil.Kill(pid, syscall.SIGKILL) if err != nil { - log.Errorf("Error in killing process: %v", err) + log.Errorf("Error in killing process: %v", err.Error()) } }(cmd, mysqlctlTabletUIDs[i]) } @@ -1185,7 +1185,7 @@ func (cluster *LocalProcessCluster) GetAndReservePort() int { ln, err := net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(cluster.nextPortForProcess))) if err != nil { - log.Errorf("Can't listen on port %v: %s, trying next port", cluster.nextPortForProcess, err) + log.Errorf("Can't listen on port %v: %s, trying next port", cluster.nextPortForProcess, err.Error()) continue } diff --git a/go/test/endtoend/cluster/mysqlctl_process.go b/go/test/endtoend/cluster/mysqlctl_process.go index 895f3fb1b34..0173ff11f47 100644 --- a/go/test/endtoend/cluster/mysqlctl_process.go +++ b/go/test/endtoend/cluster/mysqlctl_process.go @@ -132,7 +132,7 @@ func (mysqlctl *MysqlctlProcess) startProcess(init bool) (*processInfo, error) { extraMyCNF := path.Join(sslPath, "ssl.cnf") fout, err := os.Create(extraMyCNF) if err != nil { - log.Error(err) + log.Error(err.Error()) return nil, err } diff --git a/go/test/endtoend/cluster/mysqlctld_process.go b/go/test/endtoend/cluster/mysqlctld_process.go index 105220cdcdd..9f6988fff1c 100644 --- a/go/test/endtoend/cluster/mysqlctld_process.go +++ b/go/test/endtoend/cluster/mysqlctld_process.go @@ -93,7 +93,7 @@ func (mysqlctld *MysqlctldProcess) Start() error { err := os.MkdirAll(mysqlctld.LogDirectory, 0755) if err != nil { - log.Errorf("Failed to create directory for mysqlctld logs: %v", err) + log.Errorf("Failed to create directory for mysqlctld logs: %v", err.Error()) return err } diff --git a/go/test/endtoend/cluster/topo_process.go b/go/test/endtoend/cluster/topo_process.go index 5cad4285513..4b9ff3695e7 100644 --- a/go/test/endtoend/cluster/topo_process.go +++ b/go/test/endtoend/cluster/topo_process.go @@ -137,15 +137,15 @@ func (topo *TopoProcess) SetupEtcd() (err error) { if ferr == nil { log.Errorf("%s error log contents:\n%s", topo.Binary, string(errBytes)) } else { - log.Errorf("Failed to read the %s error log file %q: %v", topo.Binary, topo.ErrorLog, ferr) + log.Errorf("Failed to read the %s error log file %q: %v", topo.Binary, topo.ErrorLog, ferr.Error()) } - return fmt.Errorf("process '%s' exited prematurely (err: %s)", topo.Binary, err) + return fmt.Errorf("process '%s' exited prematurely (err: %w)", topo.Binary, err) default: time.Sleep(300 * time.Millisecond) } } - return fmt.Errorf("process '%s' timed out after 60s (err: %s)", topo.Binary, <-topo.exit) + return fmt.Errorf("process '%s' timed out after 60s (err: %w)", topo.Binary, <-topo.exit) } // SetupZookeeper spawns a new zookeeper topo service and initializes it with the defaults. @@ -199,12 +199,12 @@ func (topo *TopoProcess) SetupConsul(cluster *LocalProcessCluster) (err error) { err = os.MkdirAll(topo.LogDirectory, os.ModePerm) if err != nil { - log.Errorf("Failed to create directory for consul logs: %v", err) + log.Errorf("Failed to create directory for consul logs: %v", err.Error()) return } err = os.MkdirAll(topo.DataDirectory, os.ModePerm) if err != nil { - log.Errorf("Failed to create directory for consul data: %v", err) + log.Errorf("Failed to create directory for consul data: %v", err.Error()) return } @@ -213,7 +213,7 @@ func (topo *TopoProcess) SetupConsul(cluster *LocalProcessCluster) (err error) { logFile := path.Join(topo.LogDirectory, "/consul.log") _, err = os.Create(logFile) if err != nil { - log.Errorf("Failed to create file for consul logs: %v", err) + log.Errorf("Failed to create file for consul logs: %v", err.Error()) return } @@ -357,10 +357,10 @@ func (topo *TopoProcess) IsHealthy() bool { func (topo *TopoProcess) removeTopoDirectories(Cell string) { if err := topo.ManageTopoDir("rmdir", "/vitess/global"); err != nil { - log.Errorf("Failed to remove global topo directory: %v", err) + log.Errorf("Failed to remove global topo directory: %v", err.Error()) } if err := topo.ManageTopoDir("rmdir", "/vitess/"+Cell); err != nil { - log.Errorf("Failed to remove local topo directory: %v", err) + log.Errorf("Failed to remove local topo directory: %v", err.Error()) } } diff --git a/go/test/endtoend/cluster/vtctl_process.go b/go/test/endtoend/cluster/vtctl_process.go index 185c3079d34..35f13be4208 100644 --- a/go/test/endtoend/cluster/vtctl_process.go +++ b/go/test/endtoend/cluster/vtctl_process.go @@ -70,7 +70,7 @@ func (vtctl *VtctlProcess) CreateKeyspace(keyspace, sidecarDBName, durabilityPol } output, err := vtctl.ExecuteCommandWithOutput(args...) if err != nil { - log.Errorf("CreateKeyspace returned err: %s, output: %s", err, output) + log.Errorf("CreateKeyspace returned err: %s, output: %s", err.Error(), output) } return err } diff --git a/go/test/endtoend/cluster/vtctld_process.go b/go/test/endtoend/cluster/vtctld_process.go index b66cfcb26a3..1e65e0aaaa5 100644 --- a/go/test/endtoend/cluster/vtctld_process.go +++ b/go/test/endtoend/cluster/vtctld_process.go @@ -75,7 +75,7 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) err = os.MkdirAll(vtctld.LogDir, 0755) if err != nil { - log.Errorf("cannot create log directory for vtctld: %v", err) + log.Errorf("cannot create log directory for vtctld: %v", err.Error()) return err } @@ -106,7 +106,7 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error) if ferr == nil { log.Errorf("vtctld error log contents:\n%s", string(errBytes)) } else { - log.Errorf("Failed to read the vtctld error log file %q: %v", vtctld.ErrorLog, ferr) + log.Errorf("Failed to read the vtctld error log file %q: %v", vtctld.ErrorLog, ferr.Error()) } return fmt.Errorf("process '%s' exited prematurely (err: %s)", vtctld.Name, err) default: diff --git a/go/test/endtoend/cluster/vtctldclient_process.go b/go/test/endtoend/cluster/vtctldclient_process.go index 55f04e021c9..8e35ac6f16e 100644 --- a/go/test/endtoend/cluster/vtctldclient_process.go +++ b/go/test/endtoend/cluster/vtctldclient_process.go @@ -239,7 +239,7 @@ func (vtctldclient *VtctldClientProcess) CreateKeyspace(keyspaceName string, sid output, err = vtctldclient.ExecuteCommandWithOutput("CreateKeyspace", keyspaceName, "--sidecar-db-name", sidecarDBName) } if err != nil { - log.Errorf("CreateKeyspace returned err: %s, output: %s", err, output) + log.Errorf("CreateKeyspace returned err: %s, output: %s", err.Error(), output) } return err } diff --git a/go/test/endtoend/cluster/vtgate_process.go b/go/test/endtoend/cluster/vtgate_process.go index f4bba493f2e..b3e62824823 100644 --- a/go/test/endtoend/cluster/vtgate_process.go +++ b/go/test/endtoend/cluster/vtgate_process.go @@ -152,7 +152,7 @@ func (vtgate *VtgateProcess) Setup() error { if ferr == nil { log.Errorf("vtgate error log contents:\n%s", string(errBytes)) } else { - log.Errorf("Failed to read the vtgate error log file %q: %v", vtgate.ErrorLog, ferr) + log.Errorf("Failed to read the vtgate error log file %q: %v", vtgate.ErrorLog, ferr.Error()) } return fmt.Errorf("process '%s' exited prematurely (err: %s)", vtgate.Name, err) default: diff --git a/go/test/endtoend/cluster/vtorc_process.go b/go/test/endtoend/cluster/vtorc_process.go index 632f86506bf..6b359d67929 100644 --- a/go/test/endtoend/cluster/vtorc_process.go +++ b/go/test/endtoend/cluster/vtorc_process.go @@ -78,12 +78,12 @@ func (orc *VTOrcProcess) Setup() (err error) { timeNow := time.Now().UnixNano() err = os.MkdirAll(orc.LogDir, 0755) if err != nil { - log.Errorf("cannot create log directory for vtorc: %v", err) + log.Errorf("cannot create log directory for vtorc: %v", err.Error()) return err } configFile, err := os.Create(path.Join(orc.LogDir, fmt.Sprintf("orc-config-%d.json", timeNow))) if err != nil { - log.Errorf("cannot create config file for vtorc: %v", err) + log.Errorf("cannot create config file for vtorc: %v", err.Error()) return err } orc.ConfigPath = configFile.Name() diff --git a/go/test/endtoend/cluster/vttablet_process.go b/go/test/endtoend/cluster/vttablet_process.go index 94cd66be6ca..21017ff8333 100644 --- a/go/test/endtoend/cluster/vttablet_process.go +++ b/go/test/endtoend/cluster/vttablet_process.go @@ -307,7 +307,7 @@ func (vttablet *VttabletProcess) WaitForTabletStatusesForTimeout(expectedStatuse if ferr == nil { log.Errorf("vttablet error log contents:\n%s", string(errBytes)) } else { - log.Errorf("Failed to read the vttablet error log file %q: %v", vttablet.ErrorLog, ferr) + log.Errorf("Failed to read the vttablet error log file %q: %v", vttablet.ErrorLog, ferr.Error()) } return fmt.Errorf("process '%s' exited prematurely (err: %s)", vttablet.Name, err) default: