Skip to content

Commit

Permalink
print more
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Oct 31, 2024
1 parent c172984 commit 2692bb1
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 49 deletions.
62 changes: 31 additions & 31 deletions go/test/endtoend/cluster/cluster_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -409,15 +409,15 @@ 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
}
}

// 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
}
}
Expand All @@ -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
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -515,22 +515,22 @@ 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
}
}
for _, tablet := range shard.Vttablets {
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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -630,29 +630,29 @@ 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
}
}

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)
Expand All @@ -672,15 +672,15 @@ 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
}
}

// 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
}
}
Expand All @@ -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
}
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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())
}
}

Expand All @@ -1068,20 +1068,20 @@ 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)
}
}
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())
}
}
}
Expand All @@ -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.
Expand Down Expand Up @@ -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))
Expand All @@ -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])
}
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/cluster/mysqlctl_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/cluster/mysqlctld_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
16 changes: 8 additions & 8 deletions go/test/endtoend/cluster/topo_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down Expand Up @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/cluster/vtctl_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions go/test/endtoend/cluster/vtctld_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/cluster/vtctldclient_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/cluster/vtgate_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions go/test/endtoend/cluster/vtorc_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading

0 comments on commit 2692bb1

Please sign in to comment.