Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/rst/rst.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ func PrepareFileStateForWorkRequests(ctx context.Context, client Provider, mount
err = fmt.Errorf("failed to collect information for new file: %w", err)
return
}
lockedInfo.SetExists(false) // Setting to false since the file did not previously exist.
lockedInfo.SetReadWriteLocked(info.ReadWriteLocked)
lockedInfo.SetExists(info.Exists)
lockedInfo.SetSize(info.Size)
lockedInfo.SetMtime(info.Mtime)
lockedInfo.SetMode(info.Mode)
Expand Down Expand Up @@ -596,7 +596,7 @@ func GetLockedInfo(ctx context.Context, mountPoint filesystem.Provider, mappings
}
return
}
lockedInfo.Exists = true
lockedInfo.SetExists(true)

if rstIds == nil {
rstIds = entryInfo.Entry.Remote.RSTIDs
Expand Down
23 changes: 19 additions & 4 deletions common/rst/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,25 @@ func (r *S3Client) completeSyncWorkRequests_Download(ctx context.Context, job *b
}
job.SetStopMtime(timestamppb.New(mtime))

// Skip checking the file was modified if we were told to abort since the mtime may not have
// been set correctly anyway given the error check is skipped above.
if !abort {
if abort {
lockedInfo := sync.LockedInfo
if !FileExists(lockedInfo) {
r.mountPoint.Remove(request.Path)
} else if IsFileOffloaded(lockedInfo) {
mappings, err := util.GetMappings(ctx)
if err != nil {
return fmt.Errorf("failed to leave stub file: %w", err)
}

err = CreateOffloadedDataFile(ctx, r.mountPoint, mappings, request.Path, sync.RemotePath, request.RemoteStorageTarget, true)
if err != nil {
return fmt.Errorf("failed to leave stub file: %w", err)
}
job.GetStatus().SetState(beeremote.Job_OFFLOADED)
}
} else {
// Skip checking the file was modified if we were told to abort since the mtime may not have
// been set correctly anyway given the error check is skipped above.
start := job.GetStartMtime().AsTime()
stop := job.GetStopMtime().AsTime()
if !start.Equal(stop) {
Expand All @@ -448,7 +464,6 @@ func (r *S3Client) completeSyncWorkRequests_Download(ctx context.Context, job *b
}
entry.SetDataState(ctx, mappings, request.Path, DataStateNone)
}

}
return nil
}
Expand Down
Loading