Izeren opened a new pull request, #28917: URL: https://github.com/apache/flink/pull/28917
## What is the purpose of the change This is a follow-up to FLINK-40208, which introduced `JobMdcRegistry` for config-driven MDC enrichment in Flink jobs. This PR adds missing test coverage for three execution paths not exercised by the base PR, and adds a blank-key guard to `MdcUtils`. ## Brief change log - Added `testJobMdcContextRegisteredOnSubmitTaskWithOffloadedJobInfo` in `TaskExecutorSubmissionTest` — verifies that MDC context is registered when job information arrives via the blob store (offloaded path) rather than inline - Added `testJobMdcContextUnregisteredOnJobRelease` in `TaskExecutorSubmissionTest` — verifies that MDC context is cleared from the process-wide registry when a job's slot is freed - Added `testJobMdcContextRegisteredOnRecovery` in `DispatcherTest` — verifies that MDC context is populated when the Dispatcher recovers a job (the `recoverJob` path), not only on fresh submission - Added blank-key guard in `MdcUtils.asContextData(JobID, Configuration)`: entries whose config key or MDC key is blank are skipped with a one-per-key warning (deduplication via `ConcurrentHashMap.newKeySet()`) - Added `@ThreadSafe` annotation to `MdcUtils` and `@VisibleForTesting clearWarnedKeyNames()` to make the dedup set resettable in tests - Fixed sidebar weight for `logging_context.md` (was 7, changed to 9 to avoid collision with an existing entry at weight 8) - Added `setTaskExecutorBlobService` to `TaskSubmissionTestEnvironment.Builder` to support the offloaded-job-info test scenario ## Verifying this change This change added tests and can be verified as follows: - Added `testJobMdcContextRegisteredOnSubmitTaskWithOffloadedJobInfo` — uses a real `BlobServer` with `OFFLOAD_MINSIZE=0` to force offloading, submits the task, and asserts MDC entries are populated after `loadBigData` resolves the blob - Added `testJobMdcContextUnregisteredOnJobRelease` — submits a task, waits for it to finish, frees the slot, and asserts the registry entry is cleared - Added `testJobMdcContextRegisteredOnRecovery` — puts a job graph with MDC config into the `ExecutionGraphStore` and calls `recoverJobs`, then asserts MDC entries are present - Added `testBlankMdcKeyIsIgnored` and `testBlankJobConfigKeyIsIgnored` in `MdcUtilsTest` — verify that blank keys are silently skipped and a warning is logged exactly once per key name ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: no - The S3 file system connector: no ## Documentation - Does this pull request introduce a new feature? no (test coverage and defensive guard for FLINK-40208) - If yes, how is the feature documented? not applicable --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Claude Code (claude-sonnet-4-6) -- 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]
