Skip to content

Commit

Permalink
downloader: fix abort notification
Browse files Browse the repository at this point in the history
* job type vs xaction kind

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Jan 6, 2025
1 parent 2b2694a commit 2b1a3c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 10 additions & 2 deletions ais/prxdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (p *proxy) httpdlpost(w http.ResponseWriter, r *http.Request) {
p.writeErrStatusf(w, r, http.StatusInternalServerError, "failed to receive download request: %v", err)
return
}
dlb, dlBase, ok := p.validateDownload(w, r, body)
_, dlBase, ok := p.validateDownload(w, r, body)
if !ok {
return
}
Expand All @@ -111,8 +111,16 @@ func (p *proxy) httpdlpost(w http.ResponseWriter, r *http.Request) {
p.writeErrStatusf(w, r, ecode, "Error starting download: %v", err)
return
}

// HACK:
// download _job_ vs download xaction, see abortReq() in ais/prxnotif
smap := p.owner.smap.get()
nl := dload.NewDownloadNL(jobID, string(dlb.Type), &smap.Smap, progressInterval)
nl := dload.NewDownloadNL(
jobID, // jobID != xid
apc.ActDownload, // xaction kind is always this
&smap.Smap,
progressInterval,
)
nl.SetOwner(equalIC)
p.ic.registerEqual(regIC{nl: nl, smap: smap})

Expand Down
5 changes: 3 additions & 2 deletions ais/prxnotif.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ func (n *notifs) done(nl nl.Listener) {

func abortReq(nl nl.Listener) cmn.HreqArgs {
if nl.Kind() == apc.ActDownload {
// downloader implements abort via http.MethodDelete
// and different messaging
// HACK:
// - download _job_ vs download xaction - see dload.NewDownloadNL()
// - downloader implements abort via http.MethodDelete and uses different messaging
return dload.AbortReq(nl.UUID() /*job ID*/)
}
msg := apc.ActMsg{
Expand Down

0 comments on commit 2b1a3c5

Please sign in to comment.