From ea87bcefd6b83bcf343c785391bc709f867d4b3c Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 6 Aug 2016 13:05:59 +0000 Subject: [PATCH] lib/protocol, lib/model: Implement high precision time stamps (fixes #3305) This adds a new nanoseconds field to the FileInfo, populates it during scans and sets the non-truncated time in Chtimes calls. The actual file modification time is defined as modified_s seconds + modified_ns nanoseconds. It's expected that the modified_ns field is <= 1e9 (that is, all whole seconds should go in the modified_s field) but not really enforced. Given that it's an int32 the timestamp can be adjusted += ~2.9 seconds by the modified_ns field... GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3431 --- cmd/stfileinfo/main.go | 6 +- cmd/stindex/dump.go | 9 +- cmd/syncthing/gui.go | 4 +- lib/db/structs.go | 9 +- lib/db/structs.pb.go | 98 ++++++++----- lib/db/structs.proto | 3 +- lib/fs/mtimefs.go | 3 - lib/model/model.go | 18 +-- lib/model/model_test.go | 60 ++++---- lib/model/queue.go | 7 +- lib/model/queue_test.go | 47 +++---- lib/model/rwfolder.go | 10 +- lib/model/rwfolder_test.go | 4 +- lib/model/sorter_test.go | 3 +- lib/protocol/bep.pb.go | 245 ++++++++++++++++++--------------- lib/protocol/bep.proto | 3 +- lib/protocol/bep_extensions.go | 13 +- lib/protocol/conflict_test.go | 6 +- lib/protocol/protocol_test.go | 2 +- lib/scanner/walk.go | 9 +- test/util.go | 2 +- 21 files changed, 321 insertions(+), 240 deletions(-) diff --git a/cmd/stfileinfo/main.go b/cmd/stfileinfo/main.go index 0feffbea5..fd14fcde0 100644 --- a/cmd/stfileinfo/main.go +++ b/cmd/stfileinfo/main.go @@ -40,7 +40,8 @@ func main() { log.Println("Lstat:") log.Printf(" Size: %d bytes", fi.Size()) log.Printf(" Mode: 0%o", fi.Mode()) - log.Printf(" Time: %v (%d)", fi.ModTime(), fi.ModTime().Unix()) + log.Printf(" Time: %v", fi.ModTime()) + log.Printf(" %d.%09d", fi.ModTime().Unix(), fi.ModTime().Nanosecond()) log.Println() if !fi.Mode().IsDir() && !fi.Mode().IsRegular() { @@ -52,7 +53,8 @@ func main() { log.Println("Stat:") log.Printf(" Size: %d bytes", fi.Size()) log.Printf(" Mode: 0%o", fi.Mode()) - log.Printf(" Time: %v (%d)", fi.ModTime(), fi.ModTime().Unix()) + log.Printf(" Time: %v", fi.ModTime()) + log.Printf(" %d.%09d", fi.ModTime().Unix(), fi.ModTime().Nanosecond()) log.Println() } diff --git a/cmd/stindex/dump.go b/cmd/stindex/dump.go index fc57d882e..a7bafc332 100644 --- a/cmd/stindex/dump.go +++ b/cmd/stindex/dump.go @@ -10,6 +10,7 @@ import ( "encoding/binary" "fmt" "log" + "time" "github.com/syncthing/syncthing/lib/db" "github.com/syncthing/syncthing/lib/protocol" @@ -53,7 +54,13 @@ func dump(ldb *db.Instance) { fmt.Printf("[fstat] K:%x V:%x\n", it.Key(), it.Value()) case db.KeyTypeVirtualMtime: - fmt.Printf("[mtime] K:%x V:%x\n", it.Key(), it.Value()) + folder := binary.BigEndian.Uint32(key[1:]) + name := nulString(key[1+4:]) + val := it.Value() + var real, virt time.Time + real.UnmarshalBinary(val[:len(val)/2]) + virt.UnmarshalBinary(val[len(val)/2:]) + fmt.Printf("[mtime] F:%d N:%q R:%v V:%v\n", folder, name, real, virt) case db.KeyTypeFolderIdx: key := binary.BigEndian.Uint32(it.Key()[1:]) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index 34e26175c..9324819f8 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -1233,7 +1233,7 @@ func (f jsonFileInfo) MarshalJSON() ([]byte, error) { "deleted": f.Deleted, "invalid": f.Invalid, "noPermissions": f.NoPermissions, - "modified": time.Unix(f.Modified, 0), + "modified": protocol.FileInfo(f).ModTime(), "sequence": f.Sequence, "numBlocks": len(f.Blocks), "version": jsonVersionVector(f.Version), @@ -1251,7 +1251,7 @@ func (f jsonDBFileInfo) MarshalJSON() ([]byte, error) { "deleted": f.Deleted, "invalid": f.Invalid, "noPermissions": f.NoPermissions, - "modified": time.Unix(f.Modified, 0), + "modified": db.FileInfoTruncated(f).ModTime(), "sequence": f.Sequence, }) } diff --git a/lib/db/structs.go b/lib/db/structs.go index ae60165e4..35d4d1ecf 100644 --- a/lib/db/structs.go +++ b/lib/db/structs.go @@ -11,13 +11,14 @@ package db import ( "fmt" + "time" "github.com/syncthing/syncthing/lib/protocol" ) func (f FileInfoTruncated) String() string { - return fmt.Sprintf("File{Name:%q, Permissions:0%o, Modified:%d, Version:%v, Length:%d, Deleted:%v, Invalid:%v, NoPermissions:%v}", - f.Name, f.Permissions, f.Modified, f.Version, f.Size, f.Deleted, f.Invalid, f.NoPermissions) + return fmt.Sprintf("File{Name:%q, Permissions:0%o, Modified:%v, Version:%v, Length:%d, Deleted:%v, Invalid:%v, NoPermissions:%v}", + f.Name, f.Permissions, f.ModTime(), f.Version, f.Size, f.Deleted, f.Invalid, f.NoPermissions) } func (f FileInfoTruncated) IsDeleted() bool { @@ -55,3 +56,7 @@ func (f FileInfoTruncated) FileSize() int64 { func (f FileInfoTruncated) FileName() string { return f.Name } + +func (f FileInfoTruncated) ModTime() time.Time { + return time.Unix(f.ModifiedS, int64(f.ModifiedNs)) +} diff --git a/lib/db/structs.pb.go b/lib/db/structs.pb.go index 28e329b31..dc43b14f7 100644 --- a/lib/db/structs.pb.go +++ b/lib/db/structs.pb.go @@ -56,7 +56,8 @@ type FileInfoTruncated struct { Type protocol.FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"` Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` Permissions uint32 `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"` - Modified int64 `protobuf:"varint,5,opt,name=modified,proto3" json:"modified,omitempty"` + ModifiedS int64 `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"` + ModifiedNs int32 `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"` Deleted bool `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"` Invalid bool `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid,omitempty"` NoPermissions bool `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"no_permissions,omitempty"` @@ -171,10 +172,10 @@ func (m *FileInfoTruncated) MarshalTo(data []byte) (int, error) { i++ i = encodeVarintStructs(data, i, uint64(m.Permissions)) } - if m.Modified != 0 { + if m.ModifiedS != 0 { data[i] = 0x28 i++ - i = encodeVarintStructs(data, i, uint64(m.Modified)) + i = encodeVarintStructs(data, i, uint64(m.ModifiedS)) } if m.Deleted { data[i] = 0x30 @@ -219,6 +220,11 @@ func (m *FileInfoTruncated) MarshalTo(data []byte) (int, error) { i++ i = encodeVarintStructs(data, i, uint64(m.Sequence)) } + if m.ModifiedNs != 0 { + data[i] = 0x58 + i++ + i = encodeVarintStructs(data, i, uint64(m.ModifiedNs)) + } return i, nil } @@ -289,8 +295,8 @@ func (m *FileInfoTruncated) ProtoSize() (n int) { if m.Permissions != 0 { n += 1 + sovStructs(uint64(m.Permissions)) } - if m.Modified != 0 { - n += 1 + sovStructs(uint64(m.Modified)) + if m.ModifiedS != 0 { + n += 1 + sovStructs(uint64(m.ModifiedS)) } if m.Deleted { n += 2 @@ -306,6 +312,9 @@ func (m *FileInfoTruncated) ProtoSize() (n int) { if m.Sequence != 0 { n += 1 + sovStructs(uint64(m.Sequence)) } + if m.ModifiedNs != 0 { + n += 1 + sovStructs(uint64(m.ModifiedNs)) + } return n } @@ -631,9 +640,9 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error { } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Modified", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ModifiedS", wireType) } - m.Modified = 0 + m.ModifiedS = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowStructs @@ -643,7 +652,7 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error { } b := data[iNdEx] iNdEx++ - m.Modified |= (int64(b) & 0x7F) << shift + m.ModifiedS |= (int64(b) & 0x7F) << shift if b < 0x80 { break } @@ -757,6 +766,25 @@ func (m *FileInfoTruncated) Unmarshal(data []byte) error { break } } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ModifiedNs", wireType) + } + m.ModifiedNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.ModifiedNs |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipStructs(data[iNdEx:]) @@ -884,30 +912,32 @@ var ( ) var fileDescriptorStructs = []byte{ - // 400 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x51, 0x4d, 0x6b, 0xe2, 0x40, - 0x18, 0x4e, 0x34, 0xab, 0x71, 0xb2, 0xba, 0xbb, 0xc3, 0x22, 0xc1, 0x43, 0x14, 0x61, 0x61, 0x59, - 0xd8, 0xb8, 0xeb, 0xb2, 0x97, 0x1e, 0x3d, 0x08, 0x85, 0x1e, 0x4a, 0x28, 0xf6, 0x58, 0x4c, 0x66, - 0x8c, 0x03, 0xc9, 0x4c, 0x9a, 0x99, 0x08, 0xf6, 0x97, 0xf4, 0xe8, 0xcf, 0xf1, 0xd8, 0x43, 0xcf, - 0xa5, 0xb5, 0x7f, 0xa4, 0xe3, 0x4c, 0x62, 0x73, 0xec, 0x21, 0xf0, 0x3e, 0x79, 0x3e, 0xde, 0x87, - 0x79, 0x41, 0x97, 0x8b, 0xbc, 0x88, 0x04, 0xf7, 0xb3, 0x9c, 0x09, 0x06, 0x1b, 0x28, 0x1c, 0xfc, - 0x8e, 0x89, 0x58, 0x17, 0xa1, 0x1f, 0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d7, 0x2d, 0x2d, 0x49, - 0x75, 0x83, 0xfa, 0x2f, 0x38, 0x00, 0x76, 0xca, 0x10, 0x59, 0x11, 0x8c, 0xdc, 0x4f, 0xca, 0x79, - 0xc2, 0xd0, 0x05, 0x6d, 0x84, 0x13, 0x2c, 0xcb, 0xb9, 0x2d, 0x49, 0xd9, 0x41, 0x05, 0x8f, 0x0c, - 0xa1, 0x9b, 0x65, 0x42, 0x90, 0xdb, 0xd6, 0x4c, 0x09, 0xe1, 0x0f, 0xd0, 0xa3, 0xec, 0xa6, 0xbe, - 0xd4, 0x56, 0x82, 0x2e, 0x65, 0x97, 0xb5, 0xb5, 0xb5, 0xa3, 0x74, 0x3e, 0x76, 0x14, 0x59, 0x94, - 0xe3, 0xdb, 0x02, 0x53, 0x79, 0x16, 0xa0, 0x8b, 0x56, 0x58, 0x3f, 0xeb, 0xec, 0xfb, 0xfe, 0xc5, - 0x33, 0xf6, 0x07, 0xcf, 0x7c, 0x90, 0xdf, 0xf3, 0xc1, 0x33, 0x76, 0xaf, 0x9e, 0x19, 0xb6, 0x54, - 0xee, 0xbf, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xb3, 0x6f, 0x36, 0x8f, 0x02, 0x00, 0x00, + // 419 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x51, 0xcd, 0xaa, 0xd3, 0x40, + 0x18, 0x4d, 0xda, 0xdc, 0x36, 0xfd, 0x62, 0xaf, 0x3a, 0xc8, 0x25, 0x14, 0x4c, 0x2f, 0x05, 0x41, + 0x04, 0x53, 0xbd, 0xe2, 0xc6, 0x65, 0x17, 0x05, 0x41, 0x44, 0x46, 0xa9, 0xcb, 0xd2, 0x64, 0xa6, + 0xe9, 0x40, 0x32, 0x13, 0x33, 0x93, 0x42, 0x7d, 0x12, 0x97, 0x7d, 0x9c, 0x2e, 0x7d, 0x02, 0xd1, + 0x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92, 0x23, 0x6c, 0x66, 0xf4, 0x0c, 0x1c, 0x75, 0xc8, 0xab, + 0x1e, 0xd7, 0x77, 0x37, 0xff, 0x8a, 0xb7, 0x76, 0xcd, 0x62, 0xa3, 0xb9, 0xf8, 0x25, 0xfb, 0x4a, + 0xfd, 0xbe, 0xd6, 0xf6, 0xb1, 0x99, 0xd1, 0x2d, 0x78, 0x39, 0x2d, 0x32, 0x26, 0xab, 0x96, 0x8e, + 0xa6, 0xc6, 0xb8, 0x7b, 0x84, 0x1e, 0x03, 0x64, 0x82, 0xb0, 0x2d, 0xa3, 0x64, 0x2d, 0xfd, 0x2b, + 0xe3, 0x1d, 0x35, 0x27, 0x1f, 0x91, 0x0f, 0x43, 0x42, 0x53, 0xaa, 0xfb, 0xf9, 0x03, 0xcd, 0xb9, + 0xb8, 0x81, 0x17, 0x86, 0xf1, 0xfd, 0x26, 0x65, 0xc4, 0x1f, 0x56, 0x4c, 0x0d, 0xd1, 0x13, 0xb8, + 0xe6, 0x62, 0xdd, 0xcd, 0x75, 0x8d, 0x60, 0xcc, 0xc5, 0x87, 0x4e, 0x72, 0xe7, 0x5d, 0x46, 0xff, + 0xf7, 0x2e, 0x13, 0x70, 0x25, 0xfd, 0x52, 0x52, 0xae, 0x5f, 0x06, 0x4c, 0xd3, 0x16, 0xa3, 0x29, + 0x78, 0xed, 0x3d, 0x74, 0xa2, 0xa7, 0xe9, 0x2b, 0xdc, 0x5e, 0xed, 0x7d, 0xfd, 0xeb, 0x17, 0x8f, + 0x4e, 0xbf, 0x02, 0xeb, 0x74, 0x0e, 0xec, 0xef, 0xfa, 0xfb, 0x79, 0x0e, 0xac, 0xe3, 0xef, 0xc0, + 0x8e, 0x06, 0x26, 0xf8, 0xd5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2a, 0xae, 0x24, 0x77, 0xb3, + 0x02, 0x00, 0x00, } diff --git a/lib/db/structs.proto b/lib/db/structs.proto index cf694f848..603dc4e82 100644 --- a/lib/db/structs.proto +++ b/lib/db/structs.proto @@ -26,7 +26,8 @@ message FileInfoTruncated { protocol.FileInfoType type = 2; int64 size = 3; uint32 permissions = 4; - int64 modified = 5; + int64 modified_s = 5; + int32 modified_ns = 11; bool deleted = 6; bool invalid = 7; bool no_permissions = 8; diff --git a/lib/fs/mtimefs.go b/lib/fs/mtimefs.go index a3873f74f..1b9c16d12 100644 --- a/lib/fs/mtimefs.go +++ b/lib/fs/mtimefs.go @@ -4,9 +4,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at http://mozilla.org/MPL/2.0/. -//go:generate go run ../../script/protofmt.go mtime.proto -//go:generate protoc --proto_name=../../../../../:../../../../gogo/protobuf/protobuf:. --gogofast_out=. mtime.proto - package fs import ( diff --git a/lib/model/model.go b/lib/model/model.go index 3ef8eb1ea..b87e39aab 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -1658,7 +1658,8 @@ func (m *Model) internalScanFolderSubdirs(folder string, subDirs []string) error Name: f.Name, Type: f.Type, Size: f.Size, - Modified: f.Modified, + ModifiedS: f.ModifiedS, + ModifiedNs: f.ModifiedNs, Permissions: f.Permissions, NoPermissions: f.NoPermissions, Invalid: true, @@ -1676,12 +1677,13 @@ func (m *Model) internalScanFolderSubdirs(folder string, subDirs []string) error // directory") when we try to Lstat() them. nf := protocol.FileInfo{ - Name: f.Name, - Type: f.Type, - Size: f.Size, - Modified: f.Modified, - Deleted: true, - Version: f.Version.Update(m.shortID), + Name: f.Name, + Type: f.Type, + Size: f.Size, + ModifiedS: f.ModifiedS, + ModifiedNs: f.ModifiedNs, + Deleted: true, + Version: f.Version.Update(m.shortID), } batch = append(batch, nf) @@ -1948,7 +1950,7 @@ func (m *Model) GlobalDirectoryTree(folder, prefix string, levels int, dirsonly if !dirsonly && base != "" { last[base] = []interface{}{ - time.Unix(f.Modified, 0), f.FileSize(), + f.ModTime(), f.FileSize(), } } diff --git a/lib/model/model_test.go b/lib/model/model_test.go index 146c1a673..57a830767 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -54,22 +54,22 @@ func init() { var testDataExpected = map[string]protocol.FileInfo{ "foo": { - Name: "foo", - Type: protocol.FileInfoTypeFile, - Modified: 0, - Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0x7, Hash: []uint8{0xae, 0xc0, 0x70, 0x64, 0x5f, 0xe5, 0x3e, 0xe3, 0xb3, 0x76, 0x30, 0x59, 0x37, 0x61, 0x34, 0xf0, 0x58, 0xcc, 0x33, 0x72, 0x47, 0xc9, 0x78, 0xad, 0xd1, 0x78, 0xb6, 0xcc, 0xdf, 0xb0, 0x1, 0x9f}}}, + Name: "foo", + Type: protocol.FileInfoTypeFile, + ModifiedS: 0, + Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0x7, Hash: []uint8{0xae, 0xc0, 0x70, 0x64, 0x5f, 0xe5, 0x3e, 0xe3, 0xb3, 0x76, 0x30, 0x59, 0x37, 0x61, 0x34, 0xf0, 0x58, 0xcc, 0x33, 0x72, 0x47, 0xc9, 0x78, 0xad, 0xd1, 0x78, 0xb6, 0xcc, 0xdf, 0xb0, 0x1, 0x9f}}}, }, "empty": { - Name: "empty", - Type: protocol.FileInfoTypeFile, - Modified: 0, - Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0x0, Hash: []uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}}, + Name: "empty", + Type: protocol.FileInfoTypeFile, + ModifiedS: 0, + Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0x0, Hash: []uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}}, }, "bar": { - Name: "bar", - Type: protocol.FileInfoTypeFile, - Modified: 0, - Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0xa, Hash: []uint8{0x2f, 0x72, 0xcc, 0x11, 0xa6, 0xfc, 0xd0, 0x27, 0x1e, 0xce, 0xf8, 0xc6, 0x10, 0x56, 0xee, 0x1e, 0xb1, 0x24, 0x3b, 0xe3, 0x80, 0x5b, 0xf9, 0xa9, 0xdf, 0x98, 0xf9, 0x2f, 0x76, 0x36, 0xb0, 0x5c}}}, + Name: "bar", + Type: protocol.FileInfoTypeFile, + ModifiedS: 0, + Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0xa, Hash: []uint8{0x2f, 0x72, 0xcc, 0x11, 0xa6, 0xfc, 0xd0, 0x27, 0x1e, 0xce, 0xf8, 0xc6, 0x10, 0x56, 0xee, 0x1e, 0xb1, 0x24, 0x3b, 0xe3, 0x80, 0x5b, 0xf9, 0xa9, 0xdf, 0x98, 0xf9, 0x2f, 0x76, 0x36, 0xb0, 0x5c}}}, }, } @@ -78,7 +78,7 @@ func init() { for n, f := range testDataExpected { fi, _ := os.Stat("testdata/" + n) f.Permissions = uint32(fi.Mode()) - f.Modified = fi.ModTime().Unix() + f.ModifiedS = fi.ModTime().Unix() f.Size = fi.Size() testDataExpected[n] = f } @@ -144,9 +144,9 @@ func genFiles(n int) []protocol.FileInfo { t := time.Now().Unix() for i := 0; i < n; i++ { files[i] = protocol.FileInfo{ - Name: fmt.Sprintf("file%d", i), - Modified: t, - Blocks: []protocol.BlockInfo{{Offset: 0, Size: 100, Hash: []byte("some hash bytes")}}, + Name: fmt.Sprintf("file%d", i), + ModifiedS: t, + Blocks: []protocol.BlockInfo{{Offset: 0, Size: 100, Hash: []byte("some hash bytes")}}, } } @@ -284,9 +284,9 @@ func BenchmarkRequest(b *testing.B) { t := time.Now().Unix() for i := 0; i < n; i++ { files[i] = protocol.FileInfo{ - Name: fmt.Sprintf("file%d", i), - Modified: t, - Blocks: []protocol.BlockInfo{{Offset: 0, Size: 100, Hash: []byte("some hash bytes")}}, + Name: fmt.Sprintf("file%d", i), + ModifiedS: t, + Blocks: []protocol.BlockInfo{{Offset: 0, Size: 100, Hash: []byte("some hash bytes")}}, } } @@ -755,11 +755,11 @@ func TestGlobalDirectoryTree(t *testing.T) { blocks = []protocol.BlockInfo{{Offset: 0x0, Size: 0xa, Hash: []uint8{0x2f, 0x72, 0xcc, 0x11, 0xa6, 0xfc, 0xd0, 0x27, 0x1e, 0xce, 0xf8, 0xc6, 0x10, 0x56, 0xee, 0x1e, 0xb1, 0x24, 0x3b, 0xe3, 0x80, 0x5b, 0xf9, 0xa9, 0xdf, 0x98, 0xf9, 0x2f, 0x76, 0x36, 0xb0, 0x5c}}} } return protocol.FileInfo{ - Name: filepath.Join(path...), - Type: typ, - Modified: 0x666, - Blocks: blocks, - Size: 0xa, + Name: filepath.Join(path...), + Type: typ, + ModifiedS: 0x666, + Blocks: blocks, + Size: 0xa, } } @@ -1006,11 +1006,11 @@ func TestGlobalDirectorySelfFixing(t *testing.T) { blocks = []protocol.BlockInfo{{Offset: 0x0, Size: 0xa, Hash: []uint8{0x2f, 0x72, 0xcc, 0x11, 0xa6, 0xfc, 0xd0, 0x27, 0x1e, 0xce, 0xf8, 0xc6, 0x10, 0x56, 0xee, 0x1e, 0xb1, 0x24, 0x3b, 0xe3, 0x80, 0x5b, 0xf9, 0xa9, 0xdf, 0x98, 0xf9, 0x2f, 0x76, 0x36, 0xb0, 0x5c}}} } return protocol.FileInfo{ - Name: filepath.Join(path...), - Type: typ, - Modified: 0x666, - Blocks: blocks, - Size: 0xa, + Name: filepath.Join(path...), + Type: typ, + ModifiedS: 0x666, + Blocks: blocks, + Size: 0xa, } } @@ -1148,7 +1148,7 @@ func genDeepFiles(n, d int) []protocol.FileInfo { i++ } - files[i].Modified = t + files[i].ModifiedS = t files[i].Blocks = []protocol.BlockInfo{{Offset: 0, Size: 100, Hash: []byte("some hash bytes")}} } diff --git a/lib/model/queue.go b/lib/model/queue.go index c1e81ce9f..16942721e 100644 --- a/lib/model/queue.go +++ b/lib/model/queue.go @@ -9,6 +9,7 @@ package model import ( "math/rand" "sort" + "time" "github.com/syncthing/syncthing/lib/sync" ) @@ -22,7 +23,7 @@ type jobQueue struct { type jobQueueEntry struct { name string size int64 - modified int64 + modified time.Time } func newJobQueue() *jobQueue { @@ -31,7 +32,7 @@ func newJobQueue() *jobQueue { } } -func (q *jobQueue) Push(file string, size, modified int64) { +func (q *jobQueue) Push(file string, size int64, modified time.Time) { q.mut.Lock() q.queued = append(q.queued, jobQueueEntry{file, size, modified}) q.mut.Unlock() @@ -160,5 +161,5 @@ func (q smallestFirst) Swap(a, b int) { q[a], q[b] = q[b], q[a] } type oldestFirst []jobQueueEntry func (q oldestFirst) Len() int { return len(q) } -func (q oldestFirst) Less(a, b int) bool { return q[a].modified < q[b].modified } +func (q oldestFirst) Less(a, b int) bool { return q[a].modified.Before(q[b].modified) } func (q oldestFirst) Swap(a, b int) { q[a], q[b] = q[b], q[a] } diff --git a/lib/model/queue_test.go b/lib/model/queue_test.go index 36ab5fe54..fb75e8059 100644 --- a/lib/model/queue_test.go +++ b/lib/model/queue_test.go @@ -9,6 +9,7 @@ package model import ( "fmt" "testing" + "time" "github.com/d4l3k/messagediff" ) @@ -16,10 +17,10 @@ import ( func TestJobQueue(t *testing.T) { // Some random actions q := newJobQueue() - q.Push("f1", 0, 0) - q.Push("f2", 0, 0) - q.Push("f3", 0, 0) - q.Push("f4", 0, 0) + q.Push("f1", 0, time.Time{}) + q.Push("f2", 0, time.Time{}) + q.Push("f3", 0, time.Time{}) + q.Push("f4", 0, time.Time{}) progress, queued := q.Jobs() if len(progress) != 0 || len(queued) != 4 { @@ -44,7 +45,7 @@ func TestJobQueue(t *testing.T) { t.Fatal("Wrong length", len(progress), len(queued)) } - q.Push(n, 0, 0) + q.Push(n, 0, time.Time{}) progress, queued = q.Jobs() if len(progress) != 0 || len(queued) != 4 { t.Fatal("Wrong length") @@ -121,10 +122,10 @@ func TestJobQueue(t *testing.T) { func TestBringToFront(t *testing.T) { q := newJobQueue() - q.Push("f1", 0, 0) - q.Push("f2", 0, 0) - q.Push("f3", 0, 0) - q.Push("f4", 0, 0) + q.Push("f1", 0, time.Time{}) + q.Push("f2", 0, time.Time{}) + q.Push("f3", 0, time.Time{}) + q.Push("f4", 0, time.Time{}) _, queued := q.Jobs() if diff, equal := messagediff.PrettyDiff([]string{"f1", "f2", "f3", "f4"}, queued); !equal { @@ -162,10 +163,10 @@ func TestBringToFront(t *testing.T) { func TestShuffle(t *testing.T) { q := newJobQueue() - q.Push("f1", 0, 0) - q.Push("f2", 0, 0) - q.Push("f3", 0, 0) - q.Push("f4", 0, 0) + q.Push("f1", 0, time.Time{}) + q.Push("f2", 0, time.Time{}) + q.Push("f3", 0, time.Time{}) + q.Push("f4", 0, time.Time{}) // This test will fail once in eight million times (1 / (4!)^5) :) for i := 0; i < 5; i++ { @@ -187,10 +188,10 @@ func TestShuffle(t *testing.T) { func TestSortBySize(t *testing.T) { q := newJobQueue() - q.Push("f1", 20, 0) - q.Push("f2", 40, 0) - q.Push("f3", 30, 0) - q.Push("f4", 10, 0) + q.Push("f1", 20, time.Time{}) + q.Push("f2", 40, time.Time{}) + q.Push("f3", 30, time.Time{}) + q.Push("f4", 10, time.Time{}) q.SortSmallestFirst() @@ -219,10 +220,10 @@ func TestSortBySize(t *testing.T) { func TestSortByAge(t *testing.T) { q := newJobQueue() - q.Push("f1", 0, 20) - q.Push("f2", 0, 40) - q.Push("f3", 0, 30) - q.Push("f4", 0, 10) + q.Push("f1", 0, time.Unix(20, 0)) + q.Push("f2", 0, time.Unix(40, 0)) + q.Push("f3", 0, time.Unix(30, 0)) + q.Push("f4", 0, time.Unix(10, 0)) q.SortOldestFirst() @@ -254,7 +255,7 @@ func BenchmarkJobQueueBump(b *testing.B) { q := newJobQueue() for _, f := range files { - q.Push(f.Name, 0, 0) + q.Push(f.Name, 0, time.Time{}) } b.ResetTimer() @@ -270,7 +271,7 @@ func BenchmarkJobQueuePushPopDone10k(b *testing.B) { for i := 0; i < b.N; i++ { q := newJobQueue() for _, f := range files { - q.Push(f.Name, 0, 0) + q.Push(f.Name, 0, time.Time{}) } for _ = range files { n, _ := q.Pop() diff --git a/lib/model/rwfolder.go b/lib/model/rwfolder.go index 954f21c5d..dcaf09115 100644 --- a/lib/model/rwfolder.go +++ b/lib/model/rwfolder.go @@ -449,7 +449,7 @@ func (f *rwFolder) pullerIteration(ignores *ignore.Matcher) int { devices := folderFiles.Availability(file.Name) for _, dev := range devices { if f.model.ConnectedTo(dev) { - f.queue.Push(file.Name, file.Size, file.Modified) + f.queue.Push(file.Name, file.Size, file.ModTime()) changed++ break } @@ -925,7 +925,7 @@ func (f *rwFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocks // changes that we don't know about yet and we should scan before // touching the file. If we can't stat the file we'll just pull it. if info, err := f.mtimeFS.Lstat(realName); err == nil { - if info.ModTime().Unix() != curFile.Modified || info.Size() != curFile.Size { + if !info.ModTime().Equal(curFile.ModTime()) || info.Size() != curFile.Size { l.Debugln("file modified but not rescanned; not pulling:", realName) // Scan() is synchronous (i.e. blocks until the scan is // completed and returns an error), but a scan can't happen @@ -1044,8 +1044,7 @@ func (f *rwFolder) shortcutFile(file protocol.FileInfo) error { } } - t := time.Unix(file.Modified, 0) - f.mtimeFS.Chtimes(realName, t, t) // never fails + f.mtimeFS.Chtimes(realName, file.ModTime(), file.ModTime()) // never fails // This may have been a conflict. We should merge the version vectors so // that our clock doesn't move backwards. @@ -1247,8 +1246,7 @@ func (f *rwFolder) performFinish(state *sharedPullerState) error { } // Set the correct timestamp on the new file - t := time.Unix(state.file.Modified, 0) - f.mtimeFS.Chtimes(state.tempName, t, t) // never fails + f.mtimeFS.Chtimes(state.tempName, state.file.ModTime(), state.file.ModTime()) // never fails if stat, err := f.mtimeFS.Lstat(state.realName); err == nil { // There is an old file or directory already in place. We need to diff --git a/lib/model/rwfolder_test.go b/lib/model/rwfolder_test.go index 697d2ccef..d8f1ec13c 100644 --- a/lib/model/rwfolder_test.go +++ b/lib/model/rwfolder_test.go @@ -332,7 +332,7 @@ func TestDeregisterOnFailInCopy(t *testing.T) { f := setUpRwFolder(m) // queue.Done should be called by the finisher routine - f.queue.Push("filex", 0, 0) + f.queue.Push("filex", 0, time.Time{}) f.queue.Pop() if f.queue.lenProgress() != 1 { @@ -405,7 +405,7 @@ func TestDeregisterOnFailInPull(t *testing.T) { f := setUpRwFolder(m) // queue.Done should be called by the finisher routine - f.queue.Push("filex", 0, 0) + f.queue.Push("filex", 0, time.Time{}) f.queue.Pop() if f.queue.lenProgress() != 1 { diff --git a/lib/model/sorter_test.go b/lib/model/sorter_test.go index 6e1cb6bfb..f44ddb2b6 100644 --- a/lib/model/sorter_test.go +++ b/lib/model/sorter_test.go @@ -103,7 +103,8 @@ func addFiles(n int, s IndexSorter) { Name: fmt.Sprintf("file-%d", rnd), Size: rand.Int63(), Permissions: uint32(rand.Intn(0777)), - Modified: rand.Int63(), + ModifiedS: rand.Int63(), + ModifiedNs: int32(rand.Int63()), Sequence: rnd, Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: uint64(rand.Int63())}}}, Blocks: []protocol.BlockInfo{{ diff --git a/lib/protocol/bep.pb.go b/lib/protocol/bep.pb.go index d885b951b..0456908e9 100644 --- a/lib/protocol/bep.pb.go +++ b/lib/protocol/bep.pb.go @@ -295,7 +295,8 @@ type FileInfo struct { Type FileInfoType `protobuf:"varint,2,opt,name=type,proto3,enum=protocol.FileInfoType" json:"type,omitempty"` Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` Permissions uint32 `protobuf:"varint,4,opt,name=permissions,proto3" json:"permissions,omitempty"` - Modified int64 `protobuf:"varint,5,opt,name=modified,proto3" json:"modified,omitempty"` + ModifiedS int64 `protobuf:"varint,5,opt,name=modified_s,json=modifiedS,proto3" json:"modified_s,omitempty"` + ModifiedNs int32 `protobuf:"varint,11,opt,name=modified_ns,json=modifiedNs,proto3" json:"modified_ns,omitempty"` Deleted bool `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"` Invalid bool `protobuf:"varint,7,opt,name=invalid,proto3" json:"invalid,omitempty"` NoPermissions bool `protobuf:"varint,8,opt,name=no_permissions,json=noPermissions,proto3" json:"no_permissions,omitempty"` @@ -789,10 +790,10 @@ func (m *FileInfo) MarshalTo(data []byte) (int, error) { i++ i = encodeVarintBep(data, i, uint64(m.Permissions)) } - if m.Modified != 0 { + if m.ModifiedS != 0 { data[i] = 0x28 i++ - i = encodeVarintBep(data, i, uint64(m.Modified)) + i = encodeVarintBep(data, i, uint64(m.ModifiedS)) } if m.Deleted { data[i] = 0x30 @@ -837,6 +838,11 @@ func (m *FileInfo) MarshalTo(data []byte) (int, error) { i++ i = encodeVarintBep(data, i, uint64(m.Sequence)) } + if m.ModifiedNs != 0 { + data[i] = 0x58 + i++ + i = encodeVarintBep(data, i, uint64(m.ModifiedNs)) + } if len(m.Blocks) > 0 { for _, msg := range m.Blocks { data[i] = 0x82 @@ -1348,8 +1354,8 @@ func (m *FileInfo) ProtoSize() (n int) { if m.Permissions != 0 { n += 1 + sovBep(uint64(m.Permissions)) } - if m.Modified != 0 { - n += 1 + sovBep(uint64(m.Modified)) + if m.ModifiedS != 0 { + n += 1 + sovBep(uint64(m.ModifiedS)) } if m.Deleted { n += 2 @@ -1365,6 +1371,9 @@ func (m *FileInfo) ProtoSize() (n int) { if m.Sequence != 0 { n += 1 + sovBep(uint64(m.Sequence)) } + if m.ModifiedNs != 0 { + n += 1 + sovBep(uint64(m.ModifiedNs)) + } if len(m.Blocks) > 0 { for _, e := range m.Blocks { l = e.ProtoSize() @@ -2632,9 +2641,9 @@ func (m *FileInfo) Unmarshal(data []byte) error { } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Modified", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ModifiedS", wireType) } - m.Modified = 0 + m.ModifiedS = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBep @@ -2644,7 +2653,7 @@ func (m *FileInfo) Unmarshal(data []byte) error { } b := data[iNdEx] iNdEx++ - m.Modified |= (int64(b) & 0x7F) << shift + m.ModifiedS |= (int64(b) & 0x7F) << shift if b < 0x80 { break } @@ -2758,6 +2767,25 @@ func (m *FileInfo) Unmarshal(data []byte) error { break } } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ModifiedNs", wireType) + } + m.ModifiedNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBep + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.ModifiedNs |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } case 16: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Blocks", wireType) @@ -3926,104 +3954,105 @@ var ( ) var fileDescriptorBep = []byte{ - // 1569 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xdb, 0x46, - 0x16, 0xb7, 0x24, 0x8a, 0x92, 0x46, 0xb2, 0x23, 0x4f, 0x1c, 0x47, 0xcb, 0x78, 0x6d, 0x2f, 0x93, - 0x60, 0xbd, 0xc2, 0xc6, 0xd9, 0x4d, 0xda, 0x06, 0x28, 0xd0, 0x02, 0xb2, 0x44, 0x3b, 0x44, 0x64, - 0x4a, 0xa1, 0x24, 0xa7, 0xe9, 0xa1, 0x02, 0x25, 0x8e, 0x64, 0x22, 0x14, 0x47, 0x25, 0xa9, 0x24, - 0xee, 0x47, 0x68, 0xbf, 0x40, 0x2f, 0x05, 0x82, 0xde, 0x7a, 0xef, 0x87, 0xc8, 0x31, 0xc8, 0xb1, - 0x87, 0xa0, 0x75, 0x2f, 0xfd, 0x02, 0xbd, 0x16, 0x7d, 0x9c, 0x21, 0x45, 0xca, 0x7f, 0x8a, 0x1c, - 0x7a, 0x10, 0x34, 0xf3, 0xde, 0x6f, 0xde, 0xcc, 0xfc, 0xde, 0xef, 0xbd, 0x21, 0x2a, 0x0c, 0xc8, - 0x74, 0x77, 0xea, 0x52, 0x9f, 0xe2, 0x3c, 0xfb, 0x1b, 0x52, 0x5b, 0xba, 0x33, 0xb6, 0xfc, 0xe3, - 0xd9, 0x60, 0x77, 0x48, 0x27, 0x77, 0xc7, 0x74, 0x4c, 0xef, 0x32, 0xcf, 0x60, 0x36, 0x62, 0x33, - 0x36, 0x61, 0x23, 0xbe, 0x50, 0x9e, 0xa2, 0xec, 0x43, 0x62, 0xdb, 0x14, 0x6f, 0xa1, 0xa2, 0x49, - 0x9e, 0x5b, 0x43, 0xd2, 0x77, 0x8c, 0x09, 0xa9, 0xa4, 0xb6, 0x53, 0x3b, 0x05, 0x1d, 0x71, 0x93, - 0x06, 0x96, 0x00, 0x30, 0xb4, 0x2d, 0xe2, 0xf8, 0x1c, 0x90, 0xe6, 0x00, 0x6e, 0x62, 0x80, 0xdb, - 0x68, 0x25, 0x04, 0x3c, 0x27, 0xae, 0x67, 0x51, 0xa7, 0x92, 0x61, 0x98, 0x65, 0x6e, 0x3d, 0xe2, - 0x46, 0xd9, 0x43, 0xe2, 0x43, 0x62, 0x98, 0xc4, 0xc5, 0xff, 0x41, 0x82, 0x7f, 0x32, 0xe5, 0x7b, - 0xad, 0xdc, 0xbb, 0xb6, 0x1b, 0xdd, 0x61, 0xf7, 0x90, 0x78, 0x9e, 0x31, 0x26, 0x5d, 0x70, 0xea, - 0x0c, 0x82, 0x3f, 0x85, 0xcd, 0xe9, 0x64, 0xea, 0x82, 0x23, 0x08, 0x9c, 0x66, 0x2b, 0x36, 0xce, - 0xad, 0xa8, 0xc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xbd, 0x81, 0xdf, 0xcf, 0xa7, 0x9b, 0x4b, 0xbf, 0xc1, 0xff, 0xab, 0x5f, 0x37, 0x53, 0x03, 0x91, - 0xf5, 0xae, 0xfb, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x49, 0x51, 0xc5, 0x82, 0x0d, 0x00, - 0x00, + // 1589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0xdb, 0x46, + 0x16, 0xb7, 0x24, 0xea, 0xdf, 0x48, 0x76, 0xe4, 0x89, 0xe3, 0x68, 0x19, 0xc7, 0xf6, 0x32, 0x09, + 0xd6, 0x2b, 0x6c, 0x9c, 0xdd, 0x64, 0x77, 0x03, 0x14, 0x68, 0x01, 0x59, 0xa2, 0x1d, 0x21, 0x32, + 0xa5, 0x50, 0x92, 0xd3, 0xf4, 0x50, 0x41, 0x12, 0x47, 0x32, 0x11, 0x8a, 0xa3, 0x92, 0x54, 0x12, + 0xf7, 0x23, 0xb4, 0x5f, 0xa0, 0x97, 0x02, 0x41, 0x6e, 0xbd, 0xf7, 0x43, 0xe4, 0x18, 0xe4, 0xd8, + 0x43, 0xd0, 0xba, 0x97, 0x7e, 0x81, 0xde, 0xfb, 0xf8, 0x86, 0x94, 0x28, 0xff, 0x29, 0x72, 0xe8, + 0xc1, 0xd0, 0xcc, 0x7b, 0xbf, 0x99, 0x37, 0xf3, 0x7b, 0xbf, 0xf7, 0x86, 0x26, 0xd9, 0x3e, 0x9b, + 0xec, 0x4e, 0x1c, 0xee, 0x71, 0x9a, 0xc1, 0x9f, 0x01, 0xb7, 0xe4, 0xbb, 0x23, 0xd3, 0x3b, 0x9e, + 0xf6, 0x77, 0x07, 0x7c, 0x7c, 0x6f, 0xc4, 0x47, 0xfc, 0x1e, 0x7a, 0xfa, 0xd3, 0x21, 0xce, 0x70, + 0x82, 0x23, 0xb1, 0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0x67, 0x56, 0x40, 0x8e, 0x98, 0xd0, + 0x1b, 0x24, 0xeb, 0xc0, 0x85, 0xbb, 0xdc, 0xb6, 0x4e, 0x90, 0x92, 0x8c, 0x9e, 0xf1, 0x0d, 0x0d, + 0x98, 0xd3, 0xbb, 0x84, 0x9a, 0x23, 0x9b, 0x3b, 0xac, 0x3b, 0x61, 0xce, 0xd8, 0xc4, 0xd3, 0xba, + 0x45, 0x09, 0x51, 0xab, 0xc2, 0xd3, 0x9c, 0x3b, 0xe8, 0x2d, 0xb2, 0x1c, 0xc0, 0x0d, 0x66, 0x31, + 0x8f, 0x15, 0x93, 0x88, 0xcc, 0x0b, 0x63, 0x15, 0x6d, 0x70, 0xb7, 0x35, 0xc3, 0x74, 0x7b, 0x7d, + 0x8b, 0x75, 0x3d, 0x36, 0x9e, 0x74, 0x4d, 0xdb, 0x60, 0xaf, 0x98, 0x5b, 0x4c, 0x21, 0x96, 0x06, + 0xbe, 0x36, 0xb8, 0x6a, 0xc2, 0xe3, 0xb3, 0x21, 0x32, 0xed, 0x16, 0x0b, 0x67, 0xd9, 0xa8, 0xa2, + 0x23, 0x64, 0x23, 0x80, 0x29, 0x6f, 0x80, 0x0d, 0xe1, 0x89, 0xb0, 0x91, 0x5f, 0x60, 0x83, 0x12, + 0x29, 0xa2, 0x14, 0x1c, 0xd3, 0x0d, 0x92, 0xed, 0x19, 0x86, 0x9f, 0x15, 0x08, 0x95, 0x80, 0x50, + 0x59, 0x7d, 0x6e, 0xa0, 0x0f, 0x17, 0xb3, 0x2c, 0x9d, 0xd5, 0xc5, 0x65, 0xe9, 0xf5, 0x29, 0x1e, + 0x30, 0x27, 0x50, 0x66, 0x12, 0xe3, 0x65, 0x7c, 0x03, 0xea, 0xf2, 0xef, 0x24, 0x3f, 0xee, 0xbd, + 0xea, 0xba, 0xec, 0xab, 0x29, 0xb3, 0x07, 0x0c, 0x69, 0x48, 0xe8, 0x39, 0xb0, 0xb5, 0x02, 0x13, + 0xdd, 0x24, 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0x5c, 0xe4, 0xd3, 0x03, 0xce, 0xb3, 0x52, 0xa9, 0x77, 0x5a, 0x6d, + 0x55, 0xef, 0x56, 0x1a, 0xda, 0x7e, 0xed, 0xa0, 0xb0, 0x24, 0x6f, 0x7c, 0xf3, 0xfd, 0x76, 0x71, + 0x3c, 0x07, 0x2d, 0x7e, 0x55, 0x40, 0x88, 0x9a, 0x56, 0x55, 0x3f, 0x2f, 0xc4, 0xe4, 0x35, 0x00, + 0x16, 0x22, 0x40, 0xf1, 0x10, 0xfc, 0x8b, 0xe4, 0x11, 0xd0, 0xed, 0x34, 0xab, 0xe5, 0xb6, 0x5a, + 0x88, 0xcb, 0x32, 0xe0, 0xd6, 0xcf, 0xe2, 0x02, 0xbe, 0x6f, 0x41, 0x5d, 0xa8, 0x4f, 0x3a, 0x6a, + 0xab, 0x5d, 0x48, 0xc8, 0xeb, 0x00, 0xa4, 0x11, 0x60, 0x58, 0x31, 0x77, 0x40, 0x86, 0x6a, 0xab, + 0xd9, 0xd0, 0x5a, 0x6a, 0x41, 0x92, 0xaf, 0x03, 0xea, 0xea, 0x02, 0x2a, 0x50, 0xe8, 0xff, 0xc9, + 0x6a, 0xb5, 0xf1, 0x54, 0xab, 0x37, 0xca, 0xd5, 0x6e, 0x53, 0x6f, 0x1c, 0xc0, 0x9a, 0x56, 0x21, + 0x29, 0x6f, 0x01, 0xfe, 0x46, 0x04, 0x7f, 0x4e, 0x70, 0x37, 0x81, 0xbd, 0x9a, 0x76, 0x50, 0x48, + 0xc9, 0x57, 0x01, 0x7a, 0x25, 0x02, 0xf5, 0x49, 0xf5, 0x6f, 0x5c, 0xa9, 0x37, 0x20, 0x74, 0xfa, + 0xdc, 0x8d, 0x91, 0xec, 0xd2, 0x97, 0x84, 0x9e, 0xff, 0x38, 0xa3, 0xb7, 0x89, 0xa4, 0x35, 0x34, + 0x15, 0x08, 0xc5, 0xfb, 0x9f, 0x47, 0x68, 0xdc, 0x66, 0x54, 0x21, 0x89, 0xfa, 0x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, 0xeb, 0x50, 0x3e, 0xcf, 0x5a, 0xa3, 0xab, 0xea, 0x7a, 0x43, 0x0f, 0x2f, 0x3e, + 0x73, 0x6a, 0x1c, 0x87, 0xf0, 0xe1, 0x95, 0x3e, 0x50, 0x35, 0x55, 0xaf, 0x55, 0xc2, 0x7a, 0x98, + 0x41, 0x0e, 0x98, 0xcd, 0x1c, 0x73, 0x00, 0xff, 0x02, 0xe4, 0x61, 0x9b, 0x56, 0xa7, 0xf2, 0x28, + 0xbc, 0x31, 0x0a, 0x38, 0xb2, 0x55, 0x6b, 0x3a, 0x38, 0xc6, 0xdb, 0x96, 0xfc, 0xd2, 0x39, 0x2a, + 0xd7, 0x6b, 0x55, 0x01, 0x4d, 0xc8, 0x45, 0x80, 0xae, 0xcd, 0xa0, 0x35, 0xf1, 0xec, 0xfb, 0xd8, + 0x92, 0x41, 0x36, 0xff, 0xbc, 0x17, 0xc1, 0x17, 0x49, 0xaa, 0xdc, 0x6c, 0xaa, 0x5a, 0x35, 0x3c, + 0xfd, 0xdc, 0x57, 0x9e, 0x4c, 0x98, 0x6d, 0xf8, 0x88, 0xfd, 0x86, 0x7e, 0xa0, 0xb6, 0xc3, 0xc3, + 0xcf, 0x11, 0xfb, 0xdc, 0x19, 0x31, 0x6f, 0x6f, 0xe3, 0xed, 0x2f, 0x9b, 0x4b, 0xef, 0xe0, 0xef, + 0xed, 0xe9, 0x66, 0xec, 0x1d, 0xfc, 0xfd, 0x7c, 0xba, 0xb9, 0xf4, 0x1b, 0xfc, 0xbe, 0xfe, 0x75, + 0x33, 0xd6, 0x4f, 0x61, 0xef, 0x7a, 0xf0, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0x88, 0xa1, + 0x6a, 0xa6, 0x0d, 0x00, 0x00, } diff --git a/lib/protocol/bep.proto b/lib/protocol/bep.proto index 6987c2887..31741b461 100644 --- a/lib/protocol/bep.proto +++ b/lib/protocol/bep.proto @@ -97,7 +97,8 @@ message FileInfo { FileInfoType type = 2; int64 size = 3; uint32 permissions = 4; - int64 modified = 5; + int64 modified_s = 5; + int32 modified_ns = 11; bool deleted = 6; bool invalid = 7; bool no_permissions = 8; diff --git a/lib/protocol/bep_extensions.go b/lib/protocol/bep_extensions.go index ee0dbbd5a..6787ce679 100644 --- a/lib/protocol/bep_extensions.go +++ b/lib/protocol/bep_extensions.go @@ -11,6 +11,7 @@ import ( "encoding/binary" "errors" "fmt" + "time" "github.com/syncthing/syncthing/lib/rand" ) @@ -25,8 +26,8 @@ func (m Hello) Magic() uint32 { } func (f FileInfo) String() string { - return fmt.Sprintf("File{Name:%q, Type:%v, Sequence:%d, Permissions:0%o, Modified:%d, Version:%v, Length:%d, Deleted:%v, Invalid:%v, NoPermissions:%v, Blocks:%v}", - f.Name, f.Type, f.Sequence, f.Permissions, f.Modified, f.Version, f.Size, f.Deleted, f.Invalid, f.NoPermissions, f.Blocks) + return fmt.Sprintf("File{Name:%q, Type:%v, Sequence:%d, Permissions:0%o, ModTime:%v, Version:%v, Length:%d, Deleted:%v, Invalid:%v, NoPermissions:%v, Blocks:%v}", + f.Name, f.Type, f.Sequence, f.Permissions, f.ModTime(), f.Version, f.Size, f.Deleted, f.Invalid, f.NoPermissions, f.Blocks) } func (f FileInfo) IsDeleted() bool { @@ -65,6 +66,10 @@ func (f FileInfo) FileName() string { return f.Name } +func (f FileInfo) ModTime() time.Time { + return time.Unix(f.ModifiedS, int64(f.ModifiedNs)) +} + // WinsConflict returns true if "f" is the one to choose when it is in // conflict with "other". func (f FileInfo) WinsConflict(other FileInfo) bool { @@ -78,10 +83,10 @@ func (f FileInfo) WinsConflict(other FileInfo) bool { } // The one with the newer modification time wins. - if f.Modified > other.Modified { + if f.ModTime().After(other.ModTime()) { return true } - if f.Modified < other.Modified { + if f.ModTime().Before(other.ModTime()) { return false } diff --git a/lib/protocol/conflict_test.go b/lib/protocol/conflict_test.go index 033c02eef..848445b1a 100644 --- a/lib/protocol/conflict_test.go +++ b/lib/protocol/conflict_test.go @@ -7,9 +7,9 @@ import "testing" func TestWinsConflict(t *testing.T) { testcases := [][2]FileInfo{ // The first should always win over the second - {{Modified: 42}, {Modified: 41}}, - {{Modified: 41}, {Modified: 42, Deleted: true}}, - {{Modified: 41, Version: Vector{[]Counter{{42, 2}, {43, 1}}}}, {Modified: 41, Version: Vector{[]Counter{{42, 1}, {43, 2}}}}}, + {{ModifiedS: 42}, {ModifiedS: 41}}, + {{ModifiedS: 41}, {ModifiedS: 42, Deleted: true}}, + {{ModifiedS: 41, Version: Vector{[]Counter{{42, 2}, {43, 1}}}}, {ModifiedS: 41, Version: Vector{[]Counter{{42, 1}, {43, 2}}}}}, } for _, tc := range testcases { diff --git a/lib/protocol/protocol_test.go b/lib/protocol/protocol_test.go index 139e28c04..bce66de45 100644 --- a/lib/protocol/protocol_test.go +++ b/lib/protocol/protocol_test.go @@ -221,7 +221,7 @@ func TestMarshalledIndexMessageSize(t *testing.T) { Type: FileInfoTypeFile, Size: fileSize, Permissions: 0666, - Modified: time.Now().Unix(), + ModifiedS: time.Now().Unix(), Version: Vector{Counters: []Counter{{ID: 1 << 60, Value: 1}, {ID: 2 << 60, Value: 1}}}, Blocks: make([]BlockInfo, fileSize/blockSize), } diff --git a/lib/scanner/walk.go b/lib/scanner/walk.go index 09e5fdfa8..f2ab2c627 100644 --- a/lib/scanner/walk.go +++ b/lib/scanner/walk.go @@ -310,7 +310,7 @@ func (w *walker) walkRegular(relPath string, info os.FileInfo, fchan chan protoc // - has the same size as previously cf, ok := w.CurrentFiler.CurrentFile(relPath) permUnchanged := w.IgnorePerms || !cf.HasPermissionBits() || PermsEqual(cf.Permissions, curMode) - if ok && permUnchanged && !cf.IsDeleted() && cf.Modified == info.ModTime().Unix() && !cf.IsDirectory() && + if ok && permUnchanged && !cf.IsDeleted() && cf.ModTime().Equal(info.ModTime()) && !cf.IsDirectory() && !cf.IsSymlink() && !cf.IsInvalid() && cf.Size == info.Size() { return nil } @@ -323,7 +323,8 @@ func (w *walker) walkRegular(relPath string, info os.FileInfo, fchan chan protoc Version: cf.Version.Update(w.ShortID), Permissions: curMode & uint32(maskModePerm), NoPermissions: w.IgnorePerms, - Modified: info.ModTime().Unix(), + ModifiedS: info.ModTime().Unix(), + ModifiedNs: int32(info.ModTime().Nanosecond()), Size: info.Size(), } l.Debugln("to hash:", relPath, f) @@ -357,7 +358,8 @@ func (w *walker) walkDir(relPath string, info os.FileInfo, dchan chan protocol.F Version: cf.Version.Update(w.ShortID), Permissions: uint32(info.Mode() & maskModePerm), NoPermissions: w.IgnorePerms, - Modified: info.ModTime().Unix(), + ModifiedS: info.ModTime().Unix(), + ModifiedNs: int32(info.ModTime().Nanosecond()), } l.Debugln("dir:", relPath, f) @@ -416,7 +418,6 @@ func (w *walker) walkSymlink(absPath, relPath string, dchan chan protocol.FileIn Name: relPath, Type: SymlinkType(targetType), Version: cf.Version.Update(w.ShortID), - Modified: 0, NoPermissions: true, // Symlinks don't have permissions of their own Blocks: blocks, } diff --git a/test/util.go b/test/util.go index 879f96618..71191eb01 100644 --- a/test/util.go +++ b/test/util.go @@ -455,7 +455,7 @@ func startWalker(dir string, res chan<- fileInfo, abort <-chan struct{}) chan er f = fileInfo{ name: rn, mode: info.Mode(), - mod: info.ModTime().Unix(), + mod: info.ModTime().Truncate(time.Microsecond).UnixNano(), size: info.Size(), } sum, err := md5file(path)