Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed devices do not influnce the list of locally needed files #5294

Closed
imsodin opened this Issue Oct 26, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@imsodin
Copy link
Member

imsodin commented Oct 26, 2018

This is a regression introduced by the local need prefix in #4958 / v0.14.49: If a device is removed and the removal of a file means we don't need that file anymore, the db isn't updated. This apparently is sufficiently rare to happen that there wasn't any report on it yet. The following unit tests reproduces the issue. PR incoming.

func TestNeedAfterDeviceRemove(t *testing.T) {
	ldb := db.OpenMemory()

	file := "foo"
	s := db.NewFileSet("test", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)

	fs := fileList{{Name: file, Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1}}}}}

	s.Update(protocol.LocalDeviceID, fs)

	fs[0].Version = fs[0].Version.Update(myID)

	s.Update(remoteDevice0, fs)

	if need := needList(s, protocol.LocalDeviceID); len(need) != 1 {
		t.Fatal("Expected one local need, got", need)
	}

	s.Drop(remoteDevice0)

	if need := needList(s, protocol.LocalDeviceID); len(need) != 0 {
		t.Fatal("Expected no local need, got", need)
	}
}

@imsodin imsodin added the bug label Oct 26, 2018

@imsodin imsodin self-assigned this Oct 26, 2018

imsodin added a commit to imsodin/syncthing that referenced this issue Oct 26, 2018

imsodin added a commit to imsodin/syncthing that referenced this issue Oct 26, 2018

@calmh calmh closed this in b1acc37 Oct 30, 2018

@calmh calmh added this to the v0.14.53 milestone Oct 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.