Skip to content

Commit 6428005

Browse files
committed
revert realtime supply
1 parent 121b12a commit 6428005

1 file changed

Lines changed: 35 additions & 17 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/realtime/PipeRealtimeDataRegionHybridExtractor.java

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -314,24 +314,42 @@ private boolean mayTsFileLinkedCountReachDangerousThreshold(final PipeRealtimeEv
314314
}
315315

316316
@Override
317-
protected Event doSupply(final PipeRealtimeEvent realtimeEvent) {
318-
// Used to judge the type of the event, not directly for supplying.
319-
final Event eventToSupply = realtimeEvent.getEvent();
320-
if (eventToSupply instanceof TabletInsertionEvent) {
321-
return supplyTabletInsertion(realtimeEvent);
322-
} else if (eventToSupply instanceof TsFileInsertionEvent) {
323-
return supplyTsFileInsertion(realtimeEvent);
324-
} else if (eventToSupply instanceof PipeHeartbeatEvent) {
325-
return supplyHeartbeat(realtimeEvent);
326-
} else if (eventToSupply instanceof PipeSchemaRegionWritePlanEvent
327-
|| eventToSupply instanceof ProgressReportEvent) {
328-
return supplyDirectly(realtimeEvent);
329-
} else {
330-
throw new UnsupportedOperationException(
331-
String.format(
332-
"Unsupported event type %s for hybrid realtime extractor %s to supply.",
333-
eventToSupply.getClass(), this));
317+
public Event supply() {
318+
PipeRealtimeEvent realtimeEvent = (PipeRealtimeEvent) pendingQueue.directPoll();
319+
320+
while (realtimeEvent != null) {
321+
final Event suppliedEvent;
322+
323+
// Used to judge the type of the event, not directly for supplying.
324+
final Event eventToSupply = realtimeEvent.getEvent();
325+
if (eventToSupply instanceof TabletInsertionEvent) {
326+
suppliedEvent = supplyTabletInsertion(realtimeEvent);
327+
} else if (eventToSupply instanceof TsFileInsertionEvent) {
328+
suppliedEvent = supplyTsFileInsertion(realtimeEvent);
329+
} else if (eventToSupply instanceof PipeHeartbeatEvent) {
330+
suppliedEvent = supplyHeartbeat(realtimeEvent);
331+
} else if (eventToSupply instanceof PipeSchemaRegionWritePlanEvent
332+
|| eventToSupply instanceof ProgressReportEvent) {
333+
suppliedEvent = supplyDirectly(realtimeEvent);
334+
} else {
335+
throw new UnsupportedOperationException(
336+
String.format(
337+
"Unsupported event type %s for hybrid realtime extractor %s to supply.",
338+
eventToSupply.getClass(), this));
339+
}
340+
341+
realtimeEvent.decreaseReferenceCount(
342+
PipeRealtimeDataRegionHybridExtractor.class.getName(), false);
343+
344+
if (suppliedEvent != null) {
345+
return suppliedEvent;
346+
}
347+
348+
realtimeEvent = (PipeRealtimeEvent) pendingQueue.directPoll();
334349
}
350+
351+
// Means the pending queue is empty.
352+
return null;
335353
}
336354

337355
private Event supplyTabletInsertion(final PipeRealtimeEvent event) {

0 commit comments

Comments
 (0)