Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept any materializer type param for S3's chunkUploadSink #279

Merged

Conversation

mdedetrich
Copy link
Contributor

@mdedetrich mdedetrich commented Nov 12, 2023

When I originally added this functionality I mistakingly hardcoded the type parameter to NotUsed rather than just using _ (which means don't care). While this may initially seem like a non-issue, a problem eventuates if you happen to use a Sink that materializes a value that is contained within a Future i.e. Sink[(UploadPartResponse, immutable.Iterable[C]), Future[Done]]. Such sinks are quite common and there is no way to get a value outside of a Future aside from blocking (which you should never do in production code) in order to satisfy chunkUploadSink: Sink[(UploadPartResponse, immutable.Iterable[C]), NotUsed].

Note that since chunkUploadSink ultimately ends up getting used in .alsoTo whos materializer type argument param is also _ (see https://github.com/apache/incubator-pekko/blob/1b1f57224b409c8b2cbd5267ace814439e97d3ea/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Flow.scala#L3464) and the fact that we are only dealing with type parameters which get erased at runtime means that this change is completely safe for the 1.0.x series (in fact it shouldn't even generate any bytecode difference either way, all this does is make scalac satisfy code where the materializer type param is not NotUsed)

Copy link
Contributor

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

We don't have mima checks enabled on this repo. Could you merge that PR and rebase to see if this change needs a mima exclusion?

@mdedetrich
Copy link
Contributor Author

Sure

@mdedetrich
Copy link
Contributor Author

@pjfanning #278 has been approved

@pjfanning
Copy link
Contributor

@pjfanning #278 has been approved

That PR is merged. Could you rebase this?

@mdedetrich mdedetrich force-pushed the accept-any-type-param-for-chunk-upload-sink branch from 18fc293 to f506c56 Compare November 12, 2023 17:06
@mdedetrich
Copy link
Contributor Author

@pjfanning The relevant tests passed (including MiMa check)

Copy link
Contributor

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

Lgtm

@mdedetrich mdedetrich merged commit aebbf49 into apache:main Nov 12, 2023
49 of 50 checks passed
@mdedetrich mdedetrich deleted the accept-any-type-param-for-chunk-upload-sink branch November 12, 2023 18:02
@pjfanning pjfanning added this to the 1.0.2 milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants