From 997e92737c801024cbed5591dd9e7062d492512f Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Wed, 14 Jul 2021 17:56:18 -0700 Subject: [PATCH 1/3] secrets/database: fixes external plugin shutdown reconnect for v5 interface --- builtin/logical/database/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/logical/database/backend.go b/builtin/logical/database/backend.go index 7c0fc3fc5a0b..f3ad3fc86f31 100644 --- a/builtin/logical/database/backend.go +++ b/builtin/logical/database/backend.go @@ -315,7 +315,7 @@ func (b *databaseBackend) clearConnection(name string) error { func (b *databaseBackend) CloseIfShutdown(db *dbPluginInstance, err error) { // Plugin has shutdown, close it so next call can reconnect. switch err { - case rpc.ErrShutdown, v4.ErrPluginShutdown: + case rpc.ErrShutdown, v4.ErrPluginShutdown, v5.ErrPluginShutdown: // Put this in a goroutine so that requests can run with the read or write lock // and simply defer the unlock. Since we are attaching the instance and matching // the id in the connection map, we can safely do this. From 2c8ce3fe2959ed44125d23d6d5cc8fd66270b275 Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Wed, 14 Jul 2021 22:41:26 -0700 Subject: [PATCH 2/3] adds changelog entry --- changelog/12087.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/12087.txt diff --git a/changelog/12087.txt b/changelog/12087.txt new file mode 100644 index 000000000000..9141739c29d9 --- /dev/null +++ b/changelog/12087.txt @@ -0,0 +1,3 @@ +```release-note:bug +secrets/database: Fixed an issue that prevented external database plugin processes from restarting after a shutdown. +``` From 28d8e2b36b7bbd7a94068047eaa846a6bbabcaa0 Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Thu, 15 Jul 2021 11:18:10 -0700 Subject: [PATCH 3/3] fixes handling of plugin shutdown for password generation on v4 interface --- builtin/logical/database/path_creds_create.go | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/logical/database/path_creds_create.go b/builtin/logical/database/path_creds_create.go index d4fbca6c39d1..020afc4c038c 100644 --- a/builtin/logical/database/path_creds_create.go +++ b/builtin/logical/database/path_creds_create.go @@ -92,6 +92,7 @@ func (b *databaseBackend) pathCredsCreateRead() framework.OperationFunc { password, err := dbi.database.GeneratePassword(ctx, b.System(), dbConfig.PasswordPolicy) if err != nil { + b.CloseIfShutdown(dbi, err) return nil, fmt.Errorf("unable to generate password: %w", err) }