Join creates a new instance joined to an existing PostgreSQL cluster
(ctx context.Context, cluster *apiv1.Cluster)
| 75 | |
| 76 | // Join creates a new instance joined to an existing PostgreSQL cluster |
| 77 | func (info InitInfo) Join(ctx context.Context, cluster *apiv1.Cluster) error { |
| 78 | primaryConnInfo := buildPrimaryConnInfo(info.ParentNode, info.PodName) + " dbname=postgres connect_timeout=5" |
| 79 | |
| 80 | // We explicitly disable wal_sender_timeout for join-related pg_basebackup executions. |
| 81 | // A short timeout could not be enough in case the instance is slow to send data, |
| 82 | // like when the I/O is overloaded. |
| 83 | primaryConnInfo += " options='-c wal_sender_timeout=0s'" |
| 84 | |
| 85 | coredumpFilter := cluster.GetCoredumpFilter() |
| 86 | if err := system.SetCoredumpFilter(coredumpFilter); err != nil { |
| 87 | return err |
| 88 | } |
| 89 | |
| 90 | if err := ClonePgData(ctx, primaryConnInfo, info.PgData, info.PgWal); err != nil { |
| 91 | return err |
| 92 | } |
| 93 | |
| 94 | slotName := cluster.GetSlotNameFromInstanceName(info.PodName) |
| 95 | _, err := UpdateReplicaConfiguration(info.PgData, info.GetPrimaryConnInfo(), slotName) |
| 96 | return err |
| 97 | } |