mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
Add more perf standby guards (#6149)
This commit is contained in:
parent
b7f3823ad1
commit
c0739a0f23
7 changed files with 7 additions and 7 deletions
|
|
@ -159,7 +159,7 @@ func (b *backend) invalidate(_ context.Context, key string) {
|
|||
// to delay the removal of SecretIDs by a minute.
|
||||
func (b *backend) periodicFunc(ctx context.Context, req *logical.Request) error {
|
||||
// Initiate clean-up of expired SecretID entries
|
||||
if b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary) {
|
||||
if b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby) {
|
||||
b.tidySecretID(ctx, req)
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -847,7 +847,7 @@ func (b *backend) roleEntry(ctx context.Context, s logical.Storage, roleName str
|
|||
needsUpgrade = true
|
||||
}
|
||||
|
||||
if needsUpgrade && (b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary)) {
|
||||
if needsUpgrade && (b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby)) {
|
||||
entry, err := logical.StorageEntryJSON("role/"+strings.ToLower(roleName), &role)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ func (b *backend) periodicFunc(ctx context.Context, req *logical.Request) error
|
|||
// Run the tidy operations for the first time. Then run it when current
|
||||
// time matches the nextTidyTime.
|
||||
if b.nextTidyTime.IsZero() || !time.Now().Before(b.nextTidyTime) {
|
||||
if b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary) {
|
||||
if b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby) {
|
||||
// safety_buffer defaults to 180 days for roletag blacklist
|
||||
safety_buffer := 15552000
|
||||
tidyBlacklistConfigEntry, err := b.lockedConfigTidyRoleTags(ctx, req.Storage)
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ func (b *backend) lockedAWSRole(ctx context.Context, s logical.Storage, roleName
|
|||
if err != nil {
|
||||
return nil, errwrap.Wrapf("error upgrading roleEntry: {{err}}", err)
|
||||
}
|
||||
if needUpgrade && (b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary)) {
|
||||
if needUpgrade && (b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby)) {
|
||||
b.roleMutex.Lock()
|
||||
defer b.roleMutex.Unlock()
|
||||
// Now that we have a R/W lock, we need to re-read the role entry in case it was
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ func (b *backend) Config(ctx context.Context, req *logical.Request) (*ldaputil.C
|
|||
persistNeeded = true
|
||||
}
|
||||
|
||||
if persistNeeded && (b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary)) {
|
||||
if persistNeeded && (b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby)) {
|
||||
entry, err := logical.StorageEntryJSON("config", result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ func (b *backend) roleRead(ctx context.Context, s logical.Storage, roleName stri
|
|||
}
|
||||
|
||||
newRoleEntry := upgradeLegacyPolicyEntry(string(legacyEntry.Value))
|
||||
if b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary) {
|
||||
if b.System().LocalMount() || !b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby) {
|
||||
err = setAwsRole(ctx, s, roleName, newRoleEntry)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ func (b *backend) walRollback(ctx context.Context, req *logical.Request, kind st
|
|||
"user": b.pathUserRollback,
|
||||
}
|
||||
|
||||
if !b.System().LocalMount() && b.System().ReplicationState().HasState(consts.ReplicationPerformancePrimary) {
|
||||
if !b.System().LocalMount() && b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue