[
https://issues.apache.org/jira/browse/FLINK-39740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18083013#comment-18083013
]
Jubin Soni commented on FLINK-39740:
------------------------------------
Opened a PR addressing this:
[FLINK#28240|https://github.com/apache/flink/pull/28240]
To fix this, I moved the {{highestSqnAndSizeState.update(...)}} call in
{{LinkedMultiSetState.add()}} inside the {{isNewRowKey}} branch.
I also added {{{}testAddAfterReplacingNonHighestRow{}}}, which covers the
replace-then-add sequence described in the JIRA. Without this fix, the next
newly added row reuses an existing SQN, causing a collision with an existing
node and silently corrupting the linked list.
> LinkedMultiSetState updates highestSqnAndSizeState unconditionally
> ------------------------------------------------------------------
>
> Key: FLINK-39740
> URL: https://issues.apache.org/jira/browse/FLINK-39740
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Runtime
> Affects Versions: 2.3.0
> Reporter: Roman Khachatryan
> Assignee: Roman Khachatryan
> Priority: Major
> Labels: pull-request-available
>
> In LinkedMultiSetState, highestSqnAndSizeState tracks the highest SQN. It
> grows monotinically and is used when linking rows in a double-linked list.
> To preserve monotonicity, it should only be incremented on new rows.
> However, it is currently updated (to a lower value) when a row is replaced,
> breaking the invariant.
> Linking of the next row added will be broken.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)