afedulov commented on code in PR #20757:
URL: https://github.com/apache/flink/pull/20757#discussion_r966964963
##########
flink-core/src/main/java/org/apache/flink/api/connector/source/SourceReaderContext.java:
##########
@@ -63,4 +63,11 @@ public interface SourceReaderContext {
* @see UserCodeClassLoader
*/
UserCodeClassLoader getUserCodeClassLoader();
+
+ /**
+ * Get the current parallelism of this Source.
+ *
+ * @return the parallelism of the Source.
+ */
+ int currentParallelism();
Review Comment:
>I'm just annoyed that we yet again failed to wrap all this super common
metadata (parallelism, attempt number etc etc) into a common structure that can
be shared across the reader context and runtime context, and now end up having
to copy things over one getter at a time.
I see, that is indeed not optimal. Seems like we have three main options:
1. Announce breaking the compatibility and just add it as is. This could be
OK for now, but, as you said, more such getters might be needed to be added
later, and doing this every time is not great.
2. Add a default method that throws an exception, since, it seems, there is
no reasonable default for it.
3. Start a larger effort: create the list of all "info" fields of the
`[Stream]RuntimeContext`, pick all that might be useful and expose them as a
read-only context object. This will help with supporting the future use cases
that are not yet evident, but breaks the encapsulation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]