start restored tablets in NON-SERVING state

Signed-off-by: deepthi <deepthi@planetscale.com>
This commit is contained in:
deepthi 2019-08-26 17:24:59 -07:00
Родитель 639b695bd8
Коммит 8fe0fb8837
1 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -218,17 +218,25 @@ func (agent *ActionAgent) changeCallback(ctx context.Context, oldTablet, newTabl
disallowQueryReason = "master tablet with filtered replication on" disallowQueryReason = "master tablet with filtered replication on"
} }
} else { } else {
replicationDelay, healthErr := agent.HealthReporter.Report(true, true) if oldTablet.Type == topodatapb.TabletType_RESTORE {
if healthErr != nil { // always start as NON-SERVING after a restore because
// healthcheck has not been initialized yet
allowQuery = false allowQuery = false
disallowQueryReason = "Unable to get health" disallowQueryReason = "After restore from backup"
} else { } else {
agent.mutex.Lock() replicationDelay, healthErr := agent.HealthReporter.Report(true, true)
agent._replicationDelay = replicationDelay log.Infof("4426: replication delay during changeCallback: %v", replicationDelay)
agent.mutex.Unlock() if healthErr != nil {
if agent._replicationDelay > *unhealthyThreshold {
allowQuery = false allowQuery = false
disallowQueryReason = "replica tablet with unhealthy replication lag" disallowQueryReason = "Unable to get health"
} else {
agent.mutex.Lock()
agent._replicationDelay = replicationDelay
agent.mutex.Unlock()
if agent._replicationDelay > *unhealthyThreshold {
allowQuery = false
disallowQueryReason = "replica tablet with unhealthy replication lag"
}
} }
} }
} }