mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-07-08 10:42:21 +02:00
Compare commits
2 Commits
b4cba850ef
...
42af2ce678
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42af2ce678 | ||
|
|
056426a018 |
@ -242,20 +242,13 @@ func (w WALServiceImplementation) Restore(
|
|||||||
var serverName string
|
var serverName string
|
||||||
var objectStoreKey types.NamespacedName
|
var objectStoreKey types.NamespacedName
|
||||||
|
|
||||||
var promotionToken string
|
|
||||||
if configuration.Cluster.Spec.ReplicaCluster != nil {
|
|
||||||
promotionToken = configuration.Cluster.Spec.ReplicaCluster.PromotionToken
|
|
||||||
}
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case promotionToken != "" && configuration.Cluster.Status.LastPromotionToken != promotionToken:
|
case configuration.Cluster.Status.CurrentPrimary == w.InstanceName &&
|
||||||
// This is a replica cluster that is being promoted to a primary cluster
|
len(configuration.ReplicaSourceBarmanObjectName) > 0:
|
||||||
// Recover from the replica source object store
|
// restore_command is only called while PostgreSQL is in recovery, so if this
|
||||||
serverName = configuration.ReplicaSourceServerName
|
// instance is the current primary with a replica source configured, it must be
|
||||||
objectStoreKey = configuration.GetReplicaSourceBarmanObjectKey()
|
// a designated primary that hasn't completed promotion yet. This covers both
|
||||||
|
// switchover (promotion token) and failover (no promotion token) cases.
|
||||||
case configuration.Cluster.IsReplica() && configuration.Cluster.Status.CurrentPrimary == w.InstanceName:
|
|
||||||
// Designated primary on replica cluster, using replica source object store
|
|
||||||
serverName = configuration.ReplicaSourceServerName
|
serverName = configuration.ReplicaSourceServerName
|
||||||
objectStoreKey = configuration.GetReplicaSourceBarmanObjectKey()
|
objectStoreKey = configuration.GetReplicaSourceBarmanObjectKey()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user