lib/db: Drop indexes for outgoing data to force refresh (ref #9496) (#9502)

### Purpose

Resend our indexes since we fixed that index-sending issue.

I made a new thing to only drop the non-local-device index IDs, i.e.,
those for other devices. This means we will see a mismatch and resend
all indexes, but they will not. This is somewhat cleaner as it avoids
resending everything twice when two devices are upgraded, and in any
case, we have no reason to force a resend of incoming indexes here.

### Testing

It happens on my computer...
This commit is contained in:
Jakob Borg
2024-04-08 11:14:27 +02:00
committed by GitHub
parent 6fb3c5ccf2
commit 61b94b9ea5
3 changed files with 34 additions and 6 deletions
+18
View File
@@ -665,6 +665,24 @@ func (db *Lowlevel) dropIndexIDs() error {
return t.Commit()
}
// dropOtherDeviceIndexIDs drops all index IDs for devices other than the
// local device. This means we will resend our indexes to all other devices,
// but they don't have to resend to us.
func (db *Lowlevel) dropOtherDeviceIndexIDs() error {
t, err := db.newReadWriteTransaction()
if err != nil {
return err
}
defer t.close()
if err := t.deleteKeyPrefixMatching([]byte{KeyTypeIndexID}, func(key []byte) bool {
dev, _ := t.keyer.DeviceFromIndexIDKey(key)
return !bytes.Equal(dev, protocol.LocalDeviceID[:])
}); err != nil {
return err
}
return t.Commit()
}
func (db *Lowlevel) dropMtimes(folder []byte) error {
key, err := db.keyer.GenerateMtimesKey(nil, folder)
if err != nil {