Improve logs around recovering from snapshot backend
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
@ -227,6 +227,14 @@ func bootstrapBackend(cfg config.ServerConfig, haveWAL bool, st v2store.Store, s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if beExist {
|
if beExist {
|
||||||
|
s1, s2 := be.Size(), be.SizeInUse()
|
||||||
|
cfg.Logger.Info(
|
||||||
|
"recovered v3 backend",
|
||||||
|
zap.Int64("backend-size-bytes", s1),
|
||||||
|
zap.String("backend-size", humanize.Bytes(uint64(s1))),
|
||||||
|
zap.Int64("backend-size-in-use-bytes", s2),
|
||||||
|
zap.String("backend-size-in-use", humanize.Bytes(uint64(s2))),
|
||||||
|
)
|
||||||
if err = schema.Validate(cfg.Logger, be.ReadTx()); err != nil {
|
if err = schema.Validate(cfg.Logger, be.ReadTx()); err != nil {
|
||||||
cfg.Logger.Error("Failed to validate schema", zap.Error(err))
|
cfg.Logger.Error("Failed to validate schema", zap.Error(err))
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -414,14 +422,6 @@ func recoverSnapshot(cfg config.ServerConfig, st v2store.Store, be backend.Backe
|
|||||||
// already been closed in this case, so we should set the backend again.
|
// already been closed in this case, so we should set the backend again.
|
||||||
ci.SetBackend(be)
|
ci.SetBackend(be)
|
||||||
|
|
||||||
s1, s2 := be.Size(), be.SizeInUse()
|
|
||||||
cfg.Logger.Info(
|
|
||||||
"recovered v3 backend from snapshot",
|
|
||||||
zap.Int64("backend-size-bytes", s1),
|
|
||||||
zap.String("backend-size", humanize.Bytes(uint64(s1))),
|
|
||||||
zap.Int64("backend-size-in-use-bytes", s2),
|
|
||||||
zap.String("backend-size-in-use", humanize.Bytes(uint64(s2))),
|
|
||||||
)
|
|
||||||
if beExist {
|
if beExist {
|
||||||
// TODO: remove kvindex != 0 checking when we do not expect users to upgrade
|
// TODO: remove kvindex != 0 checking when we do not expect users to upgrade
|
||||||
// etcd from pre-3.0 release.
|
// etcd from pre-3.0 release.
|
||||||
|
@ -105,8 +105,10 @@ func RecoverSnapshotBackend(cfg config.ServerConfig, oldbe backend.Backend, snap
|
|||||||
consistentIndex, _ = schema.ReadConsistentIndex(oldbe.ReadTx())
|
consistentIndex, _ = schema.ReadConsistentIndex(oldbe.ReadTx())
|
||||||
}
|
}
|
||||||
if snapshot.Metadata.Index <= consistentIndex {
|
if snapshot.Metadata.Index <= consistentIndex {
|
||||||
|
cfg.Logger.Info("Skipping snapshot backend", zap.Uint64("consistent-index", consistentIndex), zap.Uint64("snapshot-index", snapshot.Metadata.Index))
|
||||||
return oldbe, nil
|
return oldbe, nil
|
||||||
}
|
}
|
||||||
|
cfg.Logger.Info("Recovering from snapshot backend", zap.Uint64("consistent-index", consistentIndex), zap.Uint64("snapshot-index", snapshot.Metadata.Index))
|
||||||
oldbe.Close()
|
oldbe.Close()
|
||||||
return OpenSnapshotBackend(cfg, snap.New(cfg.Logger, cfg.SnapDir()), snapshot, hooks)
|
return OpenSnapshotBackend(cfg, snap.New(cfg.Logger, cfg.SnapDir()), snapshot, hooks)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user