Repository navigation
filesync: detect local export multi-platform transfer support - #6864
Conversation
1437563 to
413a9dc
Compare
| progress, closeProgress := NewProgressHandler(ctx, "copying files") | ||
| defer closeProgress() | ||
| return filesync.CopyToCaller(ctx, outputFS, e.id, caller, progress) | ||
| return filesync.CopyToCaller(ctx, outputFS, e.id, caller, progress, filesync.WithLocalExporterModeDelete()) |
There was a problem hiding this comment.
Should this even be called mode-delete. Isn't it more like "multi-platform-result-transfer"
413a9dc to
dad864d
Compare
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
dad864d to
86ddfea
Compare
| func (sp *SyncTarget) DiffCopy(stream FileSend_DiffCopyServer) (err error) { | ||
| id := sp.chooser(stream.Context()) | ||
| if target, ok := sp.outdirs[id]; ok { | ||
| if target.deleteMode && !supportsExporterMultiPlatformTransfer(stream.Context()) { |
There was a problem hiding this comment.
I guess we can't safely pre-know if we actually need this capability.
There was a problem hiding this comment.
Hum good point.
So a legacy daemon can still be correct if it sends only one transfer, so we can allow the first no-header transfer for an exporter. If a second no-header transfer arrives for the same exporter, then we know the daemon is using the old per-platform transfer behavior, which is unsafe for mode=delete because the next receive can delete files from the previous platform. At that point we fail with the daemon compatibility eror, that might work but could be a bit hacky to implement.
New daemons mark the combined transfer with buildkit-exporter-multi-platform, so they don't go through that legacy fallback.
There was a problem hiding this comment.
so we can allow the first no-header transfer for an exporter.
But how do know if the second will arrive or not. You can't proceed with processing of the first transfer as that would apply wrong "delete" to missing files.
There was a problem hiding this comment.
Yes, you're right. The first transfer would already apply Merge:false to the real destination before we know if another transfer is coming, so the fallback is not safe.
follow-up #6561 (review)