hub

package
v0.0.0-...-31509f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const TimeStringFormat = "20060102T150405"

format of yyyyMMddTHHmmss

Variables

View Source
var DialTimeout = 3 * time.Second
View Source
var ErrAgentsNotReady = errors.New("gRPC agents not ready")
View Source
var ErrHubStopped = errors.New("hub is stopped")

Returned from Server.Start() if Server.Stop() has already been called.

View Source
var ErrUnknownCatalogVersion = errors.New("pg_controldata output is missing catalog version")
View Source
var ExecCommand = exec.Command

Allow exec.Command to be mocked out by exectest.NewCommand.

View Source
var RenameDirectories = upgrade.RenameDirectories

Functions

func AddMirrorsToGpSegmentConfiguration

func AddMirrorsToGpSegmentConfiguration(db *sql.DB, intermediate *greenplum.Cluster) (err error)

func AddReplicationEntriesOnPrimaries

func AddReplicationEntriesOnPrimaries(agentConns []*idl.Connection, intermediate *greenplum.Cluster, useHbaHostnames bool) error

func AgentHosts

func AgentHosts(c *greenplum.Cluster) []string

func AppendDynamicLibraryPath

func AppendDynamicLibraryPath(intermediate *greenplum.Cluster, toAppend string) error

func ArchiveLogDirectories

func ArchiveLogDirectories(logDir string, logArchiveDir string, agentConns []*idl.Connection, targetCoordinatorHost string) error

func ArchiveSegmentLogDirectories

func ArchiveSegmentLogDirectories(agentConns []*idl.Connection, excludeHostname, logArchiveDir string) error

func CheckDiskSpace

func CheckDiskSpace(streams step.OutStreams, agentConns []*idl.Connection, diskFreeRatio float64, source *greenplum.Cluster, sourceTablespaces greenplum.Tablespaces) error

func CheckEnvironment

func CheckEnvironment(agentHostsIncludingCoordinator []string, sourceGphome string, intermediateGphome string) error

func CheckEnvironmentOnSegment

func CheckEnvironmentOnSegment(host string, sourceGphome string, targetGphome string) error

CheckEnvironmentOnSegment ensures that multiple versions of Greenplum environments are not mixed. Use ssh instead of gRPC since our utilities like gpinitsystem, gpstart, gpstop, etc. use ssh internally. This checks up front for the following error as described here: https://web.archive.org/web/20220506055918/https://groups.google.com/a/greenplum.org/g/gpdb-dev/c/JN-YwjCCReY/m/0L9wBOvlAQAJ

func Copy

func Copy(streams step.OutStreams, sourceDirs []string, agentHostsToBackupDir backupdir.AgentHostsToBackupDir) error

func CopyCoordinatorDataDir

func CopyCoordinatorDataDir(streams step.OutStreams, coordinatorDataDir string, agentHostsToBackupDir backupdir.AgentHostsToBackupDir) error

func CopyCoordinatorTablespaces

func CopyCoordinatorTablespaces(streams step.OutStreams, sourceVersion semver.Version, tablespaces greenplum.Tablespaces, agentHostsToBackupDir backupdir.AgentHostsToBackupDir) error

func CreateBackupDirectories

func CreateBackupDirectories(streams step.OutStreams, agentConns []*idl.Connection, backupDirs backupdir.BackupDirs) error

func CreateBackupDirectory

func CreateBackupDirectory(backupDir string) error

func CreateInitialInitsystemConfig

func CreateInitialInitsystemConfig(targetCoordinatorDataDir string, useHbaHostnames bool) ([]string, error)

func CreateRecoveryConfOnSegments

func CreateRecoveryConfOnSegments(agentConns []*idl.Connection, intermediate *greenplum.Cluster) error

func CreateReplicationSlots

func CreateReplicationSlots(db *sql.DB) error

func DeleteBackupDirectories

func DeleteBackupDirectories(streams step.OutStreams, agentConns []*idl.Connection, backupDirs backupdir.BackupDirs) error

func DeleteCoordinatorAndPrimaryDataDirectories

func DeleteCoordinatorAndPrimaryDataDirectories(streams step.OutStreams, agentConns []*idl.Connection, intermediate *greenplum.Cluster) error

func DeleteStateDirectories

func DeleteStateDirectories(agentConns []*idl.Connection, excludeHostname string) error

func DeleteTargetTablespaces

func DeleteTargetTablespaces(streams step.OutStreams, agentConns []*idl.Connection, target *greenplum.Cluster, intermediateCatalogVersion string, sourceTablespaces greenplum.Tablespaces) error

func DeleteTargetTablespacesOnCoordinator

func DeleteTargetTablespacesOnCoordinator(streams step.OutStreams, target *greenplum.Cluster, coordinatorTablespaces greenplum.SegmentTablespaces, catalogVersion string) error

func DeleteTargetTablespacesOnPrimaries

func DeleteTargetTablespacesOnPrimaries(agentConns []*idl.Connection, target *greenplum.Cluster, tablespaces greenplum.Tablespaces, catalogVersion string) error

func EnsureConnsAreReady

func EnsureConnsAreReady(agentConns []*idl.Connection, timeout time.Duration) error

func ExecuteRPC

func ExecuteRPC(agentConns []*idl.Connection, executeRequest func(conn *idl.Connection) error) error

func GetCatalogVersion

func GetCatalogVersion(intermediate *greenplum.Cluster) (string, error)

func GetCheckpointSegmentsAndEncoding

func GetCheckpointSegmentsAndEncoding(gpinitsystemConfig []string, version semver.Version, db *sql.DB) ([]string, error)

func GetLogArchiveDir

func GetLogArchiveDir(logDir string, upgradeID string, t time.Time) string

GetLogArchiveDir returns the name of the file to be used to store logs from this run of gpupgrade during a revert.

func InitTargetCluster

func InitTargetCluster(stream step.OutStreams, intermediate *greenplum.Cluster) error

func Recoverseg

func Recoverseg(stream step.OutStreams, cluster *greenplum.Cluster, useHbaHostnames bool) error

func RenameDataDirectories

func RenameDataDirectories(agentConns []*idl.Connection, source *greenplum.Cluster, intermediate *greenplum.Cluster) error

func RenameMirrorTablespacesOnSegments

func RenameMirrorTablespacesOnSegments(agentConns []*idl.Connection, source *greenplum.Cluster, intermediate *greenplum.Cluster) error

func RenameSegmentDataDirs

func RenameSegmentDataDirs(agentConns []*idl.Connection, renames RenameMap) error

e.g. for source /data/dbfast1/demoDataDir0 becomes /data/dbfast1/demoDataDir0_old e.g. for target /data/dbfast1/demoDataDir0_123ABC becomes /data/dbfast1/demoDataDir0

func ResetLdLibraryPathCommand

func ResetLdLibraryPathCommand()

func ResetPathCommand

func ResetPathCommand()

XXX: for internal testing only

func ResetgRPCDialer

func ResetgRPCDialer()

func RestartAgents

func RestartAgents(ctx context.Context,
	dialer func(context.Context, string) (net.Conn, error),
	hostnames []string,
	port int,
	stateDir string) ([]string, error)

func RestoreCoordinatorAndPrimariesPgControl

func RestoreCoordinatorAndPrimariesPgControl(streams step.OutStreams, agentConns []*idl.Connection, source *greenplum.Cluster) error

func RsyncCoordinator

func RsyncCoordinator(stream step.OutStreams, standby greenplum.SegConfig, coordinator greenplum.SegConfig) error

func RsyncCoordinatorAndPrimaries

func RsyncCoordinatorAndPrimaries(stream step.OutStreams, agentConns []*idl.Connection, source *greenplum.Cluster) error

func RsyncCoordinatorAndPrimariesTablespaces

func RsyncCoordinatorAndPrimariesTablespaces(stream step.OutStreams, agentConns []*idl.Connection, source *greenplum.Cluster) error

func RsyncCoordinatorDataDir

func RsyncCoordinatorDataDir(stream step.OutStreams, sourceDir, targetDir string) error

func RsyncCoordinatorTablespaces

func RsyncCoordinatorTablespaces(stream step.OutStreams, standbyHostname string, coordinatorTablespaces greenplum.SegmentTablespaces, standbyTablespaces greenplum.SegmentTablespaces) error

func RsyncMirrorDataDirsOnSegments

func RsyncMirrorDataDirsOnSegments(agentConns []*idl.Connection, source *greenplum.Cluster, intermediate *greenplum.Cluster) error

func RsyncMirrorTablespacesOnSegments

func RsyncMirrorTablespacesOnSegments(agentConns []*idl.Connection, source *greenplum.Cluster, intermediate *greenplum.Cluster) error

func RsyncPrimaries

func RsyncPrimaries(agentConns []*idl.Connection, source *greenplum.Cluster) error

func RsyncPrimariesTablespaces

func RsyncPrimariesTablespaces(agentConns []*idl.Connection, source *greenplum.Cluster, tablespaces greenplum.Tablespaces) error

func SetLdLibraryPathCommand

func SetLdLibraryPathCommand(command exectest.Command)

func SetPathCommand

func SetPathCommand(command exectest.Command)

XXX: for internal testing only

func SetgRPCDialer

func SetgRPCDialer(dialer func(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error))

func UpdateCatalog

func UpdateCatalog(intermediate *greenplum.Cluster, target *greenplum.Cluster) error

func UpdateConfFiles

func UpdateConfFiles(agentConns []*idl.Connection, _ step.OutStreams, version semver.Version, intermediate *greenplum.Cluster, target *greenplum.Cluster) error

func UpdateConfigurationFile

func UpdateConfigurationFile(opts []*idl.UpdateFileConfOptions) error

func UpdateGpSegmentConfiguration

func UpdateGpSegmentConfiguration(db *sql.DB, target *greenplum.Cluster) (err error)

func UpdateInternalAutoConfOnMirrors

func UpdateInternalAutoConfOnMirrors(agentConns []*idl.Connection, intermediate *greenplum.Cluster) error

func UpdatePostgresqlConfOnSegments

func UpdatePostgresqlConfOnSegments(agentConns []*idl.Connection, intermediate *greenplum.Cluster, target *greenplum.Cluster) error

func UpdateRecoveryConfOnSegments

func UpdateRecoveryConfOnSegments(agentConns []*idl.Connection, version semver.Version, intermediateCluster *greenplum.Cluster, target *greenplum.Cluster) error

func UpgradeCoordinator

func UpgradeCoordinator(streams step.OutStreams, backupDir string, pgUpgradeVerbose bool, skipPgUpgradeChecks bool, pgUpgradeJobs uint, source *greenplum.Cluster, intermediate *greenplum.Cluster, action idl.PgOptions_Action, mode idl.Mode, pgUpgradeTimestamp string) error

func UpgradeMirrorsUsingGpAddMirrors

func UpgradeMirrorsUsingGpAddMirrors(streams step.OutStreams, intermediate *greenplum.Cluster, useHbaHostnames bool) (err error)

func UpgradeMirrorsUsingRsync

func UpgradeMirrorsUsingRsync(agentConns []*idl.Connection, source *greenplum.Cluster, intermediate *greenplum.Cluster, useHbaHostnames bool) error

func UpgradePrimaries

func UpgradePrimaries(agentConns []*idl.Connection, agentHostToBackupDir backupdir.AgentHostsToBackupDir, pgUpgradeVerbose bool, skipPgUpgradeChecks bool, pgUpgradeJobs uint, source *greenplum.Cluster, intermediate *greenplum.Cluster, action idl.PgOptions_Action, mode idl.Mode, pgUpgradeTimestamp string) error

func UpgradeStandby

func UpgradeStandby(streams step.OutStreams, intermediate *greenplum.Cluster, useHbaHostnames bool) error

UpgradeStandby removes any possible existing standby from the cluster before adding a new one for idempotency. In the happy-path, we expect this to fail as there should not be an existing standby for the cluster.

func WriteInitsystemFile

func WriteInitsystemFile(gpinitsystemConfig []string, gpinitsystemFilepath string) error

func WriteSegmentArray

func WriteSegmentArray(config []string, intermediate *greenplum.Cluster) ([]string, error)

Types

type AgentsGrpcStatus

type AgentsGrpcStatus map[string]connectivity.State

func (AgentsGrpcStatus) String

func (a AgentsGrpcStatus) String() string

type AgentsNotReadyError

type AgentsNotReadyError struct {
	Agents AgentsGrpcStatus
}

func (*AgentsNotReadyError) Error

func (a *AgentsNotReadyError) Error() string

func (*AgentsNotReadyError) Is

func (a *AgentsNotReadyError) Is(err error) bool

type RenameMap

type RenameMap = map[string][]*idl.RenameDirectories

type Result

type Result struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	*config.Config
	// contains filtered or unexported fields
}

func New

func New(conf *config.Config) *Server

func (*Server) AgentConns

func (s *Server) AgentConns() ([]*idl.Connection, error)

func (*Server) Execute

func (s *Server) Execute(req *idl.ExecuteRequest, stream idl.CliToHub_ExecuteServer) (err error)

func (*Server) Finalize

func (s *Server) Finalize(req *idl.FinalizeRequest, stream idl.CliToHub_FinalizeServer) (err error)

func (*Server) GenerateInitsystemConfig

func (s *Server) GenerateInitsystemConfig(source *greenplum.Cluster) error

func (*Server) GetConfig

func (s *Server) GetConfig(ctx context.Context, req *idl.GetConfigRequest) (*idl.GetConfigReply, error)

func (*Server) Initialize

func (s *Server) Initialize(req *idl.InitializeRequest, stream idl.CliToHub_InitializeServer) (err error)

func (*Server) InitializeCreateCluster

func (s *Server) InitializeCreateCluster(req *idl.InitializeCreateClusterRequest, stream idl.CliToHub_InitializeCreateClusterServer) (err error)

func (*Server) RemoveIntermediateCluster

func (s *Server) RemoveIntermediateCluster(streams step.OutStreams) error

func (*Server) RestartAgents

func (s *Server) RestartAgents(ctx context.Context, in *idl.RestartAgentsRequest) (*idl.RestartAgentsReply, error)

func (*Server) Revert

func (s *Server) Revert(_ *idl.RevertRequest, stream idl.CliToHub_RevertServer) (err error)

func (*Server) Start

func (s *Server) Start(port int, daemonize bool) error

func (*Server) Stop

func (s *Server) Stop(closeAgentConns bool)

func (*Server) StopAgents

func (s *Server) StopAgents() error

TODO: Add unit tests which is currently tricky due to h.AgentConns() mutating global state

func (*Server) StopServices

func (s *Server) StopServices(ctx context.Context, in *idl.StopServicesRequest) (*idl.StopServicesReply, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL