Skip to content

Commit 1f6ce20

Browse files
add IsShutdown field
Signed-off-by: Tim Vaillancourt <[email protected]>
1 parent 90e3071 commit 1f6ce20

File tree

8 files changed

+99
-12
lines changed

8 files changed

+99
-12
lines changed

go/vt/proto/topodata/topodata.pb.go

Lines changed: 16 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/vt/proto/topodata/topodata_vtproto.pb.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/vt/vtorc/inst/instance_dao.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,17 @@ func ReadTopologyInstanceBufferable(tabletAlias string, latency *stopwatch.Named
191191
goto Cleanup
192192
}
193193

194-
fs, err = fullStatus(tablet)
195-
if err != nil {
196-
goto Cleanup
197-
}
198-
if config.GetStalledDiskPrimaryRecovery() && fs.DiskStalled {
199-
stalledDisk = true
200-
goto Cleanup
194+
if !tablet.IsShutdown {
195+
fs, err = fullStatus(tablet)
196+
if err != nil {
197+
goto Cleanup
198+
}
199+
if config.GetStalledDiskPrimaryRecovery() && fs.DiskStalled {
200+
stalledDisk = true
201+
goto Cleanup
202+
}
203+
partialSuccess = true // We at least managed to read something from the server.
201204
}
202-
partialSuccess = true // We at least managed to read something from the server.
203205

204206
instance.Hostname = tablet.MysqlHostname
205207
instance.Port = int(tablet.MysqlPort)

go/vt/vttablet/grpctmclient/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ func NewClient() *Client {
161161
}
162162
}
163163

164+
// validateTablet confirms the tablet record contains the necessary fields
165+
// for talking gRPC.
164166
func validateTablet(tablet *topodatapb.Tablet) error {
165167
if tablet.Hostname == "" {
166168
return vterrors.New(vtrpcpb.Code_FAILED_PRECONDITION, "invalid tablet hostname")

go/vt/vttablet/tabletmanager/tm_init.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ func BuildTabletFromInput(alias *topodatapb.TabletAlias, port, grpcPort int32, d
289289
DbNameOverride: initDbNameOverride,
290290
Tags: mergeTags(buildTags, initTags),
291291
DefaultConnCollation: uint32(charset),
292+
IsShutdown: false,
292293
}, nil
293294
}
294295

@@ -508,6 +509,7 @@ func (tm *TabletManager) Close() {
508509
tablet.Hostname = ""
509510
tablet.MysqlHostname = ""
510511
tablet.PortMap = nil
512+
tablet.IsShutdown = true
511513
return nil
512514
}
513515

proto/topodata.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ message Tablet {
166166
// map<string, string> health_map = 11;
167167
// string db_server_version = 15;
168168
reserved 3, 11, 15;
169+
170+
// IsShutdown is set to true when the tablet cleanly completes a shutdown.
171+
// This is set to false on tablet startup.
172+
bool is_shutdown = 17;
169173
}
170174

171175
// A Shard contains data about a subset of the data whithin a keyspace.

web/vtadmin/src/proto/vtadmin.d.ts

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/vtadmin/src/proto/vtadmin.js

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)