Aaron He created FLINK-41091:
--------------------------------
Summary: Honor null-entry removal and reject null maps in ForSt
asyncPutAll
Key: FLINK-41091
URL: https://issues.apache.org/jira/browse/FLINK-41091
Project: Flink
Issue Type: Bug
Components: Runtime / State Backends
Reporter: Aaron He
h2. Contract and observed mismatch
The V2 MapState.asyncPutAll contract says a null value removes that entry, an
empty map leaves state unchanged, and a null map pointer is not allowed.
ForStDBBunchPutRequest currently serializes every entry value. Separately,
ForStMapState.buildDBBunchPutRequest permits a null MAP_PUT_ALL payload, which
reaches the same null sentinel used by CLEAR.
h2. Proposed change
* Remove keys whose supplied map value is null; serialize only non-null values.
* Reject null MAP_PUT_ALL payloads before DB work.
* Preserve explicit CLEAR and empty-map behavior.
* Do not change serialization formats.
h2. Proposed regression
{noformat}
Initial: {remove: old, keep: retained}
asyncPutAll({remove: null, add: new})
Expected: {keep: retained, add: new}; contains(remove) == false
Initial: {keep: retained}
asyncPutAll(null)
Expected: rejected; existing state remains unchanged
./mvnw -pl flink-state-backends/flink-statebackend-forst
-Dtest=ForStWriteBatchOperationTest,ForStStateExecutorTest,ForStAsyncAndSyncCompatibilityTest
test
{noformat}
Also cover null for an absent key, a null-rejecting serializer, empty maps,
explicit CLEAR, and key/namespace isolation. No runtime reproduction or tests
have been performed.
h2. Public references
[V2
contract|https://github.com/apache/flink/blob/dd8eeed0d0216d79ee19218ef256e9869fa19d31/flink-core-api/src/main/java/org/apache/flink/api/common/state/v2/MapState.java#L72-L86]
[Bunch
request|https://github.com/apache/flink/blob/dd8eeed0d0216d79ee19218ef256e9869fa19d31/flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/ForStDBBunchPutRequest.java#L60-L78]
FLINK-40157 / [PR 28762|https://github.com/apache/flink/pull/28762] already
addressed null-marker serialization. This proposal does not repeat that change.
FLINK-38137 / PR 26831 concerns related synchronous handling.
h2. Acceptance criteria
Both null behaviors match the existing API contract, rejected null maps
preserve state, and explicit CLEAR/serialization compatibility remain intact.
h2. Proposed release note
ForSt asyncPutAll removes null-valued entries as documented and rejects a null
map without clearing existing state.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)