Repository navigation
Backport #19465: Include pending historical resources in Pipe estimates #19482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/1.3
Are you sure you want to change the base?
Changes from all commits
fc00413
df410d6
9f5b181
c26f88f
a5a6ae1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ public class PipeDataNodeRemainingEventAndTimeOperator extends PipeRemainingOper | |
| Collections.newSetFromMap(new ConcurrentHashMap<>()); | ||
|
|
||
| private final AtomicInteger insertNodeEventCount = new AtomicInteger(0); | ||
| private final AtomicInteger deletionEventCount = new AtomicInteger(0); | ||
| private final AtomicInteger rawTabletEventCount = new AtomicInteger(0); | ||
| private final AtomicInteger tsfileEventCount = new AtomicInteger(0); | ||
| private final AtomicInteger heartbeatEventCount = new AtomicInteger(0); | ||
|
|
@@ -80,6 +81,14 @@ void decreaseInsertNodeEventCount() { | |
| insertNodeEventCount.decrementAndGet(); | ||
| } | ||
|
|
||
| void increaseDeletionEventCount() { | ||
| deletionEventCount.incrementAndGet(); | ||
| } | ||
|
|
||
| void decreaseDeletionEventCount() { | ||
| deletionEventCount.decrementAndGet(); | ||
| } | ||
|
|
||
| void increaseRawTabletEventCount() { | ||
| rawTabletEventCount.incrementAndGet(); | ||
| } | ||
|
|
@@ -109,10 +118,10 @@ public long getRemainingNonHeartbeatEvents() { | |
| tsfileEventCount.get() | ||
| + rawTabletEventCount.get() | ||
| + insertNodeEventCount.get() | ||
| + deletionEventCount.get() | ||
| + dataRegionSources.stream() | ||
| .map(IoTDBDataRegionSource::getHistoricalTsFileInsertionEventCount) | ||
| .reduce(Integer::sum) | ||
| .orElse(0) | ||
| .mapToLong(IoTDBDataRegionSource::getHistoricalEventCount) | ||
| .sum() | ||
| + schemaRegionSources.stream() | ||
| .map(IoTDBSchemaRegionSource::getUnTransferredEventCount) | ||
| .reduce(Long::sum) | ||
|
|
@@ -140,11 +149,24 @@ public double getRemainingTime() { | |
| PipeConfig.getInstance().getPipeRemainingTimeCommitRateAverageTime(); | ||
|
|
||
| final double invocationValue = collectInvocationHistogram.getMean(); | ||
| final long pendingHistoricalEventCount = | ||
| dataRegionSources.stream().mapToLong(IoTDBDataRegionSource::getHistoricalEventCount).sum(); | ||
| final long pendingHistoricalTsFileEventCount = | ||
| dataRegionSources.stream() | ||
| .mapToLong(IoTDBDataRegionSource::getHistoricalTsFileInsertionEventCount) | ||
| .sum(); | ||
| final long pendingHistoricalNonTsFileEventCount = | ||
| Math.max(0, pendingHistoricalEventCount - pendingHistoricalTsFileEventCount); | ||
| // Do not take heartbeat event into account | ||
| final double totalDataRegionWriteEventCount = | ||
| tsfileEventCount.get() * Math.max(invocationValue, 1) | ||
| + rawTabletEventCount.get() | ||
| + insertNodeEventCount.get(); | ||
| calculateTotalDataRegionWriteEventCount( | ||
| tsfileEventCount.get(), | ||
| pendingHistoricalTsFileEventCount, | ||
| pendingHistoricalNonTsFileEventCount, | ||
| deletionEventCount.get(), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor
Fix: Route DeleteDataNode event commits to the data-region commit meter (e.g., make the delete-plan event report data-region commit rate in
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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). |
||
| rawTabletEventCount.get(), | ||
| insertNodeEventCount.get(), | ||
| invocationValue); | ||
|
|
||
| final Meter dataRegionMeter = dataRegionCommitMeter.get(); | ||
| if (Objects.nonNull(dataRegionMeter)) { | ||
|
|
@@ -192,6 +214,22 @@ public double getRemainingTime() { | |
| return result >= REMAINING_MAX_SECONDS ? REMAINING_MAX_SECONDS : result; | ||
| } | ||
|
|
||
| static double calculateTotalDataRegionWriteEventCount( | ||
| final long tsFileEventCount, | ||
| final long pendingHistoricalTsFileEventCount, | ||
| final long pendingHistoricalNonTsFileEventCount, | ||
| final long deletionEventCount, | ||
| final long rawTabletEventCount, | ||
| final long insertNodeEventCount, | ||
| final double invocationValue) { | ||
| return (tsFileEventCount + (double) pendingHistoricalTsFileEventCount) | ||
| * Math.max(invocationValue, 1) | ||
| + pendingHistoricalNonTsFileEventCount | ||
| + deletionEventCount | ||
| + rawTabletEventCount | ||
| + insertNodeEventCount; | ||
| } | ||
|
|
||
| //////////////////////////// Register & deregister (pipe integration) //////////////////////////// | ||
|
|
||
| void register(final IoTDBDataRegionSource source) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 testgetRemainingNonHeartbeatEvents() 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit
c26f88f6494d6a8ceced2858c781c72e5bb9fb34.PipeDataNodeSinglePipeMetricsTest#testDeregisterClearsOperatorsWhenMetricsAreUnboundnow stubsgetHistoricalEventCount()to1, matching the accessor used bygetRemainingNonHeartbeatEvents(). The focused clean DataNode test run passed: 6 tests, 0 failures, 0 errors, 0 skipped.