Skip to content

[To dev/1.3] Add extra client_ip and timeout columns for show queries#17348

Merged
Wei-hao-Li merged 2 commits intodev/1.3from
showQ-dev/1.3
Mar 25, 2026
Merged

[To dev/1.3] Add extra client_ip and timeout columns for show queries#17348
Wei-hao-Li merged 2 commits intodev/1.3from
showQ-dev/1.3

Conversation

@Wei-hao-Li
Copy link
Collaborator

@Wei-hao-Li Wei-hao-Li commented Mar 24, 2026

Uploading image.png…

Signed-off-by: Weihao Li <18110526956@163.com>
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 28.57143% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.37%. Comparing base (0f12dc5) to head (64d21a7).
⚠️ Report is 6 commits behind head on dev/1.3.

Files with missing lines Patch % Lines
...ache/iotdb/db/protocol/session/SessionManager.java 0.00% 5 Missing ⚠️
...e/iotdb/db/queryengine/common/MPPQueryContext.java 0.00% 3 Missing ⚠️
...pache/iotdb/db/queryengine/common/SessionInfo.java 62.50% 3 Missing ⚠️
...plan/planner/plan/node/source/ShowQueriesNode.java 0.00% 3 Missing ⚠️
.../db/queryengine/plan/execution/QueryExecution.java 0.00% 2 Missing ⚠️
...yengine/plan/execution/config/ConfigExecution.java 0.00% 2 Missing ⚠️
...in/java/org/apache/iotdb/db/audit/AuditLogger.java 0.00% 1 Missing ⚠️
.../protocol/legacy/IoTDBLegacyPipeReceiverAgent.java 0.00% 1 Missing ⚠️
...eceiver/protocol/legacy/loader/DeletionLoader.java 0.00% 1 Missing ⚠️
.../receiver/protocol/legacy/loader/TsFileLoader.java 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             dev/1.3   #17348   +/-   ##
==========================================
  Coverage      41.36%   41.37%           
- Complexity       198      227   +29     
==========================================
  Files           3594     3594           
  Lines         236612   236637   +25     
  Branches       28639    28641    +2     
==========================================
+ Hits           97882    97899   +17     
- Misses        138730   138738    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the SHOW QUERIES result schema to include client address (client_ip) and timeout, and threads the client address through query/session context so it can be surfaced by the operator.

Changes:

  • Add ClientIp and Timeout columns to SHOW QUERIES headers and populate them in ShowQueriesOperator.
  • Extend IQueryExecution / QueryExecution / ConfigExecution to expose client host/address and timeout.
  • Extend SessionInfo (and related construction sites) to carry client address and expose it via MPPQueryContext.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/logical/LogicalPlannerTestUtil.java Update SessionInfo construction to new signature.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/FragmentInstanceSerdeTest.java Update SessionInfo construction for serde tests.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/optimization/LimitOffsetPushDownTest.java Update SessionInfo construction in optimization tests.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeTest.java Update SessionInfo construction in analyze tests.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/MergeSortOperatorTest.java Update fake IQueryExecution for new interface methods.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java Update internal execution SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/IoTDBInternalLocalReporter.java Update internal SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/ShowQueriesNode.java Derive output column names from centralized show-queries headers.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/ConfigExecution.java Expose client host/address + timeout via IQueryExecution.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/QueryExecution.java Expose client host/address + timeout via IQueryExecution.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/IQueryExecution.java Add getClientHostname() and getTimeout() to execution API.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ShowQueriesOperator.java Write new ClientIp and Timeout columns into TsBlock.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java Update test helper SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/header/ColumnHeaderConstant.java Add show-queries column headers for ClientIp + Timeout.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/SessionInfo.java Add client address field and serialize/deserialize it.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/MPPQueryContext.java Expose client host/address via getClientHostName().
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java Populate SessionInfo with IClientSession.getClientAddress().
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java Update internal execution SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/TsFileLoader.java Update internal execution SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/DeletionLoader.java Update internal execution SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/IoTDBLegacyPipeReceiverAgent.java Update internal execution SessionInfo construction.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/AuditLogger.java Update internal SessionInfo construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

this.userQuery = userQuery;
}

public String getClientHostName() {
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getClientHostName() dereferences session without a null check, but this class already documents that many callers pass a null SessionInfo (see the TODO above). That means SHOW QUERIES (via QueryExecution.getClientHostname()) can NPE for queries created with a null session. Consider returning a safe default when session is null (e.g., empty string/"UNKNOWN") or enforcing non-null SessionInfo at construction time before exposing this method.

Suggested change
public String getClientHostName() {
public String getClientHostName() {
if (session == null || session.getCliHostname() == null) {
return "UNKNOWN";
}

Copilot uses AI. Check for mistakes.
Signed-off-by: Weihao Li <18110526956@163.com>

# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/AuditLogger.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/IoTDBLegacyPipeReceiverAgent.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/DeletionLoader.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/legacy/loader/TsFileLoader.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/MPPQueryContext.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/SessionInfo.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ShowQueriesOperator.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/ShowQueriesNode.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/IoTDBInternalLocalReporter.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java
@Wei-hao-Li Wei-hao-Li merged commit 71e4d64 into dev/1.3 Mar 25, 2026
16 of 17 checks passed
@sonarqubecloud
Copy link

@Wei-hao-Li Wei-hao-Li deleted the showQ-dev/1.3 branch March 25, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants