Skip to content

feat: support namespace prefix for etcd key.#56

Merged
JimHsiung merged 1 commit into
jd-opensource:mainfrom
JimHsiung:feat/etcd-namespace
Apr 7, 2026
Merged

feat: support namespace prefix for etcd key.#56
JimHsiung merged 1 commit into
jd-opensource:mainfrom
JimHsiung:feat/etcd-namespace

Conversation

@JimHsiung
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for an optional etcd namespace prefix to isolate keys within the xllm-service. It adds configuration flags, utility functions for normalization, and updates various managers (InstanceMgr, GlobalKVCacheMgr, Scheduler) to apply the namespace to their respective etcd keys. Feedback highlights concerns regarding the leaky abstraction in EtcdClient where namespacing isn't handled transparently for all operations, the duplication of key-building logic across multiple components, and the use of hardcoded shared keys instead of centralized constants.

Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp
Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp Outdated
Comment thread xllm_service/scheduler/managers/instance_mgr.cpp Outdated
@JimHsiung
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for etcd namespaces across the xllm_service components. It adds a new configuration flag etcd_namespace, utility functions for normalizing and building namespaced keys, and updates the EtcdClient, GlobalKVCacheMgr, InstanceMgr, and Scheduler to ensure all etcd keys are correctly prefixed. I have no feedback to provide.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces etcd namespacing support for the xllm_service, allowing all etcd keys to be prefixed with a configurable namespace. The changes include a new etcd_namespace flag, utility functions for namespace normalization and key construction, and updates to EtcdClient to ensure all operations use namespaced keys. The review feedback identifies several performance optimization opportunities within EtcdClient where namespaced key calculations are performed redundantly inside loops and should be moved outside to improve efficiency.

Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp
Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp Outdated
Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp Outdated
Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp Outdated
Comment thread xllm_service/scheduler/etcd_client/etcd_client.h Outdated
@JimHsiung JimHsiung force-pushed the feat/etcd-namespace branch from 293610f to 2181880 Compare April 5, 2026 12:06
@JimHsiung
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for etcd namespaces within the xllm-service. It adds a new configuration flag, utility functions for key normalization, and updates the EtcdClient to automatically prefix keys with the provided namespace. A critical issue was identified in the batch set implementation of EtcdClient, where the function ignores the accumulated success status and always returns true, preventing callers from detecting failures.

Comment thread xllm_service/scheduler/etcd_client/etcd_client.cpp
@JimHsiung JimHsiung force-pushed the feat/etcd-namespace branch from 2181880 to 92c013a Compare April 5, 2026 12:15
@JimHsiung
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for etcd namespaces within the xllm_service. It adds a new etcd_namespace configuration flag, provides utility functions for namespace normalization and key construction, and updates the EtcdClient to automatically prepend the namespace prefix to all etcd keys. A critical issue was identified in the template set function for unordered_map in etcd_client.h, which calculates an operation success status but fails to return it, potentially leading to silent failures.

Comment thread xllm_service/scheduler/etcd_client/etcd_client.h
@JimHsiung JimHsiung force-pushed the feat/etcd-namespace branch from 92c013a to 80a6eee Compare April 5, 2026 12:20
@JimHsiung
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for an optional etcd namespace prefix, allowing keys to be scoped (e.g., for different environments like 'prod-a'). Changes include adding the etcd_namespace flag, implementing utility functions for path normalization and key construction, and updating EtcdClient to wrap all operations with the namespace prefix. Additionally, a bug was fixed in the EtcdClient::set methods to correctly return the cumulative success status of batch operations. I have no further feedback to provide.

Copy link
Copy Markdown
Collaborator

@yq33victor yq33victor left a comment

Choose a reason for hiding this comment

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

LGTM

@JimHsiung JimHsiung merged commit 9a38f69 into jd-opensource:main Apr 7, 2026
1 check passed
@JimHsiung JimHsiung deleted the feat/etcd-namespace branch April 7, 2026 06:53
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