Healthcheck: new simpler implementation#6155
Conversation
go/vt/discovery/healthcheck.go
Outdated
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
I think this function is unreachable (because Gateway does not have a Close).
But I see it being covered in tests.
Should Gateway export the function? Something to think about.
There was a problem hiding this comment.
vtgate seems to be missing a servenv.OnClose. That would be the logical place to call Close on gateway / healthcheck.
There was a problem hiding this comment.
Gateway already has a Close through the QueryService interface.
|
This is from my initial skimming. I'm still working on the review. |
sougou
left a comment
There was a problem hiding this comment.
I glanced at topo watcher and stats cache. I assume they didn't change much.
Signed-off-by: deepthi <deepthi@planetscale.com>
…hcheck Signed-off-by: deepthi <deepthi@planetscale.com>
…on params Signed-off-by: deepthi <deepthi@planetscale.com>
…of tabletStatsCache, refactor to encapsulate more behavior that belongs in healthcheck Signed-off-by: deepthi <deepthi@planetscale.com>
…healthcheck tests Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…he. rename tabletStats to tabletHealth Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…le tabletType change in healthcheck Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…ecorder interface. Move cellsAliases cache into TopologyWatcher Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…thData Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
implement healthy tablet sorting by replica lag, notify buffer when master changes. Signed-off-by: deepthi <deepthi@planetscale.com>
… get basic unit test working Signed-off-by: deepthi <deepthi@planetscale.com>
… TabletHealth struct that is returned to gateway. Unit tests Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
… tests Signed-off-by: deepthi <deepthi@planetscale.com>
… on gateway_implementation Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…ch results in incomplete error information Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…HealthCheck, move checkConn and finalizeConn to tabletHealthCheck, rename deleteConn -> deleteTablet Signed-off-by: deepthi <deepthi@planetscale.com>
10475cf to
e0fb77e
Compare
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
sougou
left a comment
There was a problem hiding this comment.
This is looking great. Couple more changes.
Signed-off-by: Andres Taylor <andres@planetscale.com>
harshit-gangal
left a comment
There was a problem hiding this comment.
Executor test should use new healthCheck. This will unblock from adding new funtionality (replication tx, reserve connection) using this new healthcheck.
This also means that with legacyhealthcheck additional functionality will not work. So, should we not go ahead with breaking change and remove the legacy heath check all together?
| _ = vtg.Gateway().Close(context.Background()) | ||
| if legacyHealthCheck != nil { | ||
| _ = legacyHealthCheck.Close() | ||
| } |
There was a problem hiding this comment.
nit: can change the function call
"_ = vtg.Gateway().Close(context.Background())" -> "vtg.Gateway().Close(context.Background())"
"_ = legacyHealthCheck.Close()" -> "legacyHealthCheck.Close()"
There was a problem hiding this comment.
Ignoring the return value produces warnings.
There was a problem hiding this comment.
this is still ignored :)
There was a problem hiding this comment.
I personally think it's clearer using the underscore to mark that we are aware of the returned value, but we are ignoring it. Makes it clear that it's not by mistake
go/vt/vtgate/executor.go
Outdated
| if !ts.Serving { | ||
| state = "NOT_SERVING" | ||
| if *GatewayImplementation == GatewayImplementationDiscovery { | ||
| stats := e.scatterConn.GetLegacyHealthCheckCacheStatus() |
There was a problem hiding this comment.
For this method call the scatterConn struct contains legacyHealthCheck discovery.LegacyHealthCheck. The HealthCheck and LegacyHealthCheck can have an interface implementation that can return the rows back. This can avoid keeping legacyhealthcheck inside scatterconn
There was a problem hiding this comment.
scatterConn already had a reference to healthcheck in the legacy implementation. We are not changing that in this iteration because we want to minimize how much we touch the legacy implementation. However, I do see that we can simplify this so that there is less code repetition in executor.
There was a problem hiding this comment.
actually.. unless we make LegacyTabletsCacheStatusList and TabletsCacheStatusList implement the same interface, I don't see how to avoid the duplicated code.
There was a problem hiding this comment.
I agree, I leave it up to you.
There was a problem hiding this comment.
My thinking is that leaving in ugly if-else blocks will force us to clean it up soon :)
…abletHealthCheck with TabletHealth, incorporate review comments to make code more readable, start using modern techniques in tests Signed-off-by: deepthi <deepthi@planetscale.com>
We can do that, but I would rather not have that block this PR. It can be done separately.
We discussed this. There are a few reasons to keep the legacy health check.
We did decide to make the new healthcheck the default, so I have committed that change. |
…ateway Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…ad of thread-unsafe healthByAlias from cacheStatusMap Signed-off-by: deepthi <deepthi@planetscale.com>
…eck also, so move it to replicationlag.go Signed-off-by: deepthi <deepthi@planetscale.com>
|
🎉 |
Fixes #5750
There is now a new gateway implementation called
tabletgatewaywhich uses the new healthcheck.Setting vtgate's flag
-gateway_implementation=tabletgatewaywill use the new gateway with the new healthcheck.The existing healthcheck has been renamed to
LegacyHealthCheck. It continues to be used by all other current users.