mirror of
https://github.com/syncthing/syncthing.git
synced 2026-11-20 00:51:22 -08:00
Properly exclude them from the corresponding query. Signed-off-by: Jakob Borg <[email protected]>
This commit is contained in:
1 parent
9da9c11ef1
commit
ed38528d7f
2 files changed
+16
-5
No files matched your search
@@ -71,11 +71,11 @@ func TestBasics(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
const (
|
||||
localSize = (1+2+3)*blockSize
|
||||
localSize = (1 + 2 + 3) * blockSize
|
||||
remoteSize = (3 + 4 + 5) * blockSize
|
||||
globalSize = (2+3+3+4+5)*blockSize
|
||||
globalSize = (2 + 3 + 3 + 4 + 5) * blockSize
|
||||
needSizeLocal = remoteSize
|
||||
needSizeRemote = (2+3)*blockSize
|
||||
needSizeRemote = (2 + 3) * blockSize
|
||||
)
|
||||
|
||||
t.Run("SchemaVersion", func(t *testing.T) {
|
||||
@@ -566,6 +566,17 @@ func TestAvailability(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Ignored remote files, not part of the available set
|
||||
ignored := []protocol.FileInfo{genFile("test1", 1, 1), genFile("test3", 3, 2)}
|
||||
for i := range ignored {
|
||||
ignored[i].SetIgnored()
|
||||
// Juggle flags like sending over the wire does
|
||||
ignored[i] = protocol.FileInfoFromWire(ignored[i].ToWire(false))
|
||||
}
|
||||
if err := db.Update(folderID, protocol.DeviceID{46}, ignored); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
a, err := db.GetGlobalAvailability(folderID, "test1")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1381,7 +1392,7 @@ func genBlocks(name string, seed, count int) []protocol.BlockInfo {
|
||||
for i := range b {
|
||||
b[i].Hash = genBlockHash(name, seed, i)
|
||||
b[i].Size = blockSize
|
||||
b[i].Offset = (blockSize) * int64(i)
|
||||
b[i].Offset = blockSize * int64(i)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func (s *folderDB) GetGlobalAvailability(file string) ([]protocol.DeviceID, erro
|
||||
INNER JOIN devices d ON d.idx = f.device_idx
|
||||
INNER JOIN files g ON g.version_idx = f.version_idx AND g.name_idx = f.name_idx
|
||||
INNER JOIN file_names n ON f.name_idx = n.idx
|
||||
WHERE n.name = ? AND g.local_flags & {{.FlagLocalGlobal}} != 0 AND f.device_idx != {{.LocalDeviceIdx}}
|
||||
WHERE n.name = ? AND g.local_flags & {{.FlagLocalGlobal}} != 0 AND f.device_idx != {{.LocalDeviceIdx}} AND f.local_flags & {{.LocalInvalidFlags}} = 0
|
||||
ORDER BY d.device_id
|
||||
`).Select(&devStrs, file)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
|
||||
Reference in new issue
Block a user