@@ -99,6 +99,7 @@ private Boolean fetchSingleStream()
99
99
private Boolean fetchMultipleStreams ()
100
100
throws Exception {
101
101
int numStreams = _streamConfigs .size ();
102
+ int permanentTopicIndex = 0 ;
102
103
for (int i = 0 ; i < numStreams ; i ++) {
103
104
StreamConfig streamConfig = _streamConfigs .get (i );
104
105
String topicName = streamConfig .getTopicName ();
@@ -107,21 +108,32 @@ private Boolean fetchMultipleStreams()
107
108
+ topicName ;
108
109
StreamConsumerFactory streamConsumerFactory = StreamConsumerFactoryProvider .create (streamConfig );
109
110
int index = i ;
111
+ int finalPermanentTopicIndex = permanentTopicIndex ;
112
+ // For permanent topics, we use the index of the stream config to get the partition group consumption status.
113
+ // For ephemeral backfill topics, we use the topic name to filter the partition group consumption status.
110
114
List <PartitionGroupConsumptionStatus > topicPartitionGroupConsumptionStatusList =
111
115
_partitionGroupConsumptionStatusList .stream ()
112
- .filter (partitionGroupConsumptionStatus -> IngestionConfigUtils .getStreamConfigIndexFromPinotPartitionId (
113
- partitionGroupConsumptionStatus .getPartitionGroupId ()) == index )
116
+ .filter (partitionGroupConsumptionStatus -> _streamConfigs .get (index ).isEphemeralBackfillTopic ()
117
+ ? _streamConfigs .get (index ).getTopicName ().equals (partitionGroupConsumptionStatus .getTopicName ())
118
+ : IngestionConfigUtils .getStreamConfigIndexFromPinotPartitionId (
119
+ partitionGroupConsumptionStatus .getPartitionGroupId ()) == finalPermanentTopicIndex )
114
120
.collect (Collectors .toList ());
115
121
try (StreamMetadataProvider streamMetadataProvider = streamConsumerFactory .createStreamMetadataProvider (
116
122
StreamConsumerFactory .getUniqueClientId (clientId ))) {
123
+ // Similarly, for ephemeral backfill topics, we create the partition group metadata with the topic name.
117
124
_newPartitionGroupMetadataList .addAll (
118
125
streamMetadataProvider .computePartitionGroupMetadata (clientId ,
119
- streamConfig , topicPartitionGroupConsumptionStatusList , /*maxWaitTimeMs=*/ 15000 ,
126
+ _streamConfigs . get ( i ) , topicPartitionGroupConsumptionStatusList , /*maxWaitTimeMs=*/ 15000 ,
120
127
_forceGetOffsetFromStream )
121
128
.stream ()
122
129
.map (metadata -> new PartitionGroupMetadata (
123
- IngestionConfigUtils .getPinotPartitionIdFromStreamPartitionId (metadata .getPartitionGroupId (),
124
- index ), metadata .getStartOffset ()))
130
+ _streamConfigs .get (finalPermanentTopicIndex ).isEphemeralBackfillTopic () ? _streamConfigs .get (index )
131
+ .getTopicName () : "" ,
132
+ _streamConfigs .get (finalPermanentTopicIndex ).isEphemeralBackfillTopic ()
133
+ ? metadata .getPartitionGroupId ()
134
+ : IngestionConfigUtils .getPinotPartitionIdFromStreamPartitionId (metadata .getPartitionGroupId (),
135
+ finalPermanentTopicIndex ),
136
+ metadata .getStartOffset ()))
125
137
.collect (Collectors .toList ()));
126
138
if (_exception != null ) {
127
139
// We had at least one failure, but succeeded now. Log an info
@@ -136,6 +148,7 @@ private Boolean fetchMultipleStreams()
136
148
_exception = e ;
137
149
throw e ;
138
150
}
151
+ permanentTopicIndex += _streamConfigs .get (i ).isEphemeralBackfillTopic () ? 0 : 1 ;
139
152
}
140
153
return Boolean .TRUE ;
141
154
}
0 commit comments