greenplum

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: 28 Imported by: 0

Documentation

Index

Constants

View Source
const CoordinatorDbid = 1
View Source
const MirrorRole = "m"
View Source
const PrimaryRole = "p"

Variables

View Source
var GetSourceVersion = Version
View Source
var GetTargetVersion = Version

Functions

func GetCoordinatorSegPrefix

func GetCoordinatorSegPrefix(datadir string) (string, error)

func GetCoordinatorTablespaceLocation

func GetCoordinatorTablespaceLocation(basePath string, oid int) string

func GetTablespaceLocationForDbId

func GetTablespaceLocationForDbId(t *idl.TablespaceInfo, dbId int) string

func QueryPgStatActivity

func QueryPgStatActivity(db *sql.DB, cluster *Cluster) error

func ResetGreenplumCommand

func ResetGreenplumCommand()

XXX: for internal testing only

func ResetIsCoordinatorRunningCommand

func ResetIsCoordinatorRunningCommand()

XXX: for internal testing only

func ResetVersionCommand

func ResetVersionCommand()

XXX: for internal testing only

func SetGreenplumCommand

func SetGreenplumCommand(command exectest.Command)

XXX: for internal testing only

func SetIsCoordinatorRunningCommand

func SetIsCoordinatorRunningCommand(command exectest.Command)

XXX: for internal testing only

func SetVersionCommand

func SetVersionCommand(command exectest.Command)

XXX: for internal testing only

func VerifyCompatibleGPDBVersions

func VerifyCompatibleGPDBVersions(sourceGPHome, targetGPHome string) error

func Version

func Version(gphome string) (semver.Version, error)

func WaitForSegments

func WaitForSegments(db *sql.DB, timeout time.Duration, cluster *Cluster) error

Types

type Cluster

type Cluster struct {
	Destination idl.ClusterDestination

	// Primaries contains the primary SegConfigs, keyed by content ID.
	Primaries ContentToSegConfig

	// Mirrors contains any mirror SegConfigs, keyed by content ID.
	Mirrors ContentToSegConfig

	Tablespaces Tablespaces

	GPHome         string
	Version        semver.Version
	CatalogVersion string
}

func ClusterFromDB

func ClusterFromDB(db *sql.DB, gphome string, destination idl.ClusterDestination) (Cluster, error)

ClusterFromDB will create a Cluster by querying the passed DBConn for information. You must pass the cluster's gphome, since it cannot be divined from the database.

func DecodeCluster

func DecodeCluster(input []byte) (*Cluster, error)

func MustCreateCluster

func MustCreateCluster(t *testing.T, segments SegConfigs) *Cluster

func NewCluster

func NewCluster(segments SegConfigs) (Cluster, error)

func (*Cluster) CheckActiveConnections

func (c *Cluster) CheckActiveConnections(streams step.OutStreams) error

func (*Cluster) Connection

func (c *Cluster) Connection(options ...Option) string

func (*Cluster) Coordinator

func (c *Cluster) Coordinator() SegConfig

func (*Cluster) CoordinatorDataDir

func (c *Cluster) CoordinatorDataDir() string

func (*Cluster) CoordinatorHostname

func (c *Cluster) CoordinatorHostname() string

func (*Cluster) CoordinatorPort

func (c *Cluster) CoordinatorPort() int

func (*Cluster) Encode

func (c *Cluster) Encode() ([]byte, error)

func (*Cluster) ExcludingCoordinatorOrStandby

func (c *Cluster) ExcludingCoordinatorOrStandby() SegConfigs

func (*Cluster) HasAllMirrorsAndStandby

func (c *Cluster) HasAllMirrorsAndStandby() bool

func (*Cluster) HasMirrors

func (c *Cluster) HasMirrors() bool

Returns true if we have at least one mirror that is not a standby

func (*Cluster) HasStandby

func (c *Cluster) HasStandby() bool

func (*Cluster) Hosts

func (c *Cluster) Hosts() []string

Hosts returns all hosts including the coordinator and standby

func (*Cluster) IsCoordinatorRunning

func (c *Cluster) IsCoordinatorRunning(stream step.OutStreams) (bool, error)

func (*Cluster) PrimaryHostnames

func (c *Cluster) PrimaryHostnames() []string

func (*Cluster) RunCmd

func (c *Cluster) RunCmd(streams step.OutStreams, command string, args ...string) error

func (*Cluster) RunGreenplumCmd

func (c *Cluster) RunGreenplumCmd(streams step.OutStreams, utility string, args ...string) error

func (*Cluster) RunGreenplumCmdWithEnvironment

func (c *Cluster) RunGreenplumCmdWithEnvironment(streams step.OutStreams, utility string, args []string, envs []string) error

func (Cluster) SelectSegments

func (c Cluster) SelectSegments(selector func(*SegConfig) bool) SegConfigs

SelectSegments returns a list of all segments that match the given selector function.

func (*Cluster) Standby

func (c *Cluster) Standby() SegConfig

the standby might not exist, so it is the caller's responsibility

func (*Cluster) StandbyDataDir

func (c *Cluster) StandbyDataDir() string

func (*Cluster) StandbyHostname

func (c *Cluster) StandbyHostname() string

func (*Cluster) StandbyPort

func (c *Cluster) StandbyPort() int

func (*Cluster) Start

func (c *Cluster) Start(stream step.OutStreams) error

func (*Cluster) StartCoordinatorOnly

func (c *Cluster) StartCoordinatorOnly(stream step.OutStreams) error

func (*Cluster) Stop

func (c *Cluster) Stop(stream step.OutStreams) error

func (*Cluster) StopCoordinatorOnly

func (c *Cluster) StopCoordinatorOnly(stream step.OutStreams) error

func (*Cluster) WaitForClusterToBeReady

func (c *Cluster) WaitForClusterToBeReady() error

WaitForClusterToBeReady waits until the timeout for all segments to be up, in their preferred role, and synchronized.

type ContentToSegConfig

type ContentToSegConfig map[int]SegConfig

func (ContentToSegConfig) ExcludingCoordinator

func (c ContentToSegConfig) ExcludingCoordinator() ContentToSegConfig

func (ContentToSegConfig) ExcludingStandby

func (c ContentToSegConfig) ExcludingStandby() ContentToSegConfig

type Option

type Option func(*optionList)

func AllowSystemTableMods

func AllowSystemTableMods() Option

func Database

func Database(database string) Option

Database defaults to template1

func Port

func Port(port int) Option

Port defaults to coordinator port

func UtilityMode

func UtilityMode() Option

type SegConfig

type SegConfig struct {
	DbID      int
	ContentID int
	Port      int
	Hostname  string
	Address   string
	DataDir   string
	Role      string
}

func (*SegConfig) IsCoordinator

func (s *SegConfig) IsCoordinator() bool

func (*SegConfig) IsMirror

func (s *SegConfig) IsMirror() bool

func (*SegConfig) IsOnHost

func (s *SegConfig) IsOnHost(hostname string) bool

func (*SegConfig) IsPrimary

func (s *SegConfig) IsPrimary() bool

func (*SegConfig) IsStandby

func (s *SegConfig) IsStandby() bool

type SegConfigs

type SegConfigs []SegConfig

func GetSegmentConfiguration

func GetSegmentConfiguration(db *sql.DB, version semver.Version) (SegConfigs, error)

func (SegConfigs) Len

func (s SegConfigs) Len() int

func (SegConfigs) Less

func (s SegConfigs) Less(i, j int) bool

func (SegConfigs) Select

func (s SegConfigs) Select(selector func(*SegConfig) bool) SegConfigs

SelectSegmentConfigs returns a list of all segments that match the given selector function. Segments are visited in order of ascending content ID (primaries before mirrors).

func (SegConfigs) Swap

func (s SegConfigs) Swap(i, j int)

type SegmentTablespaces

type SegmentTablespaces map[int32]*idl.TablespaceInfo

map<tablespaceOid, tablespaceInfo>

func (SegmentTablespaces) UserDefinedTablespacesLocations

func (s SegmentTablespaces) UserDefinedTablespacesLocations() []string

type StatActivities

type StatActivities []StatActivity

func (StatActivities) Error

func (s StatActivities) Error() string

type StatActivity

type StatActivity struct {
	User             sql.NullString
	Application_name sql.NullString
	Datname          sql.NullString
	Query            sql.NullString
}

type Tablespace

type Tablespace struct {
	DbId int32
	Oid  int32
	Name string
	Info *idl.TablespaceInfo
}

type TablespaceTuples

type TablespaceTuples []Tablespace

slice of tablespace rows from database

func GetTablespaceTuples

func GetTablespaceTuples(db *sql.DB) (TablespaceTuples, error)

func (TablespaceTuples) Write

func (t TablespaceTuples) Write(w io.Writer) error

write the tuples returned from the database to a csv file

type Tablespaces

type Tablespaces map[int32]SegmentTablespaces

map<DbID, map<tablespaceOid, tablespaceInfo>>

func NewTablespaces

func NewTablespaces(tuples TablespaceTuples) Tablespaces

convert the database tablespace query result to internal structure

func TablespacesFromDB

func TablespacesFromDB(db *sql.DB, tablespacesFile string) (Tablespaces, error)

main function which does the following: 1. query the database to get tablespace information 2. write the tablespace information to a file 3. converts the tablespace information to an internal structure

func (Tablespaces) GetCoordinatorTablespaces

func (t Tablespaces) GetCoordinatorTablespaces() SegmentTablespaces

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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