open-vault/physical/raft
John-Michael Faircloth 1cf74e1179
feature: multiplexing support for database plugins (#14033)
* feat: DB plugin multiplexing (#13734)

* WIP: start from main and get a plugin runner from core

* move MultiplexedClient map to plugin catalog
- call sys.NewPluginClient from PluginFactory
- updates to getPluginClient
- thread through isMetadataMode

* use go-plugin ClientProtocol interface
- call sys.NewPluginClient from dbplugin.NewPluginClient

* move PluginSets to dbplugin package
- export dbplugin HandshakeConfig
- small refactor of PluginCatalog.getPluginClient

* add removeMultiplexedClient; clean up on Close()
- call client.Kill from plugin catalog
- set rpcClient when muxed client exists

* add ID to dbplugin.DatabasePluginClient struct

* only create one plugin process per plugin type

* update NewPluginClient to return connection ID to sdk
- wrap grpc.ClientConn so we can inject the ID into context
- get ID from context on grpc server

* add v6 multiplexing  protocol version

* WIP: backwards compat for db plugins

* Ensure locking on plugin catalog access

- Create public GetPluginClient method for plugin catalog
- rename postgres db plugin

* use the New constructor for db plugins

* grpc server: use write lock for Close and rlock for CRUD

* cleanup MultiplexedClients on Close

* remove TODO

* fix multiplexing regression with grpc server connection

* cleanup grpc server instances on close

* embed ClientProtocol in Multiplexer interface

* use PluginClientConfig arg to make NewPluginClient plugin type agnostic

* create a new plugin process for non-muxed plugins

* feat: plugin multiplexing: handle plugin client cleanup (#13896)

* use closure for plugin client cleanup

* log and return errors; add comments

* move rpcClient wrapping to core for ID injection

* refactor core plugin client and sdk

* remove unused ID method

* refactor and only wrap clientConn on multiplexed plugins

* rename structs and do not export types

* Slight refactor of system view interface

* Revert "Slight refactor of system view interface"

This reverts commit 73d420e5cd2f0415e000c5a9284ea72a58016dd6.

* Revert "Revert "Slight refactor of system view interface""

This reverts commit f75527008a1db06d04a23e04c3059674be8adb5f.

* only provide pluginRunner arg to the internal newPluginClient method

* embed ClientProtocol in pluginClient and name logger

* Add back MLock support

* remove enableMlock arg from setupPluginCatalog

* rename plugin util interface to PluginClient

Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>

* feature: multiplexing: fix unit tests (#14007)

* fix grpc_server tests and add coverage

* update run_config tests

* add happy path test case for grpc_server ID from context

* update test helpers

* feat: multiplexing: handle v5 plugin compiled with new sdk

* add mux supported flag and increase test coverage

* set multiplexingSupport field in plugin server

* remove multiplexingSupport field in sdk

* revert postgres to non-multiplexed

* add comments on grpc server fields

* use pointer receiver on grpc server methods

* add changelog

* use pointer for grpcserver instance

* Use a gRPC server to determine if a plugin should be multiplexed

* Apply suggestions from code review

Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>

* add lock to removePluginClient

* add multiplexingSupport field to externalPlugin struct

* do not send nil to grpc MultiplexingSupport

* check err before logging

* handle locking scenario for cleanupFunc

* allow ServeConfigMultiplex to dispense v5 plugin

* reposition structs, add err check and comments

* add comment on locking for cleanupExternalPlugin

Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>
2022-02-17 08:50:33 -06:00
..
bolt_32bit_test.go Use MAP_POPULATE for our bbolt mmaps (#13573) 2022-01-11 08:16:53 -05:00
bolt_64bit_test.go Use MAP_POPULATE for our bbolt mmaps (#13573) 2022-01-11 08:16:53 -05:00
bolt_linux.go Use MAP_POPULATE for our bbolt mmaps (#13573) 2022-01-11 08:16:53 -05:00
chunking_test.go Switch to shared raft-boltdb library and add metrics (#11269) 2021-04-26 16:01:26 -07:00
fsm.go Use MAP_POPULATE for our bbolt mmaps (#13573) 2022-01-11 08:16:53 -05:00
fsm_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
io.go Fix code copied from gogo using a different proto import (#9009) 2020-05-15 13:45:22 -07:00
msgpack.go Depend explicitly on go-msgpack v1.1.5 (#13693) 2022-01-19 10:32:19 -05:00
raft.go Raft/fix raft telemetry metric unit (#13749) 2022-01-24 10:51:35 -05:00
raft_autopilot.go Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
raft_test.go Prevent raft transactions from containing overlarge keys. (#13286) 2021-11-26 08:38:39 -05:00
raft_util.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
snapshot.go [VAULT-3226] Use os.rename on windows os (#12377) 2021-08-19 16:05:53 -07:00
snapshot_test.go Create helpers which integrate with OpenTelemetry for diagnose collection (#11454) 2021-04-29 13:32:41 -05:00
streamlayer.go physical: deprecate errwrap.Wrapf() (#11692) 2021-05-31 12:54:05 -04:00
streamlayer_test.go storage/raft: Advertise the configured cluster address (#9008) 2020-05-18 18:22:25 -07:00
types.pb.go feature: multiplexing support for database plugins (#14033) 2022-02-17 08:50:33 -06:00
types.proto Autopilot: Server Stabilization, State and Dead Server Cleanup (#10856) 2021-03-03 13:59:50 -05:00
varint.go Fix code copied from gogo using a different proto import (#9009) 2020-05-15 13:45:22 -07:00
vars_32bit.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00
vars_64bit.go Convert to Go 1.17 go:build directive (#13579) 2022-01-05 12:02:03 -06:00