apache / apache/doris

[Enhancement] Inconsistent rowcount in `SHOW DATA` command across sessions

Open
#49,106 6 comments 0 reactions 0 assignees View on GitHub
difficulty/easy doris-future java
Dominant language
Java
Stars
15.9k
Forks
3.9k
Avg merge
2d 23h
Merged PRs (30d)
520

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.

### Description

**Version**: 3.0.3
**Issue**:
When executing the `SHOW DATA` command in different sessions, the `rowcount` value occasionally returns `0` inconsistently. Once a session initially succeeds or fails to retrieve the correct rowcount, subsequent executions in the same session persistently return the same result (either valid or `0`). This indicates potential caching or session state propagation issues in FE nodes.

**Key Observations**:
1. Behavior is inconsistent across sessions (some sessions return valid rowcount, others return `0`).
2. Session-level persistence of the result (no updates after initial success/failure).
3. Suspected link to FE master-slave synchronization or request forwarding logic.

### Related Context
- Potential root causes:
- Metrics not properly synchronized between FE nodes.
- `SHOW DATA` requests may not be forwarded to the master FE in some cases.
- Suggested fix: Override `getRedirectStatus` in `ShowDataStmt` to enforce forwarding to the master FE.

### Steps to Reproduce
1. Connect to a non-master FE node.
2. Open two separate sessions (e.g., via different clients).
3. Execute `SHOW DATA;` in both sessions.
4. Observe inconsistent `rowcount` values (`0` vs. valid count) across sessions.
5. Re-execute `SHOW DATA` in the same sessions; results remain unchanged.

### Expected Behavior
- Consistent `rowcount` across all sessions.
- Fresh metrics should be fetched on each execution (no session-level caching).

### Environment
- Cluster setup: 存算分离架构 (compute-storage separation).
- FE nodes: Master-slave deployment.

### Proposed Action
1. Verify if direct MySQL connection to the master FE resolves the issue.
2. Review `ShowDataStmt` request routing logic (`getRedirectStatus` override).
3. Ensure metrics are actively refreshed per request or synchronized across FEs.

### Solution

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.