perkolatte opened a new pull request, #71087:
URL: https://github.com/apache/doris/pull/71087

   ### Background
   
   A Remote Doris Catalog caches the partition metadata of tables in another 
Doris cluster. On refresh it sends the checksum of each cached partition to a 
remote FE, which returns only the partitions whose 
`Partition.getMetaChecksum()` differs. #63894 added the checksum so that 
replica changes that keep the visible version, such as a balance, still reach 
the cache. The client can reach any FE of the remote cluster.
   
   ### What problem does this PR solve?
   
   Issue Number: close #69251
   Related PR: #63894 (introduced the checksum and its `pathHash` input)
   PR Type: Bugfix
   
   Problem Summary:
   
   The checksum includes `Replica.pathHash`, which only the master FE learns 
from tablet reports; followers keep `-1`. When the catalog's requests reach the 
master and then a follower, or the other way round, every partition looks 
changed and the remote FE sends the full metadata of every partition again. The 
reporter saw this on a table with about 475 partitions. This PR leaves 
`pathHash` out of the checksum, so the master and the followers return the same 
checksum for the same metadata.
   
   | | Same partition, checksum on master vs follower |
   |---|---|
   | Before | `36f0e0d2...` vs `aee78794...` (differ, full refresh on each 
switch) |
   | After | equal |
   
   ### Details
   
   - **Frequency:** Always, on a remote cluster with more than one FE, whenever 
consecutive refreshes reach FEs with different `pathHash` values; the 
reproduction is in #69251.
   - **Root cause:** `Partition.getMetaChecksum()` hashes 
`replica.getPathHash()`. `pathHash` is set only on the master, from tablet 
reports, and is not written to the edit log, so a follower's replica keeps `-1`.
   - **Why existing tests missed it:** 
`MaterializedIndexTest#testPartitionMetaChecksumChangesOnReplicaQueryFields` 
asserted that a `pathHash` change must change the checksum, which is the 
behavior this PR removes; this PR updates that assertion. No unit test compared 
the checksum of a master's partition with a follower's copy. The regression 
suites under `external_table_p0/remote_doris/` reach the remote cluster through 
one FE address, so the FE never changes between refreshes.
   - **Fix:** drop `pathHash` (tag 7) from the checksum. It is only useful to 
the client if it changes what the client stores, and it does not: 
`LocalReplica.pathHash` has no `@SerializedName`, so the partition JSON sent to 
the client never carries it, the client's replicas keep `-1`, and 
`getQueryableReplicas()` skips its disk filter for them. A `pathHash` change 
therefore makes the client download metadata that is identical to what it 
already has. The other tagged fields keep their meaning and values, so cached 
checksums of partitions whose replicas have `pathHash = -1` stay valid after an 
upgrade.
   - **Other paths and branches:** the checksum is built only in 
`Partition.getMetaChecksum()`; the other replica fields it hashes (version, 
last failed version, state, bad, user drop) are persisted, so they are the same 
on every FE. `branch-4.2`, `branch-4.1`, and `branch-4.0` have no 
`getMetaChecksum()`, so only `master` has the bug.
   
   ### Testing
   
   - `MaterializedIndexTest#testPartitionMetaChecksumSameOnMasterAndFollower` 
(new): builds a partition whose replica has a `pathHash`, round-trips it 
through `GsonUtils.GSON` as a follower's or the client's copy would, checks the 
copy's `pathHash` is `-1`, and compares the checksums. On the code before this 
PR it fails with `expected: 
<36f0e0d21d36606c2c6c1ef1c8898dffa5f8a5e33246044b5abf776e28171366> but was: 
<aee7879468c4c63f88cc7ca655b9ca58ba474a60cbc7d05d1685f15ade1bf7dd>`; with it, 
all 16 tests in `MaterializedIndexTest` pass.
   - Ran locally with JDK 17: `MaterializedIndexTest` (16), 
`RemoteDorisExternalTableTest` (4), and `ExternalCatalogTest` (51) pass. 
`FeServiceClientTest#remoteCatalogRemainsPlaintextWhenLocalPrivateTlsIsEnabled` 
fails locally because the sparse checkout lacks 
`docker/thirdparties/.../generate-tls-fixture.sh` (`bash` exits 127); it does 
not touch the checksum.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: not run against a multi-FE 
remote cluster; the unit test covers the master and follower checksums
   
   ### AI Disclosure
   
   - Tool: Claude Code (Claude Opus 5.5)
   - Generated: code, tests, this description
   - Human review: not stated
   - Prompts: The author asked for unclaimed Doris FE bugs to fix and chose 
#69251.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to