From b5339b72b60c1ffdcb889270bdd65e40d3e19f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Sch=C3=A4fer?= Date: Thu, 17 Aug 2017 17:13:32 +0200 Subject: [PATCH 1/2] add log message if new tablet doesn't have a sufficiently new timestamp to be marked up --- go/vt/discovery/tablet_stats_cache.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/go/vt/discovery/tablet_stats_cache.go b/go/vt/discovery/tablet_stats_cache.go index efa91a7b120..a110cdf82c7 100644 --- a/go/vt/discovery/tablet_stats_cache.go +++ b/go/vt/discovery/tablet_stats_cache.go @@ -193,9 +193,13 @@ func (tc *TabletStatsCache) StatsUpdate(ts *TabletStats) { // We already have one up server, see if we // need to replace it. - if e.healthy[0].TabletExternallyReparentedTimestamp > ts.TabletExternallyReparentedTimestamp { - // The notification we just got is older than - // the one we had before, discard it. + if ts.TabletExternallyReparentedTimestamp < e.healthy[0].TabletExternallyReparentedTimestamp { + log.Warningf("not marking healthy master as Up because its externally reparented timestamt is smaller than the highest known timestamp from previous MASTERs: %d < %d ", + ts.TabletExternallyReparentedTimestamp, + e.healthy[0].TabletExternallyReparentedTimestamp, + topoproto.KeyspaceShardString(eps.Target.Keyspace, eps.Target.Shard), + topoproto.TabletAliasString(eps.Tablet.Alias), + topoproto.TabletAliasString(e.healthy[0].Tablet.Alias)) return } From 3f9f5f751b28ecc03e0841f325ab63a80e83a704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Sch=C3=A4fer?= Date: Thu, 17 Aug 2017 18:20:15 +0200 Subject: [PATCH 2/2] fix typo, add missing includes for log message --- go/vt/discovery/tablet_stats_cache.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/go/vt/discovery/tablet_stats_cache.go b/go/vt/discovery/tablet_stats_cache.go index a110cdf82c7..01ee5aec0b5 100644 --- a/go/vt/discovery/tablet_stats_cache.go +++ b/go/vt/discovery/tablet_stats_cache.go @@ -19,8 +19,10 @@ package discovery import ( "sync" + log "github.com/golang/glog" querypb "github.com/youtube/vitess/go/vt/proto/query" topodatapb "github.com/youtube/vitess/go/vt/proto/topodata" + "github.com/youtube/vitess/go/vt/topo/topoproto" ) // TabletStatsCache is a HealthCheckStatsListener that keeps both the @@ -194,11 +196,11 @@ func (tc *TabletStatsCache) StatsUpdate(ts *TabletStats) { // We already have one up server, see if we // need to replace it. if ts.TabletExternallyReparentedTimestamp < e.healthy[0].TabletExternallyReparentedTimestamp { - log.Warningf("not marking healthy master as Up because its externally reparented timestamt is smaller than the highest known timestamp from previous MASTERs: %d < %d ", + log.Warningf("not marking healthy master as Up because its externally reparented timestamp is smaller than the highest known timestamp from previous MASTERs: %d < %d ", ts.TabletExternallyReparentedTimestamp, e.healthy[0].TabletExternallyReparentedTimestamp, - topoproto.KeyspaceShardString(eps.Target.Keyspace, eps.Target.Shard), - topoproto.TabletAliasString(eps.Tablet.Alias), + topoproto.KeyspaceShardString(ts.Target.Keyspace, ts.Target.Shard), + topoproto.TabletAliasString(ts.Tablet.Alias), topoproto.TabletAliasString(e.healthy[0].Tablet.Alias)) return }