Skip to content

filesync: detect local export multi-platform transfer support - #6864

Merged
crazy-max merged 1 commit into
moby:masterfrom
crazy-max:mode-delete-old-daemon
Jun 12, 2026
Merged

crazy-max merged 1 commit into
moby:masterfrom
crazy-max:mode-delete-old-daemon

Conversation

@crazy-max

Copy link
Copy Markdown
Member

follow-up #6561 (review)

@crazy-max crazy-max added this to the v0.31.0 milestone Jun 11, 2026
@crazy-max
crazy-max force-pushed the mode-delete-old-daemon branch from 1437563 to 413a9dc Compare June 11, 2026 15:51
@crazy-max
crazy-max requested a review from tonistiigi June 11, 2026 16:26
@crazy-max
crazy-max marked this pull request as ready for review June 11, 2026 16:26
Comment thread exporter/local/export.go Outdated
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())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this even be called mode-delete. Isn't it more like "multi-platform-result-transfer"

@crazy-max
crazy-max force-pushed the mode-delete-old-daemon branch from 413a9dc to dad864d Compare June 11, 2026 16:51
@crazy-max crazy-max changed the title filesync: detect old daemons for local export delete mode filesync: detect local export multi-platform transfer support Jun 11, 2026
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max force-pushed the mode-delete-old-daemon branch from dad864d to 86ddfea Compare June 11, 2026 16:53
@crazy-max
crazy-max requested a review from tonistiigi June 11, 2026 17:00
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()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can't safely pre-know if we actually need this capability.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@crazy-max
crazy-max merged commit f4f035c into moby:master Jun 12, 2026
225 of 226 checks passed
@crazy-max
crazy-max deleted the mode-delete-old-daemon branch June 12, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants