bpattarkine opened a new pull request, #1503:
URL: https://github.com/apache/flink-agents/pull/1503

   Linked issue: #1431 ([serialization 
discussion](https://github.com/apache/flink-agents/issues/1431#issuecomment-7095939221))
   
   ### Purpose of change
   
   Agent jobs checkpoint keys with in-flight work using the same serializer as 
Flink keyed state. This gives job keys one serialization contract across the 
two state stores and lets jobs with explicit key serializers avoid a separate 
Kryo encoding for the processing-key list.
   
   #### Runtime flow
   
   During operator open, the state manager registers union-list state with a 
duplicate of the keyed backend's serializer. If Flink restored the legacy union 
list, the state manager transfers its keys and clears that list before recovery 
starts. Recovery filters the union list by key-group ownership, deduplicates 
owned keys, and resumes work for those keys.
   
   #### Key decisions
   
   The new union list has a distinct state name because Flink checks serializer 
compatibility when registering an existing state name. Flink restores the 
legacy entries using their original serializer before the transfer. This 
applies to the shared Java operator used by Java and PyFlink jobs.
   
   ### Behavioral Semantics
   
   #### Interaction decisions
   
   | Operator state at startup | Processing-key initialization |
   | --- | --- |
   | Fresh job | Register an empty union list with the input-key serializer. |
   | Legacy checkpoint or savepoint | Read the restored Kryo list, transfer its 
keys, and clear it. |
   | Checkpoint or savepoint written after the change | Continue with the 
input-key union list. A retained legacy list is empty. |
   
   #### Behavioral contracts
   
   1. New processing-key state uses the input-key serializer.
   2. Upgrading from legacy state preserves in-flight keys. After a rescale, 
only the owner subtask resumes the work.
   3. A checkpoint taken after the upgrade can restore the migrated keys and 
finish pending work.
   
   #### Failure behavior
   
   Flink fails operator startup if state registration or restore fails, 
including when a serializer is incompatible. Migration errors propagate through 
operator startup. The source checkpoint remains available for a retry.
   
   ### Tests
   
   | Contract | Evidence |
   | --- | --- |
   | The processing-key list uses the input-key serializer | 
`ActionExecutionOperatorTest.testRestoreOnlyResumesKeysOwnedByCurrentSubtask` 
checks the registered serializer and restores both formats. |
   | Legacy restore resumes only the owned key | The same test writes an active 
key via the legacy descriptor, rescales, checks owner and non-owner state, and 
confirms that the legacy list was cleared. 
`ActionExecutionOperatorMigrationTest.restoresStateAtRest` additionally 
restores the checked-in release snapshot. |
   | A migrated checkpoint restores and completes pending work | The same 
operator test restores a second checkpoint, checks the pending action's output, 
and verifies removal of the processing key after completion. |
   
   The focused Java reactor run passed on JDK 21 with 126 tests passed and 20 
skipped. A clean JDK 17 run passed four recovery cases, including both 
processing-key formats, the release snapshot, and in-flight admission-budget 
recovery. A standalone PyFlink cluster restore and downgrade from a checkpoint 
written by this version were outside this test run.
   
   `./tools/ut.sh -j` failed in `AgentPlanDeclareMCPServerTest`. The test's 
fixed port 8000 was occupied by a local DynamoDB container. A rerun excluding 
that class passed all eight rescaling cases and the 12 embedded Fluss store 
cases, and encountered four native Python integration errors because Pemja 
could not find a `python` executable.
   
   <details>
   <summary>Focused test command and migration coverage</summary>
   
   ```sh
   mvn -B --no-transfer-progress -pl runtime -am \
     
-Dtest=ActionExecutionOperatorTest,ActionExecutionOperatorMigrationTest,DurableExecutionManagerTest,CompileUtilsTest
 \
     -Dsurefire.failIfNoSpecifiedTests=false clean test
   ```
   
   The in-flight migration test writes the legacy descriptor through Flink's 
real operator backend. The historical release snapshot covers the at-rest 
upgrade separately.
   
   </details>
   
   ### API
   
   Java, Python, and YAML callers continue to use the existing API and job 
configuration. The job still requires `pipeline.generic-types=true`. Forward 
restore migrates the previous processing-key format. Rollback to a release that 
expects the old format requires a pre-upgrade savepoint.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [ ] `doc-not-needed`
   - [x] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Codex CLI 0.173.0 (GPT-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]

Reply via email to