Caideyipi opened a new pull request, #18722:
URL: https://github.com/apache/iotdb/pull/18722
## Description
### Root cause
`PipeDataRegionSinkMetrics.bindTo()` snapshots sink task IDs before creating
their metrics. A concurrent `deregister()` could remove a task from `sinkMap`
after the snapshot but before metric creation dereferenced the task, causing a
null pointer exception during DataNode startup. In pipe integration tests this
surfaced as all JDBC endpoints remaining unavailable.
### Fix
Serialize `bindTo`, `unbindFrom`, `register`, and `deregister` on the
metrics instance. This keeps each sink task present for the complete metric
bind/unbind operation and makes metric-service and sink-task lifecycle
transitions atomic with respect to one another.
### Test
Add a deterministic latch-based concurrency test that pauses metric binding
inside a sink subtask and verifies deregistration cannot complete until binding
finishes.
Validation:
- `PipeDataRegionSinkMetricsTest`: 1 test, 0 failures, 0 errors
- `IoTDBPipeAutoConflictIT#testDoubleLivingAutoConflict`: passed
- Apache master DataNode test reactor: 28/28 modules passed
<hr>
This PR has:
- [x] been self-reviewed.
- [x] concurrent read and write
- [x] added unit tests to cover the lifecycle race.
- [x] been tested in a test IoTDB cluster.
<hr>
##### Key changed/added classes (or packages if there are too many classes)
in this PR
- `PipeDataRegionSinkMetrics`
- `PipeDataRegionSinkMetricsTest`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]