dmvk commented on a change in pull request #17958:
URL: https://github.com/apache/flink/pull/17958#discussion_r765078881
##########
File path:
flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/util/HadoopUtils.java
##########
@@ -247,4 +248,46 @@ private static boolean addHadoopConfIfFound(
}
return foundHadoopConfiguration;
}
+
+ /**
+ * Set up the caller context [[callerContext]] by invoking Hadoop
CallerContext API of
+ * [[org.apache.hadoop.ipc.CallerContext]], which was added in hadoop 2.8.
+ */
+ public static void setCallerContext(
+ String callerContext, org.apache.flink.configuration.Configuration
flinkConfig) {
+ if (isMinHadoopVersion(2, 8)) {
+ try {
+ callerContext = truncateCallerContext(callerContext,
flinkConfig);
+ Class callerContextClass =
Class.forName("org.apache.hadoop.ipc.CallerContext");
Review comment:
It would be great if we could get rid of the reflection based code
paths. These are hard to maintain.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
##########
@@ -431,6 +433,29 @@ public Task(
// finally, create the executing thread, but do not start it
executingThread = new Thread(TASK_THREADS_GROUP, this,
taskNameWithSubtask);
+
+ // add CallerContext.
+ String callerContext =
+ "Flink_Task_"
+ + "JobID_"
+ + jobId
+ + "_TaskName_"
+ + taskInfo.getTaskName()
+ + "_"
+ + taskInfo.getAttemptNumber();
+
+ // First check if we have Hadoop in the ClassPath. If not, we simply
don't do anything.
+ try {
Review comment:
We shouldn't be leaking any hadoop related code into the Task
implementation. Ideally this change-set would be only local to the
`flink-hadoop-fs` module.
CallerContext is implemented using (inheritable) thread local, these are
pretty cheap to access. Can we simply re-set the context any time we're
accessing the FileSystem?
##########
File path:
flink-core/src/main/java/org/apache/flink/configuration/ExecutionOptions.java
##########
@@ -105,6 +105,14 @@
+ "throughput"))
.build());
+ public static final ConfigOption<String> CALLER_CONTEXT_APP_ID =
Review comment:
I don't think the hadoop specific options belong here. We should
introduce a new "options" class for this `HadoopOptions`.
--
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]