wangyum opened a new pull request, #17315: URL: https://github.com/apache/iceberg/pull/17315
### Description #14810 changed the serialized format of `DynamicWriteResultSerializer` by adding a `specId` field, but did not bump `getVersion()` from `1`. This breaks the `SimpleVersionedSerializer` versioning contract: a checkpoint produced with the pre-#14810 V1 format (no `specId`) would be deserialized using the new V1 code path (which expects `specId`), causing the `readInt()` for `specId` to consume the first four bytes of the `WriteResult` payload and corrupting the deserialized result. This PR fixes the issue by: - Bumping `getVersion()` to `2` - Introducing `deserializeV1()` that reads the old `WriteTarget`-based format (tableName, branch, schemaId, specId, upsertMode, equalityFields) and converts it to `TableKey` + `specId` - Introducing `deserializeV2()` for the current format (TableKey + specId + WriteResult) - Adding `testDeserializeV1Format` that manually constructs old V1-format bytes and verifies correct deserialization - Adding `testDeserializeV2Format` that manually constructs V2-format bytes and verifies correct deserialization This mirrors the pattern already used by `DynamicCommittableSerializer`, which was correctly versioned in the same commit. The fix is applied to all three Flink versions: v1.20, v2.0, and v2.1. ### Testing - `testRoundtrip` — verifies V2 serialize → deserialize roundtrip (existing, uses `getVersion()` which now returns 2) - `testDeserializeV1Format` — new test that constructs old V1-format bytes (WriteTarget serialization without separate specId field) and verifies the deserializer correctly extracts specId from WriteTarget and produces a valid DynamicWriteResult - `testDeserializeV2Format` — new test that explicitly constructs V2-format bytes (TableKey + specId + WriteResult) and verifies deserialization with version `2` - `testUnsupportedVersion` — verifies unknown versions throw (existing, unchanged) - All tests pass on `iceberg-flink-2.1` --- **AI Disclosure** - Model: GLM 5.2 - Platform/Tool: opencode - Human Oversight: fully reviewed - Prompt Summary: Fix DynamicWriteResultSerializer version not bumped after format change; add version-aware deserialization with V1 backward compatibility and tests. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
