-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
FLINK-36540.[Runtime / Task] Add Support for Hadoop Caller Context when using Flink to operate hdfs. #25516
base: master
Are you sure you want to change the base?
Conversation
@flinkbot run azure re-run the last Azure build |
@xintongsong |
@dmvk @fapaul @ferenc-csaky |
Sorry for the late response. I was on a business travel for the past 2 weeks. I'm not entirely sure about this feature. Why do we need thread level audit logs? Wouldn't it be good enough to launch Flink processes with different UGIs? My biggest concern for this PR is that, it invades the common modules (i.e. flink-core & flink-runtime) with Hadoop specific logics. E.g., when generating the I haven't look into whether there's a better way to implement this. But for the current implementation, I'd be negative for merging it. |
I agree with @xintongsong's main concern regarding the submitted code. We should definitely avoid adding implementation specific logic to the general base components |
… yarn
What is the purpose of the change
As described in FLINK-36540.
When we use Flink to delete or write or modify files on Hadoop filesystem, callerContext is a helpful feature if we want to trace who did the operation or count how many files an application can create on hadoop filesystem. So I add a new Option so that when we enable callerContext in Flink, we can set a ThreadLocal value for each task so that we can trace it in hadoop's audit.log.
What's more, with this new feature and history json files in history server, we can calculate how many read operations and write operations a Flink application did to hdfs, and find out if there is a pressure or bottleneck to operate on hdfs files.
Brief change log
setCallerContext
in HadoopUtils.javastartTaskThread
in Task.java and add a new methodgetIsCallerContextEnabled
in Task.javaVerifying this change
Please make sure both new and modified tests in this PR follow the conventions for tests defined in our code quality guide.
This change added tests and can be verified as follows:
(example:)
I rebuild this project, and test the new jar file in my cluster, it prints out the correct caller context as expected

Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation