Browse Source

the FileChunk is created without setting ModifiedTsNs

pull/7481/head
chrislu 3 weeks ago
parent
commit
3b4a7b8e2e
  1. 5
      weed/operation/upload_chunked.go

5
weed/operation/upload_chunked.go

@ -8,6 +8,7 @@ import (
"hash" "hash"
"io" "io"
"sync" "sync"
"time"
"github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
@ -167,11 +168,15 @@ func UploadReaderInChunks(ctx context.Context, reader io.Reader, opt *ChunkedUpl
} }
// Create chunk entry // Create chunk entry
// Set ModifiedTsNs to current time (nanoseconds) to track when upload completed
// This is critical for multipart uploads where the same part may be uploaded multiple times
// The part with the latest ModifiedTsNs is selected as the authoritative version
fid, _ := filer_pb.ToFileIdObject(assignResult.Fid) fid, _ := filer_pb.ToFileIdObject(assignResult.Fid)
chunk := &filer_pb.FileChunk{ chunk := &filer_pb.FileChunk{
FileId: assignResult.Fid, FileId: assignResult.Fid,
Offset: offset, Offset: offset,
Size: uint64(uploadResult.Size), Size: uint64(uploadResult.Size),
ModifiedTsNs: time.Now().UnixNano(),
ETag: uploadResult.ContentMd5, ETag: uploadResult.ContentMd5,
Fid: fid, Fid: fid,
CipherKey: uploadResult.CipherKey, CipherKey: uploadResult.CipherKey,

Loading…
Cancel
Save