Fix follower not authenticating after an aofshrink

This commit is contained in:
tidwall 2022-09-21 18:44:09 -07:00
parent 4a0bab3e3a
commit 0b2814d8e0
2 changed files with 9 additions and 2 deletions

View File

@ -138,7 +138,8 @@ func getEndOfLastValuePositionInFile(fname string, startPos int64) (int64, error
// followCheckSome is not a full checksum. It just "checks some" data. // followCheckSome is not a full checksum. It just "checks some" data.
// We will do some various checksums on the leader until we find the correct position to start at. // We will do some various checksums on the leader until we find the correct position to start at.
func (s *Server) followCheckSome(addr string, followc int) (pos int64, err error) { func (s *Server) followCheckSome(addr string, followc int, auth string,
) (pos int64, err error) {
if core.ShowDebugMessages { if core.ShowDebugMessages {
log.Debug("follow:", addr, ":check some") log.Debug("follow:", addr, ":check some")
} }
@ -157,6 +158,12 @@ func (s *Server) followCheckSome(addr string, followc int) (pos int64, err error
} }
defer conn.Close() defer conn.Close()
if auth != "" {
if err := s.followDoLeaderAuth(conn, auth); err != nil {
return 0, err
}
}
min := int64(0) min := int64(0)
max := int64(s.aofsz) - checksumsz max := int64(s.aofsz) - checksumsz
limit := int64(s.aofsz) limit := int64(s.aofsz)

View File

@ -224,7 +224,7 @@ func (s *Server) followStep(host string, port int, followc int) error {
} }
// verify checksum // verify checksum
pos, err := s.followCheckSome(addr, followc) pos, err := s.followCheckSome(addr, followc, auth)
if err != nil { if err != nil {
return err return err
} }