@@ -382,7 +382,7 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
382
382
NYdb::NPersQueue::TTopicReadSettings topicReadSettings;
383
383
topicReadSettings.Path (SourceParams.GetTopicPath ());
384
384
auto partitionsToRead = GetPartitionsToRead ();
385
- SRC_LOG_D (" PartitionsToRead: " << JoinSeq (" , " , partitionsToRead));
385
+ SRC_LOG_D (" RangesMode: " << RangesMode << " , PartitionsToRead: " << JoinSeq (" , " , partitionsToRead));
386
386
for (const auto partitionId : partitionsToRead) {
387
387
topicReadSettings.AppendPartitionGroupIds (partitionId);
388
388
}
@@ -495,6 +495,8 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
495
495
curBatch.Data .emplace_back (std::move (item));
496
496
curBatch.UsedSpace += size;
497
497
498
+ CheckAndUpdateOffset (message.GetPartitionStream (), message.GetOffset ());
499
+
498
500
auto & offsets = curBatch.OffsetRanges [message.GetPartitionStream ()];
499
501
if (!offsets.empty () && offsets.back ().second == message.GetOffset ()) {
500
502
offsets.back ().second = message.GetOffset () + 1 ;
@@ -577,6 +579,18 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
577
579
return std::make_pair (item, usedSpace);
578
580
}
579
581
582
+ void CheckAndUpdateOffset (const NYdb::NPersQueue::TPartitionStream::TPtr& partitionStreamPtr, ui64 offset) {
583
+ auto offsetIt = Self.LastOffsetByPartitionStream .find (partitionStreamPtr);
584
+ if (offsetIt == Self.LastOffsetByPartitionStream .end ()) {
585
+ Self.LastOffsetByPartitionStream [partitionStreamPtr] = offset;
586
+ return ;
587
+ }
588
+ ui64 lastOffset = offsetIt->second ;
589
+ if (offset <= lastOffset) {
590
+ ythrow yexception () << " Invalid message offset " << offset << " , last offset " << lastOffset;
591
+ }
592
+ }
593
+
580
594
TDqPqReadActor& Self;
581
595
ui32 BatchCapacity;
582
596
const TString& LogPrefix;
@@ -609,6 +623,7 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
609
623
std::queue<TReadyBatch> ReadyBuffer;
610
624
TMaybe<TDqSourceWatermarkTracker<TPartitionKey>> WatermarkTracker;
611
625
TMaybe<TInstant> NextIdlenesCheckAt;
626
+ THashMap<NYdb::NPersQueue::TPartitionStream::TPtr, ui64> LastOffsetByPartitionStream;
612
627
};
613
628
614
629
std::pair<IDqComputeActorAsyncInput*, NActors::IActor*> CreateDqPqReadActor (
0 commit comments