Skip to content

Commit

Permalink
Legacy checkpoint support (#38546)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrod authored Sep 13, 2023
1 parent cc54deb commit c8a5165
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ private EventHubsTriggerMetrics CreateTriggerMetrics(List<PartitionProperties> p
// In that case, LastEnqueuedSequenceNumber will be >= 0

if ((partitionProperties.LastEnqueuedSequenceNumber != -1 && partitionProperties.LastEnqueuedSequenceNumber != (checkpoint?.SequenceNumber ?? -1))
|| (checkpoint == null && partitionProperties.LastEnqueuedSequenceNumber >= 0))
|| (checkpoint == null && partitionProperties.LastEnqueuedSequenceNumber >= 0)
|| (checkpoint != null && checkpoint.Offset == null && partitionProperties.LastEnqueuedSequenceNumber >= 0))
{
long partitionUnprocessedEventCount = GetUnprocessedEventCount(partitionProperties, checkpoint);
totalUnprocessedEventCount += partitionUnprocessedEventCount;
Expand Down Expand Up @@ -157,6 +158,12 @@ private static long GetUnprocessedEventCount(PartitionProperties partitionInfo,
return 1;
}

// Legacy checkpoint support
if (checkpoint != null && checkpoint.Offset == null && partitionInfo.LastEnqueuedSequenceNumber >= 0)
{
return partitionInfo.LastEnqueuedSequenceNumber + 1;
}

var startingSequenceNumber = checkpoint?.SequenceNumber switch
{
// There was no checkpoint, use the beginning sequence number - 1, since
Expand Down

0 comments on commit c8a5165

Please sign in to comment.