You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "jt2594838 (via GitHub)" <gi...@apache.org> on 2026/04/23 11:07:02 UTC
[PR] Wait for consensus start before answering region requests [iotdb]
jt2594838 opened a new pull request, #17546:
URL: https://github.com/apache/iotdb/pull/17546
## Summary
- Add a lightweight polling utility (`Await` / `ConditionAwaiter`) in `node-commons` that provides a fluent API for waiting until a condition becomes true, with configurable timeout and poll interval.
- Introduce `DataNodeContext` inner class in `DataNode` to expose consensus initialization state (`isAllConsensusStarted()`), with `volatile` visibility on the underlying flags.
- Guard all region management RPCs in `DataNodeInternalRPCServiceImpl` (create/delete region, change leader, add/remove/delete/reset peer, notify migration) with a `waitForConsensusStarted()` check that polls up to 30 seconds before rejecting with `CONSENSUS_NOT_INITIALIZED`.
- This prevents race conditions where ConfigNode dispatches region requests to a DataNode whose consensus layer hasn't finished initializing after restart.
## Test plan
- [x] Unit tests for `Await` / `ConditionAwaiter` covering: already-true condition, condition becomes true, timeout, poll delay, exception ignoring, `untilAsserted`, `forever` mode (`AwaitTest`)
- [x] Unit tests for consensus wait behavior: `createSchemaRegion`, `createDataRegion`, `deleteRegion`, `changeRegionLeader` all reject with `CONSENSUS_NOT_INITIALIZED` when consensus is not started (`ConsensusWaitTest`)
- [x] Existing `DataNodeInternalRPCServiceImplTest` updated to pass a mocked `DataNodeContext` with consensus started
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Wait for consensus start before answering region requests [iotdb]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #17546:
URL: https://github.com/apache/iotdb/pull/17546#issuecomment-4304246464
## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/17546?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `72.09302%` with `36 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 39.82%. Comparing base ([`acaabb8`](https://app.codecov.io/gh/apache/iotdb/commit/acaabb8dc33c444971959651f38d558a74486377?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1f5671e`](https://app.codecov.io/gh/apache/iotdb/commit/1f5671e3cf72346b053050fc1558fc2d689803c2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/iotdb/pull/17546?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...ol/thrift/impl/DataNodeInternalRPCServiceImpl.java](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fprotocol%2Fthrift%2Fimpl%2FDataNodeInternalRPCServiceImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcHJvdG9jb2wvdGhyaWZ0L2ltcGwvRGF0YU5vZGVJbnRlcm5hbFJQQ1NlcnZpY2VJbXBsLmphdmE=) | 55.31% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...che/iotdb/commons/concurrent/ConditionAwaiter.java](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&filepath=iotdb-core%2Fnode-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fcommons%2Fconcurrent%2FConditionAwaiter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9ub2RlLWNvbW1vbnMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2lvdGRiL2NvbW1vbnMvY29uY3VycmVudC9Db25kaXRpb25Bd2FpdGVyLmphdmE=) | 86.56% | [9 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...e/iotdb/db/service/DataNodeInternalRPCService.java](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fservice%2FDataNodeInternalRPCService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvc2VydmljZS9EYXRhTm9kZUludGVybmFsUlBDU2VydmljZS5qYXZh) | 0.00% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ain/java/org/apache/iotdb/db/service/DataNode.java](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fservice%2FDataNode.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvc2VydmljZS9EYXRhTm9kZS5qYXZh) | 80.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/17546?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #17546 +/- ##
============================================
+ Coverage 39.80% 39.82% +0.01%
Complexity 312 312
============================================
Files 5142 5147 +5
Lines 347882 348086 +204
Branches 44404 44430 +26
============================================
+ Hits 138489 138610 +121
- Misses 209393 209476 +83
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/iotdb/pull/17546?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Wait for consensus start before answering region requests [iotdb]
Posted by "CRZbulabula (via GitHub)" <gi...@apache.org>.
CRZbulabula merged PR #17546:
URL: https://github.com/apache/iotdb/pull/17546
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Wait for consensus start before answering region requests [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17546:
URL: https://github.com/apache/iotdb/pull/17546#issuecomment-4303913071
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17546) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17546&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17546&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17546&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17546&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17546&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17546)
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Wait for consensus start before answering region requests [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17546:
URL: https://github.com/apache/iotdb/pull/17546#issuecomment-4309872570
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17546) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17546&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=17546&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=17546&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17546&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=17546&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=17546)
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org