diff --git a/changelog/_12313.txt b/changelog/_12313.txt new file mode 100644 index 0000000000..81eef8e9f9 --- /dev/null +++ b/changelog/_12313.txt @@ -0,0 +1,3 @@ +```release-note:improvement +secrets/kmip (Enterprise): Obey configured best_effort_wal_wait_duration when forwarding kmip requests. +``` \ No newline at end of file diff --git a/vault/extended_system_view.go b/vault/extended_system_view.go index b80a9c682d..12c20bb7e0 100644 --- a/vault/extended_system_view.go +++ b/vault/extended_system_view.go @@ -33,7 +33,17 @@ func (e extendedSystemViewImpl) ForwardGenericRequest(ctx context.Context, req * ctx = namespace.ContextWithNamespace(ctx, e.mountEntry.Namespace()) ctx = logical.IndexStateContext(ctx, &logical.WALState{}) ctx = context.WithValue(ctx, ctxKeyForwardedRequestMountAccessor{}, e.mountEntry.Accessor) - return forward(ctx, e.core, req) + resp, err := forward(ctx, e.core, req) + if err != nil { + return nil, err + } + if req.LastRemoteWAL() > 0 && !e.core.EntWaitUntilWALShipped(ctx, req.LastRemoteWAL()) { + if resp == nil { + resp = &logical.Response{} + } + resp.AddWarning("Timeout hit while waiting for local replicated cluster to apply primary's write; this client may encounter stale reads of values written during this operation.") + } + return resp, nil } return nil, logical.ErrReadOnly