Skip to content

Commit

Permalink
chore: linearize
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
  • Loading branch information
mnencia committed Jan 26, 2024
1 parent 10bb769 commit dffd749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
7 changes: 4 additions & 3 deletions internal/management/controller/instance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ func (r *InstanceReconciler) Reconcile(
}
reloadNeeded = reloadNeeded || reloadConfigNeeded

// Reconcile postgresql.auto.conf file
r.reconcileAutoConf(ctx, cluster)

// here we execute initialization tasks that need to be executed only on the first reconciliation loop
if !r.firstReconcileDone.Load() {
if err = r.initialize(ctx, cluster); err != nil {
Expand All @@ -144,6 +141,10 @@ func (r *InstanceReconciler) Reconcile(
r.firstReconcileDone.Store(true)
}

// Reconcile postgresql.auto.conf file. This operation must be after the initialize() call
// because it could interfere with pg_rewind execution
r.reconcileAutoConf(ctx, cluster)

// Reconcile cluster role without DB
reloadClusterRoleConfig, err := r.reconcileClusterRoleWithoutDB(ctx, cluster)
if err != nil {
Expand Down
9 changes: 0 additions & 9 deletions internal/management/controller/instance_startup.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,6 @@ func (r *InstanceReconciler) verifyPgDataCoherenceForPrimary(ctx context.Context
}
}

// Change back the mode of the postgresql.auto.conf file
if !cluster.Spec.PostgresConfiguration.EnableAlterSystem {
err = r.instance.SetAlterSystemEnabled(cluster.Spec.PostgresConfiguration.EnableAlterSystem)
if err != nil {
contextLogger.Error(
err, "Error while changing mode of the postgresql.auto.conf file after pg_rewind, skipped")
}
}

// Now I can demote myself
return r.instance.Demote(ctx, cluster)
}
Expand Down

0 comments on commit dffd749

Please sign in to comment.