@@ -93,7 +93,7 @@ struct TEvPrivate {
93
93
class TDqPqReadActor : public NActors ::TActor<TDqPqReadActor>, public IDqComputeActorAsyncInput {
94
94
public:
95
95
using TPartitionKey = std::pair<TString, ui64>; // Cluster, partition id.
96
- using TDebugOffsets = TMaybe< std::pair<ui64, ui64>>;
96
+ using TDebugOffsets = THashMap<ui64, std::pair<ui64, ui64>>;
97
97
98
98
TDqPqReadActor (
99
99
ui64 inputIndex,
@@ -173,7 +173,7 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
173
173
174
174
DeferredCommits.emplace (checkpoint.GetId (), std::make_pair (std::move (CurrentDeferredCommit), CurrentDeferredCommitOffset));
175
175
CurrentDeferredCommit = NYdb::NTopic::TDeferredCommit ();
176
- CurrentDeferredCommitOffset.Clear ();
176
+ CurrentDeferredCommitOffset.clear ();
177
177
}
178
178
179
179
void LoadState (const NDqProto::TSourceState& state) override {
@@ -216,13 +216,13 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
216
216
217
217
void CommitState (const NDqProto::TCheckpoint& checkpoint) override {
218
218
const auto checkpointId = checkpoint.GetId ();
219
+ SRC_LOG_D (" Commit state, checkpoint " << checkpointId);
219
220
while (!DeferredCommits.empty () && DeferredCommits.front ().first <= checkpointId) {
221
+ SRC_LOG_D (" Commit checkpoint " << DeferredCommits.front ().first );
220
222
auto & valuePair = DeferredCommits.front ().second ;
221
- const auto & offsets = valuePair.second ;
222
- if (offsets.Empty ()) {
223
- SRC_LOG_D (" Commit offset: [ empty ]" );
224
- } else {
225
- SRC_LOG_D (" Commit offset: [" << offsets->first << " , " << offsets->second << " ]" );
223
+ const auto & offsetMap = valuePair.second ;
224
+ for (const auto & [partitionId, offsets]: offsetMap) {
225
+ SRC_LOG_D (" Commit offset, partition id " << partitionId << " [" << offsets.first << " , " << offsets.second << " )" );
226
226
}
227
227
valuePair.first .Commit ();
228
228
DeferredCommits.pop ();
@@ -434,11 +434,13 @@ class TDqPqReadActor : public NActors::TActor<TDqPqReadActor>, public IDqCompute
434
434
for (const auto & [PartitionSession, ranges] : readyBatch.OffsetRanges ) {
435
435
for (const auto & [start, end] : ranges) {
436
436
CurrentDeferredCommit.Add (PartitionSession, start, end);
437
- if (!CurrentDeferredCommitOffset) {
438
- CurrentDeferredCommitOffset = std::make_pair (start, end);
437
+ auto offsetsIt = CurrentDeferredCommitOffset.find (PartitionSession->GetPartitionId ());
438
+ if (offsetsIt == CurrentDeferredCommitOffset.end ()) {
439
+ CurrentDeferredCommitOffset[PartitionSession->GetPartitionId ()] = std::make_pair (start, end);
439
440
} else {
440
- CurrentDeferredCommitOffset->first = std::min (CurrentDeferredCommitOffset->first , start);
441
- CurrentDeferredCommitOffset->second = std::max (CurrentDeferredCommitOffset->second , end);
441
+ auto & offsets = offsetsIt->second ;
442
+ offsets.first = std::min (offsets.first , start);
443
+ offsets.second = std::max (offsets.second , end);
442
444
}
443
445
}
444
446
PartitionToOffset[MakePartitionKey (PartitionSession)] = ranges.back ().second ;
0 commit comments