MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / executeLogicalImport

Function executeLogicalImport

pkg/management/postgres/initdb.go:572–596  ·  view source on GitHub ↗
(
	ctx context.Context,
	client ctrl.Client,
	instance *Instance,
	cluster *apiv1.Cluster,
)

Source from the content-addressed store, hash-verified

570}
571
572func executeLogicalImport(
573 ctx context.Context,
574 client ctrl.Client,
575 instance *Instance,
576 cluster *apiv1.Cluster,
577) error {
578 destinationPool := instance.ConnectionPool()
579 defer destinationPool.ShutdownConnections()
580
581 originPool, err := getConnectionPoolerForExternalCluster(ctx, cluster, client, cluster.Namespace)
582 if err != nil {
583 return err
584 }
585 defer originPool.ShutdownConnections()
586
587 cloneType := cluster.Spec.Bootstrap.InitDB.Import.Type
588 switch cloneType {
589 case apiv1.MicroserviceSnapshotType:
590 return logicalimport.Microservice(ctx, cluster, destinationPool, originPool)
591 case apiv1.MonolithSnapshotType:
592 return logicalimport.Monolith(ctx, cluster, destinationPool, originPool)
593 default:
594 return fmt.Errorf("unrecognized clone type %s", cloneType)
595 }
596}
597
598func getConnectionPoolerForExternalCluster(
599 ctx context.Context,

Callers 1

BootstrapMethod · 0.85

Calls 5

MicroserviceFunction · 0.92
MonolithFunction · 0.92
ConnectionPoolMethod · 0.65
ShutdownConnectionsMethod · 0.65

Tested by

no test coverage detected