server: Written Snapshot's to WAL contains populated ConfState.

This will (among others) allow etcd-3.6 to not depend on store_v2 .snap files at all,
as WAL + db file will be self-sufficient.
This commit is contained in:
Piotr Tabor
2021-02-28 14:40:01 +01:00
parent fce0c192eb
commit 4d4c84e014
7 changed files with 108 additions and 46 deletions

View File

@@ -608,7 +608,6 @@ func ValidSnapshotEntries(lg *zap.Logger, walDir string) ([]walpb.Snapshot, erro
}
}
snaps = snaps[:n:n]
return snaps, nil
}
@@ -944,6 +943,10 @@ func (w *WAL) Save(st raftpb.HardState, ents []raftpb.Entry) error {
}
func (w *WAL) SaveSnapshot(e walpb.Snapshot) error {
if err := walpb.ValidateSnapshotForWrite(&e); err != nil {
return err
}
b := pbutil.MustMarshal(&e)
w.mu.Lock()