Skip to content

Commit

Permalink
Don't load a required mount if in secondary mode, let sync invalidate…
Browse files Browse the repository at this point in the history
… do that
  • Loading branch information
jefferai committed May 5, 2017
1 parent 250b232 commit 92dd48b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vault/logical_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ func (b *SystemBackend) handleTidyLeases(req *logical.Request, d *framework.Fiel

func (b *SystemBackend) invalidate(key string) {
if b.Core.logger.IsTrace() {
b.Core.logger.Trace("sys: invaliding key", "key", key)
b.Core.logger.Trace("sys: invalidating key", "key", key)
}
switch {
case strings.HasPrefix(key, policySubPath):
Expand Down
8 changes: 7 additions & 1 deletion vault/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,13 @@ func (c *Core) loadMounts() error {
break
}
}
if !foundRequired {
// In a replication scenario we will let sync invalidation take
// care of creating a new required mount that doesn't exist yet.
// This should only happen in the upgrade case where a new one is
// introduced on the primary; otherwise initial bootstrapping will
// ensure this comes over. If we upgrade first, we simply don't
// create the mount, so we won't conflict when we sync.
if !foundRequired && c.replicationState != consts.ReplicationSecondary {
c.mounts.Entries = append(c.mounts.Entries, requiredMount)
needPersist = true
}
Expand Down

0 comments on commit 92dd48b

Please sign in to comment.