Hi Flink developers,

I found an apparent bug in the State V2 overload of 
DefaultOperatorStateBackend.getUnionListState in Flink 2.x.

The implementation converts the V2 descriptor to V1, but delegates to 
getListState instead of getUnionListState:

@Override
public <S> org.apache.flink.api.common.state.v2.ListState<S> getUnionListState(
        org.apache.flink.api.common.state.v2.ListStateDescriptor<S> 
stateDescriptor)
        throws Exception {
    return new OperatorListStateAdaptor<>(
            
getListState(StateDescriptorUtils.transformFromV2ToV1(stateDescriptor)));
}

The getListState() method registers the state with Mode.SPLIT_DISTRIBUTE:

import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.state.ListStateDescriptor;

@Override
public <S> ListState<S> getListState(ListStateDescriptor<S> stateDescriptor) 
throws Exception {
    return getListState(stateDescriptor, 
OperatorStateHandle.Mode.SPLIT_DISTRIBUTE);
}

Confirmed it for: 
2.2.1<https://github.com/apache/flink/blob/release-2.2.1/flink-runtime/src/main/java/org/apache/flink/runtime/state/hashmap/HashMapStateBackend.java>,
 
2.3<https://github.com/apache/flink/blob/release-2.3.0/flink-runtime/src/main/java/org/apache/flink/runtime/state/DefaultOperatorStateBackend.java>
 and master (as of 2026-11-17).


This is inconsistent with the union redistribution contract: each restored 
subtask should receive all saved entries, rather than a partition of them.

Could you confirm whether this is a bug or intended behavior?

Best regards,
Artemiy Lazarev.
________________________________
??????????? ? ?????????????????? OZON: ????????? ?????? ? ??????????? ? ???? 
????????? ???????? ???????????????? ?????????? ? ????????????? ???????? ??????. 
???? ?? ?? ????????? ????????? ?????? ??? ???????? ??? ?? ??????, ??????????, 
???????? ?? ???? ??????????? ? ??????? ?????? ? ?????????? ? ???? ?? ???? ????? 
?????????. ???????????, ????????? ??? ??????????????? ?????? ? ?????????? ? 
???? ??????, ??????? ?????? ?? ???????????????, ???????? ????? ? ?????? 
?????????. OZON CONFIDENTIALITY NOTICE: This email and any documents attached 
to it contain confidential information addressed to the intended recipient. If 
you are not the intended recipient or have received this email in error, please 
notify the sender and delete this email and all attachments hereto from all 
your devices. Copying, distribution or dissemination of this email and its 
attachments by any persons whom the email has not been intended to, are 
unlawful and strictly prohibited.

Reply via email to