Repository navigation
Conversation
* fix(pipe): account for pending historical events * test: update historical event count mock (cherry picked from commit 21339dc)
| tsfileEventCount.get(), | ||
| pendingHistoricalTsFileEventCount, | ||
| pendingHistoricalNonTsFileEventCount, | ||
| deletionEventCount.get(), |
There was a problem hiding this comment.
minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeRemainingEventAndTimeOperator.java:166 — Deletion events counted in data-region numerator but delete commits mark the schema-region meter
deletionEventCount is added to totalDataRegionWriteEventCount (line 166), yet in dev/1.3 a delete event is a PipeSchemaRegionWritePlanEvent and EnrichedEvent.isDataRegionEvent() returns false for PipeWritePlanEvents, so PipeDataNodeSinglePipeMetrics.markRegionCommit records delete commits on the schema-region meter. Trigger: a pipe whose only DML is deletions (source.inclusion=data.delete) or any moment with a pending deletion and no data-region commit in the rate window. Result: dataRegionCommitMeter rate is 0, so lines 180-183 yield Double.MAX_VALUE and getRemainingTime() saturates at REMAINING_MAX_SECONDS (1 year) instead of 0/converging (master's PipeDeleteDataNodeEvent is a data-region event, so this mismatch is backport-specific).
Fix: Route DeleteDataNode event commits to the data-region commit meter (e.g., make the delete-plan event report data-region commit rate in PipeEventCommitManager.commit/markRegionCommit), or keep deletionEventCount out of the data-region numerator until a matching deletion rate exists.
There was a problem hiding this comment.
Thanks for catching this. In dev/1.3, DeleteDataNode commits are wrapped in PipeSchemaRegionWritePlanEvent, so they were marked as schema-region commits even though deletion events are included in the data-region remaining-work numerator. I updated the event classification so delete-plan commits use the data-region rate and added a regression assertion. The focused DataNode test passes (4 tests).
|
Addressed the deletion commit-rate review comment.
|
| .map(IoTDBDataRegionSource::getHistoricalTsFileInsertionEventCount) | ||
| .reduce(Integer::sum) | ||
| .orElse(0) | ||
| .mapToLong(IoTDBDataRegionSource::getHistoricalEventCount) |
There was a problem hiding this comment.
major iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/overview/PipeDataNodeRemainingEventAndTimeOperator.java:123 — Switching remaining-event source to getHistoricalEventCount breaks existing dev/1.3 test
getRemainingNonHeartbeatEvents() now sums IoTDBDataRegionSource.getHistoricalEventCount(), but PipeDataNodeSinglePipeMetricsTest#testDeregisterClearsOperatorsWhenMetricsAreUnbound (added to dev/1.3 by #19390, kept unchanged here) still stubs only getHistoricalTsFileInsertionEventCount() -> 1 at line 130 and asserts remaining events == 1 at lines 142-143. The mock's getHistoricalEventCount() returns 0, so the assertion becomes expected:<1> but was:<0> and the DataNode test run fails.
Fix: Update that test to stub getHistoricalEventCount() to 1 (as the source commit did for the same test), or stub both getHistoricalEventCount() and getHistoricalTsFileInsertionEventCount().
There was a problem hiding this comment.
Fixed in commit c26f88f6494d6a8ceced2858c781c72e5bb9fb34. PipeDataNodeSinglePipeMetricsTest#testDeregisterClearsOperatorsWhenMetricsAreUnbound now stubs getHistoricalEventCount() to 1, matching the accessor used by getRemainingNonHeartbeatEvents(). The focused clean DataNode test run passed: 6 tests, 0 failures, 0 errors, 0 skipped.
|
Review follow-up for reviewed head
|
|
|
||
| @Override | ||
| public int getPendingQueueSize() { | ||
| public synchronized int getPendingQueueSize() { |
There was a problem hiding this comment.
minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/historical/PipeHistoricalDataRegionTsFileSource.java:999 — Synchronized pending-count getters block SHOW PIPES and metric gauges during historical start/supply
getPendingQueueSize()/getPendingTsFileInsertionEventCount() are now synchronized, so SHOW PIPES and the UNPROCESSED_HISTORICAL_TSFILE_COUNT/remaining-event gauges (via IoTDBDataRegionSource.getHistoricalEventCount/getHistoricalTsFileInsertionEventCount) wait on the extractor monitor, which start() holds across the data-region flush + pinning of all TsFiles and supply() holds across the TsFile hardlink/copy. hasBeenStarted is set before historicalExtractor.start(), so the wait is reachable; these reads took no lock before.
Fix: Publish the pending counters (and pendingQueue) as volatile fields written under the lock and keep the getters non-blocking, or move flush/pinning out of the synchronized start()/supply().
There was a problem hiding this comment.
Thanks for the report. I kept the mutable pendingQueue protected by the source monitor and added a volatile queue-size snapshot plus a volatile insertion count. Both getters are now lock-free, and the snapshot is updated when the queue is initialized, polled, or closed. The regression tests cover the values after polling/close and verify that both getters return while the source monitor is held. The focused DataNode test class passes (24 tests, 0 failures, 0 errors, 0 skipped).
|
Comment-handling follow-up for reviewed head
|
Backport of #19465 to dev/1.3 (source commit 21339dc).
Scenario and behavior
Suppose a pipe has one real-time TsFile event with a mean collection-invocation count of 100 and two pending historical TsFile insertions. Previously, the remaining-time estimate used only the real-time event (100 work units); it now includes the historical insertions (300 work units), before adding any separate pending progress-report or deletion events.
Real-time DeleteDataNode events remain counted until their references are released. Historical progress-report resources remain distinct from TsFile insertion candidates and are not multiplied by the TsFile invocation average.
Compatibility
In dev/1.3, real-time deletions are carried by PipeSchemaRegionWritePlanEvent, and historical files are queued by PipeHistoricalDataRegionTsFileSource. This backport applies the source behavior through those equivalent APIs and deregisters closed sources from the remaining-event metric.
Validation