@@ -142,7 +142,10 @@ func updateExecute(c *threadParams, conn *mysql.Conn) error {
142
142
attempt := c .i
143
143
// Value used in next UPDATE query. Increased after every query.
144
144
c .i ++
145
- conn .ExecuteFetch ("begin" , 1000 , true )
145
+
146
+ if _ , err := conn .ExecuteFetch ("begin" , 1000 , true ); err != nil {
147
+ log .Errorf ("begin failed:%v" , err )
148
+ }
146
149
147
150
result , err := conn .ExecuteFetch (fmt .Sprintf ("UPDATE buffer SET msg='update %d' WHERE id = %d" , attempt , updateRowID ), 1000 , true )
148
151
@@ -269,9 +272,11 @@ func testBufferBase(t *testing.T, isExternalParent bool) {
269
272
externalReparenting (ctx , t , clusterInstance )
270
273
} else {
271
274
//reparent call
272
- clusterInstance .VtctlclientProcess .ExecuteCommand ("PlannedReparentShard" , "-keyspace_shard" ,
275
+ if err := clusterInstance .VtctlclientProcess .ExecuteCommand ("PlannedReparentShard" , "-keyspace_shard" ,
273
276
fmt .Sprintf ("%s/%s" , keyspaceUnshardedName , "0" ),
274
- "-new_master" , clusterInstance .Keyspaces [0 ].Shards [0 ].Vttablets [1 ].Alias )
277
+ "-new_master" , clusterInstance .Keyspaces [0 ].Shards [0 ].Vttablets [1 ].Alias ); err != nil {
278
+ log .Errorf ("clusterInstance.VtctlclientProcess.ExecuteCommand(\" PlannedRepare... caused an error : %v" , err )
279
+ }
275
280
}
276
281
277
282
<- readThreadInstance .waitForNotification
@@ -354,7 +359,12 @@ func externalReparenting(ctx context.Context, t *testing.T, clusterInstance *clu
354
359
newMaster := replica
355
360
master .VttabletProcess .QueryTablet (demoteMasterQuery , keyspaceUnshardedName , true )
356
361
if master .VttabletProcess .EnableSemiSync {
357
- master .VttabletProcess .QueryTablet (disableSemiSyncMasterQuery , keyspaceUnshardedName , true )
362
+
363
+ //log error
364
+ if _ , err := master .VttabletProcess .QueryTablet (disableSemiSyncMasterQuery , keyspaceUnshardedName , true ); err != nil {
365
+ log .Errorf ("master.VttabletProcess.QueryTablet(disableSemi... caused an error : %v" , err )
366
+ }
367
+
358
368
}
359
369
360
370
// Wait for replica to catch up to master.
@@ -368,11 +378,16 @@ func externalReparenting(ctx context.Context, t *testing.T, clusterInstance *clu
368
378
time .Sleep (time .Duration (w ) * time .Second )
369
379
}
370
380
371
- // Promote replica to new master.
372
- replica .VttabletProcess .QueryTablet (promoteSlaveQuery , keyspaceUnshardedName , true )
381
+ //Promote replica to new master and log error
382
+ if _ , err := replica .VttabletProcess .QueryTablet (promoteSlaveQuery , keyspaceUnshardedName , true ); err != nil {
383
+ log .Errorf ("replica.VttabletProcess.QueryTablet(promoteSlaveQuery... caused an error : %v" , err )
384
+ }
373
385
374
386
if replica .VttabletProcess .EnableSemiSync {
375
- replica .VttabletProcess .QueryTablet (enableSemiSyncMasterQuery , keyspaceUnshardedName , true )
387
+ //Log error
388
+ if _ , err := replica .VttabletProcess .QueryTablet (enableSemiSyncMasterQuery , keyspaceUnshardedName , true ); err != nil {
389
+ log .Errorf ("replica.VttabletProcess.QueryTablet caused an error : %v" , err )
390
+ }
376
391
}
377
392
378
393
// Configure old master to replicate from new master.
@@ -382,8 +397,14 @@ func externalReparenting(ctx context.Context, t *testing.T, clusterInstance *clu
382
397
// Use 'localhost' as hostname because Travis CI worker hostnames
383
398
// are too long for MySQL replication.
384
399
changeMasterCommands := fmt .Sprintf ("RESET SLAVE;SET GLOBAL gtid_slave_pos = '%s';CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d ,MASTER_USER='vt_repl', MASTER_USE_GTID = slave_pos;START SLAVE;" , gtID , "localhost" , newMaster .MySQLPort )
385
- oldMaster .VttabletProcess .QueryTablet (changeMasterCommands , keyspaceUnshardedName , true )
386
400
387
- // Notify the new vttablet master about the reparent.
388
- clusterInstance .VtctlclientProcess .ExecuteCommand ("TabletExternallyReparented" , newMaster .Alias )
401
+ //Log error
402
+ if _ , err := oldMaster .VttabletProcess .QueryTablet (changeMasterCommands , keyspaceUnshardedName , true ); err != nil {
403
+ log .Errorf ("oldMaster.VttabletProcess.QueryTablet caused an error : %v" , err )
404
+ }
405
+
406
+ //Notify the new vttablet master about the reparent and Log error
407
+ if err := clusterInstance .VtctlclientProcess .ExecuteCommand ("TabletExternallyReparented" , newMaster .Alias ); err != nil {
408
+ log .Errorf ("clusterInstance.VtctlclientProcess.ExecuteCommand caused an error : %v" , err )
409
+ }
389
410
}
0 commit comments