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

Method initdbSyncOnly

pkg/management/postgres/initdb.go:626–641  ·  view source on GitHub ↗

initdbSyncOnly Run initdb with --sync-only option after a database import

(ctx context.Context)

Source from the content-addressed store, hash-verified

624
625// initdbSyncOnly Run initdb with --sync-only option after a database import
626func (info InitInfo) initdbSyncOnly(ctx context.Context) error {
627 contextLogger := log.FromContext(ctx)
628
629 // Invoke initdb to generate a data directory
630 options := []string{
631 "-D",
632 info.PgData,
633 "--sync-only",
634 }
635 contextLogger.Info("Running initdb --sync-only", "pgdata", info.PgData)
636 initdbCmd := exec.Command(constants.InitdbName, options...) // #nosec
637 if err := execlog.RunBuffering(initdbCmd, constants.InitdbName); err != nil {
638 return fmt.Errorf("error while running initdb --sync-only: %w", err)
639 }
640 return nil
641}

Callers 1

BootstrapMethod · 0.95

Calls 1

InfoMethod · 0.80

Tested by

no test coverage detected