Skip to content

branch-4.0: [opt](memory) Remove unused dbId field from CloudReplica #62079#62597

Open
dataroaring wants to merge 1 commit intoapache:branch-4.0from
dataroaring:pick/62079-branch-4.0
Open

branch-4.0: [opt](memory) Remove unused dbId field from CloudReplica #62079#62597
dataroaring wants to merge 1 commit intoapache:branch-4.0from
dataroaring:pick/62079-branch-4.0

Conversation

@dataroaring
Copy link
Copy Markdown
Contributor

pick #62079

Conflict resolution

Trivial conflict on line 63 of CloudReplica.java:

  • Master initialized primaryClusterToBackend = new ConcurrentHashMap<>() (from a separate PR)
  • Branch-4.0 still has = null

Resolution: kept branch-4.0's = null initialization unchanged, and only applied this PR's scope (removing the dbId field, constructor assignment, and getDbId() getter). No CloudReplica callers of getDbId() exist on branch-4.0.


🤖 Generated by ThinkOps — autonomous agent pipeline

- Remove the `dbId` field and its `@SerializedName` from `CloudReplica`,
saving 8 bytes per replica object
- No external callers read `dbId` from CloudReplica — all callers use
`TabletMeta.getDbId()` via the inverted index instead
- Constructor parameter is kept for source compatibility but the value
is no longer stored
- Gson silently ignores unknown keys when deserializing old images, so
backward compatibility is maintained

-8 bytes/replica. At 10M replicas: ~76 MB saved. At 100M replicas: ~763
MB saved.

- [ ] Existing cloud tests pass (`mvn test -pl fe/fe-core
-Dtest="*Cloud*"`)
- [ ] Gson backward compatibility: old-format JSON with "dbId" key
deserializes without errors (silently ignored)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit 186a53e)

Generated by ThinkOps
Copilot AI review requested due to automatic review settings April 17, 2026 12:38
@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Apr 17, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring
Copy link
Copy Markdown
Contributor Author

run buildall

Copy link
Copy Markdown
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

Backports an optimization from master to reduce FE memory usage by removing the unused dbId state from CloudReplica (a persisted/serialized metadata object in cloud mode).

Changes:

  • Removes the dbId field (and its @SerializedName) from CloudReplica.
  • Removes the constructor assignment to dbId.
  • Removes the getDbId() getter from CloudReplica.

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

@@ -562,10 +559,6 @@ public boolean checkVersionCatchUp(long expectedVersion, boolean ignoreAlter) {
return true;
}

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

CloudReplica#getDbId() was removed, but there are still call sites on this branch that use it (e.g. CloudTabletRebalancer calls cloudReplica.getDbId() when looking up the database and building UpdateCloudReplicaInfo). This change will break compilation and/or runtime behavior unless those callers are migrated to obtain dbId from TabletMeta/TabletInvertedIndex (or the dbId getter/field is kept for this branch).

Suggested change
public long getDbId() {
return dbId;
}

Copilot uses AI. Check for mistakes.
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