Skip to content

feat: add per-connection full service container and move plugin chain… - #175

Open
yanw-bq wants to merge 1 commit into
feat/core-servicefrom
feat/full-service-container
Open

yanw-bq wants to merge 1 commit into
feat/core-servicefrom
feat/full-service-container

Conversation

@yanw-bq

@yanw-bq yanw-bq commented Oct 27, 2026

Copy link
Copy Markdown

Summary

Add a FullServiceContainer to every connection handle (DBC), holding the services the connection uses, and move ownership of the plugin chain from PluginService to a new PluginManager

Description

  • FullServiceContainer (driver/util/full_service_container.{h,cpp}): one per DBC, created with the DBC (DBC::service_container).
    • StorageService& and MonitorService&, retrieved from CoreService::Instance().
    • PluginService and PluginManager, created on the first connect by InitConnectionServices(). They need the connection attributes, and are kept across SQLDisconnect and reused on reconnect, the same as before. The PluginManager is only stored once its chain has built, so a chain that fails to build is retried on the next connect.
    • InitMonitoringServices() creates the PluginService and the reduced plugin chain for the DBC a monitor opens its connections from.
    • Members are destroyed in reverse order, so the plugin chain goes before the PluginService it uses.
  • PluginManager (driver/util/plugin_manager.{h,cpp}): owns the plugin chain and is the entry point for calls into it (Connect, Execute, ReleaseResources). GetPluginChain() is for the code that keeps the chain's head.
  • Removed DBC::plugin_service, DBC::plugin_head, PluginService::plugin_chain_ and PluginService::Get/SetPluginChain(). Access to the PluginService now goes through the container.
  • PluginChainBuilder:
    • Build(dbc) holds the chain construction moved out of RDS_InitializeConnection, unchanged: same plugins, order and errors.
    • MonitoringBuild(dbc) no longer takes or sets the PluginService.
    • odbcapi_rds_helper.cpp no longer includes the plugin headers.
  • Calls into the chain:
    • SQLDisconnect, SQLExecute, SQLExecDirect, connect, connection free, the failover reconnect and the blue/green substitute connect routing go through PluginManager.
    • Read/write splitting, the topology monitor, the blue/green monitor and the limitless monitor get the chain's head from it.
  • Monitors:
    • The four places that built a monitor PluginService and chain by hand now call InitMonitoringServices().
    • RdsHostListProvider, ClusterTopologyMonitor, BlueGreenStatusProvider and BlueGreenMonitor take the monitor's std::shared_ptr<FullServiceContainer> instead of a PluginService.
  • Internal DBCs (read/write splitting reader and writer, monitor connections) only borrow the PluginService of the connection they belong to and have no PluginManager. Freeing them still does not release that connection's plugin chain, as with the old plugin_head == nullptr.

Testing

  • New full_service_container_test.cpp

@yanw-bq
yanw-bq added this pull request to stack #176 October 27, 2026 03:46
@yanw-bq
yanw-bq force-pushed the feat/full-service-container branch from 71edc2a to d7ea556 Compare October 28, 2026 21:08
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.

1 participant