From 39df3173d4e245e1a6cdd07a302b962562b85a0d Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sun, 29 Sep 2024 17:04:06 +0200 Subject: [PATCH] chore(model): log sequence anomaly when update appears not to "take" (#9741) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I hope this doesn't fire, but 👻 I'm Seeing Things I Can't Explain 👻 --- lib/model/indexhandler.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/model/indexhandler.go b/lib/model/indexhandler.go index 0f5924549..9792b81c9 100644 --- a/lib/model/indexhandler.go +++ b/lib/model/indexhandler.go @@ -435,8 +435,19 @@ func (s *indexHandler) receive(fs []protocol.FileInfo, update bool, op string, p } fset.Update(deviceID, fs) - seq := fset.Sequence(deviceID) + + // Check that the sequence we get back is what we put in... + if lastSequence > 0 && seq != lastSequence { + s.logSequenceAnomaly("unexpected sequence after update", map[string]any{ + "prevSeq": prevSequence, + "lastSeq": lastSequence, + "batch": len(fs), + "seenSeq": fs[len(fs)-1].Sequence, + "returnedSeq": seq, + }) + } + s.evLogger.Log(events.RemoteIndexUpdated, map[string]interface{}{ "device": deviceID.String(), "folder": s.folder,