Skip to content

[fix](cloud) Preserve tablet stats when row-count version lookup fails - #70895

Merged
yujun777 merged 1 commit into
apache:masterfrom
yujun777:codex/fix-cloud-tablet-stats-batch
Nov 27, 2026
Merged

yujun777 merged 1 commit into
apache:masterfrom
yujun777:codex/fix-cloud-tablet-stats-batch

Conversation

@yujun777

Copy link
Copy Markdown
Contributor

Background

Cloud FE fetches statistics for batches of tablets. For changelog tablets it also requests the published partition version associated with the row count. The response already supports omitting that version, and FE treats absent coverage as unknown.

What problem does this PR solve?

Issue Number: None
Related PR: #69896 (introduced the optional row-count version read)
PR Type: Bugfix

Problem Summary:

A read or parse error on an optional partition version aborts the tablet statistics batch. For example, a request with a malformed changelog tablet version followed by an ordinary tablet with 100 rows returns a non-OK status, and FE discards the response. With this change the batch returns both statistics entries, omits the affected tablet's version, and reports the ordinary tablet's 100 rows.

Details

  • Frequency: Always when the optional lookup hits a read or parse error after the tablet stats were read successfully.
  • Root cause: GetTabletStats treated an optional coverage lookup like a tablet stats read error and returned an RPC-level failure before processing the rest of the batch.
  • Why existing tests missed it: The legacy and versioned GetTabletStats tests cover successful statistics reads, including valid coverage. The changelog SQL suites test the resulting row estimates without injecting a malformed optional version document into a mixed batch.
  • Fix: Keep the tablet stats, log the coverage error, and omit the optional field for the affected tablet. Missing partition versions still map to version 1 and errors when reading the stats themselves still fail the RPC.
  • Other paths and branches: The change covers both legacy and versioned Cloud metadata reads. The optional lookup is absent from the checked upstream 3.1, 4.0, 4.1, and 4.2 release branches.
  • Behavior change: An optional version-read error no longer discards independently readable tablet statistics in the same batch.

Testing

  • Both new ASAN tests fail against the baseline at the batch status assertion. The legacy path returns 1006 (malformed partition version) and the versioned path returns 1003 (invalid data).
  • All five GetTabletStats tests passed in the ASAN Cloud test runner, including the two new mixed-batch cases, normal legacy and versioned reads, and the HTTP stats path.
  • Clang-format v16 and clang-tidy passed. No live-cluster regression was run.

Release note

Cloud tablet statistics remain available when an optional changelog row-count version lookup fails.

Check List (For Author)

  • Behavior changed: Yes (see Details)
  • Does this need documentation: No
  • Pre-submission status: Ready

### Background

Cloud FE fetches statistics for batches of tablets. For changelog tablets it also requests the published partition version associated with the row count. The response already supports omitting that version, and FE treats absent coverage as unknown.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#69896 (introduced the optional row-count version read)
PR Type: Bugfix

Problem Summary:

A read or parse error on an optional partition version aborts the tablet statistics batch. For example, a request with a malformed changelog tablet version followed by an ordinary tablet with 100 rows returns a non-OK status, and FE discards the response. With this change the batch returns both statistics entries, omits the affected tablet's version, and reports the ordinary tablet's 100 rows.

### Details

- **Frequency:** Always when the optional lookup hits a read or parse error after the tablet stats were read successfully.
- **Root cause:** GetTabletStats treated an optional coverage lookup like a tablet stats read error and returned an RPC-level failure before processing the rest of the batch.
- **Why existing tests missed it:** The legacy and versioned GetTabletStats tests cover successful statistics reads, including valid coverage. The changelog SQL suites test the resulting row estimates without injecting a malformed optional version document into a mixed batch.
- **Fix:** Keep the tablet stats, log the coverage error, and omit the optional field for the affected tablet. Missing partition versions still map to version 1 and errors when reading the stats themselves still fail the RPC.
- **Other paths and branches:** The change covers both legacy and versioned Cloud metadata reads. The optional lookup is absent from the checked upstream 3.1, 4.0, 4.1, and 4.2 release branches.
- **Behavior change:** An optional version-read error no longer discards independently readable tablet statistics in the same batch.

### Testing

- Both new ASAN tests fail against the baseline at the batch status assertion. The legacy path returns 1006 (malformed partition version) and the versioned path returns 1003 (invalid data).
- All five GetTabletStats tests passed in the ASAN Cloud test runner, including the two new mixed-batch cases, normal legacy and versioned reads, and the HTTP stats path.
- Clang-format v16 and clang-tidy passed. No live-cluster regression was run.

### Release note

Cloud tablet statistics remain available when an optional changelog row-count version lookup fails.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready
@yujun777

Copy link
Copy Markdown
Contributor Author

run buildall

@yujun777

Copy link
Copy Markdown
Contributor Author

/review

@yujun777

Copy link
Copy Markdown
Contributor Author

Local pipeline review — ✅ PASS

schema: doris-repo-review/v1
status: PASS
pr: apache/doris#70895
commit: ff78fb13ce61610bd6279925f96350c5d3fb2908
base: a0662fea1d048695b751edc9b69933a12cd68eaf
reviewed_at: 2026-11-23T20:32+08:00
reviewer: yujun777
model: gpt-6-astra
effort: xhigh
findings: {blocker: 0, major: 0, minor: 0, nit: 0}
rounds: 1
converged: true

Notes for maintainers

  • cloud/src/meta-service/meta_service.cpp:3660-3668: optional coverage failures preserve successfully read statistics and omit coverage; required-statistics failures retain their non-OK behavior in both metadata layouts.
  • cloud/test/meta_service_versioned_read_test.cpp:866-935: both new tests inject real malformed version metadata into a mixed batch and check continued processing, absent coverage and the ordinary tablet's 100 rows. Review was read-only; ASAN red/green and format/tidy results are author-reported and were not rerun.

Reviewed locally with the doris-repo-review pipeline. Repository policy may accept this receipt for the matching commit; it is not a human Apache approval.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static review of PR #70895 at head ff78fb1 against base a0662fe converged in round 1. The change is focused: after tablet statistics have been read successfully, failures reading the optional row-count partition version are logged and the coverage field is omitted, while failures reading the required tablet statistics still return the existing non-OK response. I traced both legacy and versioned metadata paths, CloneChainReader fallback behavior, RPC preprocessing/status finalization, per-tablet transaction cleanup, and the FE CloudTabletStatMgr/Replica/MaterializedIndex consumers. The omitted-version handling preserves newer reports and causes refresh/exclusion once a published changelog version is required. No correctness, concurrency, lifecycle, compatibility, persistence, observability, performance, or security defect was substantiated. The added tests cover malformed version values in mixed batches for both legacy and versioned reads, continued processing, omitted coverage, and preservation of ordinary tablet rows. No additional user focus was supplied. Review validation was static inspection only; builds, tests, and runtime checks were not rerun. No existing blocking inline findings apply.

Review converged after 1 round(s).

@yujun777
yujun777 merged commit 7203c28 into apache:master Nov 27, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants