Documentation ¶
Index ¶
- Constants
- Variables
- func GetCoordinatorSegPrefix(datadir string) (string, error)
- func GetCoordinatorTablespaceLocation(basePath string, oid int) string
- func GetTablespaceLocationForDbId(t *idl.TablespaceInfo, dbId int) string
- func QueryPgStatActivity(db *sql.DB, cluster *Cluster) error
- func ResetGreenplumCommand()
- func ResetIsCoordinatorRunningCommand()
- func ResetVersionCommand()
- func SetGreenplumCommand(command exectest.Command)
- func SetIsCoordinatorRunningCommand(command exectest.Command)
- func SetVersionCommand(command exectest.Command)
- func VerifyCompatibleGPDBVersions(sourceGPHome, targetGPHome string) error
- func Version(gphome string) (semver.Version, error)
- func WaitForSegments(db *sql.DB, timeout time.Duration, cluster *Cluster) error
- type Cluster
- func (c *Cluster) CheckActiveConnections(streams step.OutStreams) error
- func (c *Cluster) Connection(options ...Option) string
- func (c *Cluster) Coordinator() SegConfig
- func (c *Cluster) CoordinatorDataDir() string
- func (c *Cluster) CoordinatorHostname() string
- func (c *Cluster) CoordinatorPort() int
- func (c *Cluster) Encode() ([]byte, error)
- func (c *Cluster) ExcludingCoordinatorOrStandby() SegConfigs
- func (c *Cluster) HasAllMirrorsAndStandby() bool
- func (c *Cluster) HasMirrors() bool
- func (c *Cluster) HasStandby() bool
- func (c *Cluster) Hosts() []string
- func (c *Cluster) IsCoordinatorRunning(stream step.OutStreams) (bool, error)
- func (c *Cluster) PrimaryHostnames() []string
- func (c *Cluster) RunCmd(streams step.OutStreams, command string, args ...string) error
- func (c *Cluster) RunGreenplumCmd(streams step.OutStreams, utility string, args ...string) error
- func (c *Cluster) RunGreenplumCmdWithEnvironment(streams step.OutStreams, utility string, args []string, envs []string) error
- func (c Cluster) SelectSegments(selector func(*SegConfig) bool) SegConfigs
- func (c *Cluster) Standby() SegConfig
- func (c *Cluster) StandbyDataDir() string
- func (c *Cluster) StandbyHostname() string
- func (c *Cluster) StandbyPort() int
- func (c *Cluster) Start(stream step.OutStreams) error
- func (c *Cluster) StartCoordinatorOnly(stream step.OutStreams) error
- func (c *Cluster) Stop(stream step.OutStreams) error
- func (c *Cluster) StopCoordinatorOnly(stream step.OutStreams) error
- func (c *Cluster) WaitForClusterToBeReady() error
- type ContentToSegConfig
- type Option
- type SegConfig
- type SegConfigs
- type SegmentTablespaces
- type StatActivities
- type StatActivity
- type Tablespace
- type TablespaceTuples
- type Tablespaces
Constants ¶
const CoordinatorDbid = 1
const MirrorRole = "m"
const PrimaryRole = "p"
Variables ¶
var GetSourceVersion = Version
var GetTargetVersion = Version
Functions ¶
func GetCoordinatorSegPrefix ¶
func GetTablespaceLocationForDbId ¶
func GetTablespaceLocationForDbId(t *idl.TablespaceInfo, dbId int) string
func ResetIsCoordinatorRunningCommand ¶
func ResetIsCoordinatorRunningCommand()
XXX: for internal testing only
func SetGreenplumCommand ¶
XXX: for internal testing only
func SetIsCoordinatorRunningCommand ¶
XXX: for internal testing only
func SetVersionCommand ¶
XXX: for internal testing only
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 ¶
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 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 (*Cluster) Coordinator ¶
func (*Cluster) CoordinatorDataDir ¶
func (*Cluster) CoordinatorHostname ¶
func (*Cluster) CoordinatorPort ¶
func (*Cluster) ExcludingCoordinatorOrStandby ¶
func (c *Cluster) ExcludingCoordinatorOrStandby() SegConfigs
func (*Cluster) HasAllMirrorsAndStandby ¶
func (*Cluster) HasMirrors ¶
Returns true if we have at least one mirror that is not a standby
func (*Cluster) HasStandby ¶
func (*Cluster) IsCoordinatorRunning ¶
func (c *Cluster) IsCoordinatorRunning(stream step.OutStreams) (bool, error)
func (*Cluster) PrimaryHostnames ¶
func (*Cluster) RunGreenplumCmd ¶
func (*Cluster) RunGreenplumCmdWithEnvironment ¶
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) StandbyDataDir ¶
func (*Cluster) StandbyHostname ¶
func (*Cluster) StandbyPort ¶
func (*Cluster) StartCoordinatorOnly ¶
func (c *Cluster) StartCoordinatorOnly(stream step.OutStreams) error
func (*Cluster) StopCoordinatorOnly ¶
func (c *Cluster) StopCoordinatorOnly(stream step.OutStreams) error
func (*Cluster) WaitForClusterToBeReady ¶
WaitForClusterToBeReady waits until the timeout for all segments to be up, in their preferred role, and synchronized.
type ContentToSegConfig ¶
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 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 ¶
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)
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