JackieTien97 opened a new pull request, #17358:
URL: https://github.com/apache/iotdb/pull/17358

   This pull request introduces improvements to query execution management and 
resource cleanup in the IoTDB data node, with a focus on more accurate tracking 
of query execution time, robust handling of killed or missing queries, and 
improved resource cleanup logic. The most significant changes include the 
addition of per-RPC execution time tracking, better error responses for killed 
queries, and refactoring of resource cleanup mechanisms. 
   
   **Query Execution Time Tracking and Management**
   * Added `updateCurrentRpcStartTime(long startTime)` method to the 
`IQueryExecution` interface and its implementations (`QueryExecution`, 
`ConfigExecution`) to enable accurate measurement of per-RPC execution time and 
total query execution time, including in-progress RPCs. Adjusted 
`recordExecutionTime` and `getTotalExecutionTime` accordingly. 
[[1]](diffhunk://#diff-cd25d52be86611d80ee9e8a9c51957ea6540229f63c328b1da47b68d42b3f988R62-R69)
 
[[2]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14L107-R115)
 
[[3]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14L651-R664)
 
[[4]](diffhunk://#diff-560aa85e7687fc543527c1c881cc468500b8a579d340fad50f01a942a50e6b39R248-R261)
   * Updated test stubs to implement the new `updateCurrentRpcStartTime` method.
   
   **Query Resource Cleanup and Error Handling**
   * Improved resource cleanup logic by removing the now-unnecessary 
`stopAndCleanup()` method and ensuring that cleanup is triggered only when 
appropriate, such as when a client connection is inactive. Added a method to 
clear the coordinator context map if needed. 
[[1]](diffhunk://#diff-cd25d52be86611d80ee9e8a9c51957ea6540229f63c328b1da47b68d42b3f988L36-L37)
 
[[2]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14L327-L332)
 
[[3]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14L388-R392)
 
[[4]](diffhunk://#diff-560aa85e7687fc543527c1c881cc468500b8a579d340fad50f01a942a50e6b39L147-L151)
 
[[5]](diffhunk://#diff-5442791184ee0d27f62faaea0170f818c51e31e7d41c48ae8895e1b65beba3f6L1822-L1824)
   * Modified `Coordinator.cleanupQueryExecution` to remove the query execution 
from the map at the start of the cleanup process, ensuring proper resource 
release.
   
   **Client RPC Service Improvements**
   * Enhanced error handling in `ClientRPCServiceImpl` for the `fetchResults` 
and `fetchResultsV2` methods: now returns a specific error status and message 
when a query is not found (e.g., killed, timed out), instead of a generic 
response. 
[[1]](diffhunk://#diff-410a35edb015bf422e524141abcd65efc7d0287d174211b6785de54e1e20809cR208)
 
[[2]](diffhunk://#diff-410a35edb015bf422e524141abcd65efc7d0287d174211b6785de54e1e20809cR245-R247)
 
[[3]](diffhunk://#diff-410a35edb015bf422e524141abcd65efc7d0287d174211b6785de54e1e20809cL1150-R1165)
 
[[4]](diffhunk://#diff-410a35edb015bf422e524141abcd65efc7d0287d174211b6785de54e1e20809cL1689-R1705)
   
   **Code Quality and Testability**
   * Added `@TestOnly` annotations to certain constructors in `MPPQueryContext` 
to clarify their intended usage and refactored constructor chaining for better 
maintainability. 
[[1]](diffhunk://#diff-537d556719ade52650789610c54513b813a95fd2032f21c40581dff52e5aad06R24)
 
[[2]](diffhunk://#diff-537d556719ade52650789610c54513b813a95fd2032f21c40581dff52e5aad06R99-R114)
   
   **Miscellaneous**
   * Minor improvements and clarifications in comments and code organization 
related to result handle cleanup and metrics. 
[[1]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14L341-R346)
 
[[2]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14L132-R147)
 
[[3]](diffhunk://#diff-2182644dc6b22776638bf52c6e05a478c1a0d73789666785ab685ec1c0ad4a14R40)
   
   These changes collectively improve the reliability, observability, and 
maintainability of query execution and resource management in the IoTDB data 
node.


-- 
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]

Reply via email to