Skip to content

Conversation

@chvck
Copy link
Collaborator

@chvck chvck commented Oct 22, 2025

No description provided.

@chvck chvck requested a review from Copilot October 22, 2025 14:21
Copy link

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

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 KvClientBabysitter to handle individual client lifecycle, automatic reconnection, and health monitoring
  • Replacement of KvClientManager with KvEndpointClientManager for 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 when compare_exchange succeeds. The condition should be == Ok(true) or the comparison should be checking for Ok(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.

Copy link
Contributor

@Matt-Woz Matt-Woz left a 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 {
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@chvck chvck merged commit dc58be3 into main Oct 28, 2025
22 of 28 checks passed
@chvck chvck deleted the rscbc136 branch October 28, 2025 09:04
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