mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
raft: Fix some snapshot restore issues (#9533)
* raft: Remove double read lock * Reload TLS keyring after reloading the barrier keys
This commit is contained in:
@@ -956,9 +956,7 @@ func (b *RaftBackend) RestoreSnapshot(ctx context.Context, metadata raft.Snapsho
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
b.l.RLock()
|
|
||||||
err := b.applyLog(ctx, command)
|
err := b.applyLog(ctx, command)
|
||||||
b.l.RUnlock()
|
|
||||||
|
|
||||||
// Do a best-effort attempt to let the standbys apply the restoreCallbackOp
|
// Do a best-effort attempt to let the standbys apply the restoreCallbackOp
|
||||||
// before we continue.
|
// before we continue.
|
||||||
|
|||||||
@@ -632,12 +632,6 @@ func (c *Core) raftSnapshotRestoreCallback(grabLock bool, sealNode bool) func(co
|
|||||||
// Purge the cache so we make sure we are operating on fresh data
|
// Purge the cache so we make sure we are operating on fresh data
|
||||||
c.physicalCache.Purge(ctx)
|
c.physicalCache.Purge(ctx)
|
||||||
|
|
||||||
// Refresh the raft TLS keys
|
|
||||||
if err := c.checkRaftTLSKeyUpgrades(ctx); err != nil {
|
|
||||||
c.logger.Info("failed to perform TLS key upgrades, sealing", "error", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reload the keyring in case it changed. If this fails it's likely
|
// Reload the keyring in case it changed. If this fails it's likely
|
||||||
// we've changed master keys.
|
// we've changed master keys.
|
||||||
err := c.performKeyUpgrades(ctx)
|
err := c.performKeyUpgrades(ctx)
|
||||||
@@ -675,6 +669,12 @@ func (c *Core) raftSnapshotRestoreCallback(grabLock bool, sealNode bool) func(co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refresh the raft TLS keys
|
||||||
|
if err := c.checkRaftTLSKeyUpgrades(ctx); err != nil {
|
||||||
|
c.logger.Info("failed to perform TLS key upgrades, sealing", "error", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user