Skip to content

Conversation

@zentol
Copy link
Contributor

@zentol zentol commented Dec 13, 2018

What is the purpose of the change

With this PR the FileUploadHandle checks that the upload directory still exists before accepting a request, and regenerates it if this isn't the case. This behavior is in sync with the handling of deleted upload directories during an upload (see the msg instanceof HttpContent branch).

Previously, if the directory has been deleted, the handler would continuously fail in this situation.

Brief change log

  • call to RestServerEndpoint.createUploadDir before creating request-scoped directory

Verifying this change

This change added tests and can be verified as follows:

  • org.apache.flink.runtime.rest.FileUploadHandlerTest#testUploadDirectoryRegeneration

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

LGTM +1

currentHttpRequest = ReferenceCountUtil.retain(httpRequest);

// make sure that we still have a upload dir in case that it got deleted in the meanwhile
RestServerEndpoint.createUploadDir(uploadDir, LOG);
Copy link
Member

Choose a reason for hiding this comment

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

Branch msg instanceof HttpContent && currentHttpPostRequestDecoder != null has this statement too. Seems that line is useless and can be deleted safely since following receiving work happens in currentUploadDir not its parent uploadDir. If uploadDir got deleted meanwhile, the upload request should fail due to potential lost of uploaded files, this is what will happen in fileUpload.renameTo(dest.toFile()).

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.

4 participants