1
0
mirror of synced 2025-12-19 10:00:34 -05:00

trigger-cdc: fix empty changes case

This commit is contained in:
matt.bayley
2025-12-18 22:09:23 -08:00
parent 14d4ce4f4f
commit f3b8079ae2
2 changed files with 9 additions and 2 deletions

View File

@@ -100,7 +100,7 @@ class TriggerUnsplittableSnapshotWithCursorPartition(
get() =
TriggerStreamStateValue.cursorIncrementalCheckpoint(
cursor,
cursorCheckpoint = streamState.cursorUpperBound!!,
cursorCheckpoint = streamState.cursorUpperBound ?: Jsons.nullNode(),
)
override val cursorUpperBoundQuery: SelectQuery
@@ -276,7 +276,7 @@ sealed class TriggerCursorPartition(
JdbcCursorPartition<TriggerStreamState> {
val cursorUpperBound: JsonNode
get() = explicitCursorUpperBound ?: streamState.cursorUpperBound!!
get() = explicitCursorUpperBound ?: streamState.cursorUpperBound ?: Jsons.nullNode()
val cursorUpperBoundFrom: From =
if (triggerCdcPartitionState == null) from
else

View File

@@ -63,6 +63,13 @@ class TriggerPartitionFactory(
val stream: Stream = streamFeedBootstrap.feed
val streamState: TriggerStreamState = streamState(streamFeedBootstrap)
val opaqueStateValue: OpaqueStateValue? = streamFeedBootstrap.currentState
// An empty table stream state will be marked as a nullNode. This prevents repeated attempt
// to read it
if (opaqueStateValue?.isNull == true) {
return null
}
if (opaqueStateValue == null) {
return coldStart(streamState)
}