-
Notifications
You must be signed in to change notification settings - Fork 32
RSCBC-136: Rework kv client stack #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive rework of the KV client connection management stack, replacing the previous KvClientManager architecture with a new KvEndpointClientManager that uses a "babysitter" pattern for managing client lifecycle and health.
Key changes include:
- Introduction of
KvClientBabysitterto handle individual client lifecycle, automatic reconnection, and health monitoring - Replacement of
KvClientManagerwithKvEndpointClientManagerfor per-endpoint client pool management - Simplified client pool implementation focusing on client distribution rather than complex state management
- Error map support enabled by default in KV configuration
- Addition of fetch timeout configuration for config polling operations
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cluster_options.rs | Enables error map by default in KV configuration |
| vbucketrouter.rs | Removes unused KvClientManager import |
| searchcomponent.rs | Changes authenticator from Arc-wrapped to direct value |
| querycomponent.rs | Changes authenticator from Arc-wrapped to direct value |
| agent.rs | Major refactoring to use new KvEndpointClientManager and babysitter pattern |
| options/agent.rs | Adds error map and fetch timeout configuration options |
| mgmtcomponent.rs | Changes authenticator from Arc-wrapped to direct value |
| memdx/dispatcher.rs | Renames connection close handler to read loop close handler |
| memdx/client.rs | Updates to use renamed read loop close handler and improves error handling |
| lib.rs | Reorganizes module structure, adds new modules for refactored architecture |
| kvendpointclientmanager.rs | New file implementing endpoint-based client management |
| kvclientpool.rs | Complete rewrite simplifying pool to focus on client distribution |
| kvclientmanager.rs | File removed, functionality replaced by kvendpointclientmanager |
| kvclient_ops.rs | Updates dispatch error handling to mark clients as closed |
| kvclient_babysitter.rs | New file implementing automatic client lifecycle management |
| kvclient.rs | Major refactoring removing reconfigure logic, simplifying client creation |
| kv_orchestration.rs | New file providing orchestration helpers for KV operations |
| httpcomponent.rs | Changes authenticator from Arc-wrapped to direct value |
| diagnosticscomponent.rs | Updates to work with new endpoint client manager interface |
| crudcomponent.rs | Updates orchestration function calls for new architecture |
| configwatcher.rs | Updates to use KvEndpointClientManager interface |
| configmanager.rs | Adds endpoint_id parameter for out-of-band config fetching |
| configfetcher.rs | Adds timeout support for config fetch operations |
| componentconfigs.rs | New file centralizing component configuration generation |
| collection_resolver_memd.rs | Updates to use new orchestration functions |
Comments suppressed due to low confidence (2)
sdk/couchbase-core/src/memdx/client.rs:1
- The compare_exchange logic is inverted. It should return early if the value was already
true(i.e., already closed), but currently returns whencompare_exchangesucceeds. The condition should be== Ok(true)or the comparison should be checking forOk(false).
/*
sdk/couchbase-core/src/diagnosticscomponent.rs:1
- Changed log message from 'Out-of-band fetch from {endpoint} failed' to use {endpoint_id}. The variable name in the message should match the actual variable being referenced.
/*
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Matt-Woz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming FIT/FIT-SIT is happy, though you may want another pair of eyes as it's quite a significant change
|
|
||
| impl AgentInner { | ||
| pub async fn unsolicited_packet_handler(&self, packet: ResponsePacket) { | ||
| fn gen_agent_component_configs_locked(state: &AgentState) -> AgentComponentConfigs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense for this to be a method of AgentState?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it can be, as it updates all of the components that are a part of AgentInner too.
No description provided.