Documentation ¶
Index ¶
- Constants
- func CheckAgentErrorsOnSegments(c *cluster.Cluster, fpInfo filepath.FilePathInfo) error
- func CheckGpexpandRunning(errMsg GpexpandFailureMessage)
- func CheckHelperPids(c *cluster.Cluster, fpInfo filepath.FilePathInfo, operation string) (map[string][]int, bool)
- func CleanUpHelperFilesOnAllHosts(c *cluster.Cluster, fpInfo filepath.FilePathInfo, timeout time.Duration)
- func CleanUpSegmentHelperProcesses(c *cluster.Cluster, fpInfo filepath.FilePathInfo, operation string, ...)
- func CommandExists(cmd string) bool
- func CopyFile(src, dest string) error
- func CreateSegmentPipeOnAllHostsForBackup(oid string, c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func CreateSegmentPipeOnAllHostsForRestore(oid string, c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func CreateSkipFileOnSegments(oid string, tableName string, c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func DollarQuoteString(literal string) string
- func EscapeSingleQuotes(str string) string
- func Exists(slice []string, val string) bool
- func FileExists(filename string) bool
- func GetFileHash(filename string) ([32]byte, error)
- func GetHelperFileCount(c *cluster.Cluster, fpInfo filepath.FilePathInfo) int
- func GetSecretKey(pluginName string, mdd string) (string, error)
- func InitializePipeThroughParameters(compress bool, compressionType string, compressionLevel int)
- func InitializeSignalHandler(cleanupFunc func(bool), procDesc string, termFlag *bool)
- func LogExecutionTime(start time.Time, name string)
- func MakeFQN(schema string, object string) string
- func MustPrintf(file io.Writer, s string, v ...interface{}) uint64
- func MustPrintln(file io.Writer, v ...interface{}) uint64
- func OpenFileForWrite(filename string) (*os.File, error)
- func QuoteIdent(connectionPool *dbconn.DBConn, ident string) string
- func RelationIsExcludedByUser(inRelationsUserInput []string, exRelationsUserInput []string, tableFQN string) bool
- func RemoveFileIfExists(filename string) error
- func RemoveHelperFiles(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func SchemaIsExcludedByUser(inSchemasUserInput []string, exSchemasUserInput []string, schemaName string) bool
- func SetPipeThroughProgram(compression PipeThroughProgram)
- func SliceToQuotedString(slice []string) string
- func StartGpbackupHelpers(c *cluster.Cluster, fpInfo filepath.FilePathInfo, operation string, ...)
- func TerminateHangingCopySessions(fpInfo filepath.FilePathInfo, appName string, timeout time.Duration, ...)
- func UnEscapeDoubleQuotes(str string) string
- func UnquoteIdent(ident string) string
- func ValidateCompressionTypeAndLevel(compressionType string, compressionLevel int) error
- func ValidateFQNs(tableList []string) error
- func ValidateFullPath(path string) error
- func ValidateGPDBVersionCompatibility(connectionPool *dbconn.DBConn)
- func VerifyHelperVersionOnSegments(version string, c *cluster.Cluster)
- func WriteOidListToSegments(oidList []string, c *cluster.Cluster, fpInfo filepath.FilePathInfo, ...)
- func WriteOids(writer io.Writer, oidList []string) error
- func WriteOidsToFile(filename string, oidList []string)
- func WriteToFileAndMakeReadOnly(filename string, contents []byte) error
- type CompressionLevelsDescription
- type FileWithByteCount
- type FilterSet
- type GpexpandFailureMessage
- type GpexpandSensor
- type PipeThroughProgram
- type PluginConfig
- func (plugin *PluginConfig) BackupFile(filenamePath string) error
- func (plugin *PluginConfig) BackupPluginVersion() string
- func (plugin *PluginConfig) BackupSegmentTOCs(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func (plugin *PluginConfig) CanRestoreSubset() bool
- func (plugin *PluginConfig) CheckPluginExistsOnAllHosts(c *cluster.Cluster) string
- func (plugin *PluginConfig) CleanupPluginForBackup(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func (plugin *PluginConfig) CleanupPluginForRestore(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func (plugin *PluginConfig) CopyPluginConfigToAllHosts(c *cluster.Cluster)
- func (plugin *PluginConfig) DeletePluginConfigWhenEncrypting(c *cluster.Cluster)
- func (plugin *PluginConfig) GetPluginName(c *cluster.Cluster) (pluginName string, err error)
- func (plugin *PluginConfig) MustBackupFile(filenamePath string)
- func (plugin *PluginConfig) MustRestoreFile(filenamePath string)
- func (plugin *PluginConfig) RestoreSegmentTOCs(c *cluster.Cluster, fpInfo filepath.FilePathInfo, origSize int, destSize int, ...)
- func (plugin *PluginConfig) SetBackupPluginVersion(timestamp string, historicalPluginVersion string)
- func (plugin *PluginConfig) SetupPluginForBackup(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func (plugin *PluginConfig) SetupPluginForRestore(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
- func (plugin *PluginConfig) UsesEncryption() bool
- type PluginScope
- type ProgressBar
- type VerboseProgressBar
Constants ¶
const ( BackupPreventedByGpexpandMessage GpexpandFailureMessage = `Greenplum expansion currently in process, please re-run gpbackup when the expansion has completed` RestorePreventedByGpexpandMessage GpexpandFailureMessage = `` /* 268-byte string literal not displayed */ CoordinatorDataDirQuery = `select datadir from gp_segment_configuration where content=-1 and role='p'` GpexpandTemporaryTableStatusQuery = `SELECT status FROM gpexpand.status ORDER BY updated DESC LIMIT 1` GpexpandStatusTableExistsQuery = `` /* 156-byte string literal not displayed */ GpexpandStatusFilename = "gpexpand.status" )
const ( PB_NONE = iota PB_INFO PB_VERBOSE //Verbose progress bar logs every 10 percent INCR_PERCENT = 10 )
* The following constants are used for determining when to display a progress bar * * PB_INFO only shows in info mode because some methods have a different way of * logging in verbose mode and we don't want them to conflict * PB_VERBOSE show a progress bar in INFO and VERBOSE mode * * A simple incremental progress tracker will be shown in info mode and * in verbose mode we will log progress at increments of 10%
const DefaultPipeThroughProgram = "cat -"
const MINIMUM_GPDB5_VERSION = "5.1.0"
const RequiredPluginVersion = "0.3.0"
const SecretKeyFile = ".encrypt"
Variables ¶
This section is empty.
Functions ¶
func CheckAgentErrorsOnSegments ¶
func CheckAgentErrorsOnSegments(c *cluster.Cluster, fpInfo filepath.FilePathInfo) error
func CheckGpexpandRunning ¶
func CheckGpexpandRunning(errMsg GpexpandFailureMessage)
func CheckHelperPids ¶
func CheckHelperPids(c *cluster.Cluster, fpInfo filepath.FilePathInfo, operation string) (map[string][]int, bool)
Checks for gpbackup_helper processes on segments. Returns a boolean indicating whether any PIDs were found and a map of hostnames to PIDs.
func CleanUpSegmentHelperProcesses ¶
func CleanUpSegmentHelperProcesses(c *cluster.Cluster, fpInfo filepath.FilePathInfo, operation string, timeout time.Duration)
Checks for gpbackup_helper processes on segments and sends a USR1 signal to them to terminate. If the processes are not terminated within the timeout, a warning is logged. Ideally, the termination requests would only be sent to the segment hosts reported by CheckHelperPids, but the current design of cluster.GenerateAndExecuteCommand does not allow for that, so we a command to check for pids and send the termination signal to all segments if CheckHelperPids reports that there are still processes running.
func CommandExists ¶
func CreateSegmentPipeOnAllHostsForBackup ¶
func CreateSegmentPipeOnAllHostsForBackup(oid string, c *cluster.Cluster, fpInfo filepath.FilePathInfo)
* The reason that gprestore is in charge of creating the first pipe to ensure * that the first pipe is created before the first COPY FROM is issued. If * gpbackup_helper was in charge of creating the first pipe, there is a * possibility that the COPY FROM commands start before gpbackup_helper is done * starting up and setting up the first pipe.
func CreateSegmentPipeOnAllHostsForRestore ¶
func CreateSegmentPipeOnAllHostsForRestore(oid string, c *cluster.Cluster, fpInfo filepath.FilePathInfo)
func DollarQuoteString ¶
Dollar-quoting logic is based on appendStringLiteralDQ() in pg_dump.
func EscapeSingleQuotes ¶
func FileExists ¶
func GetFileHash ¶
func GetHelperFileCount ¶
func GetHelperFileCount(c *cluster.Cluster, fpInfo filepath.FilePathInfo) int
func InitializeSignalHandler ¶
func LogExecutionTime ¶
func MustPrintln ¶
func RemoveFileIfExists ¶
func RemoveHelperFiles ¶
func RemoveHelperFiles(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
Removes all gpbackup_helper files and pipes from the segment data directories. It's expected that gpbackup_helper cleans up the files on exit, but that is not guaranteed, so this function is used to clean up any leftover files.
func SchemaIsExcludedByUser ¶
func SetPipeThroughProgram ¶
func SetPipeThroughProgram(compression PipeThroughProgram)
func SliceToQuotedString ¶
func StartGpbackupHelpers ¶
func TerminateHangingCopySessions ¶
func TerminateHangingCopySessions(fpInfo filepath.FilePathInfo, appName string, timeout time.Duration, interval time.Duration)
TODO: Uniquely identify COPY commands in the multiple data file case to allow terminating sessions
func UnEscapeDoubleQuotes ¶
func UnquoteIdent ¶
func ValidateFQNs ¶
We require users to include schema and table, separated by a dot. So, check that there's at least one dot with stuff on either side of it. The remainder of validation is done in the ValidateTablesExist routine
func ValidateFullPath ¶
func WriteOidListToSegments ¶
func WriteOidsToFile ¶
Types ¶
type CompressionLevelsDescription ¶
A description of compression levels for some compression type
type FileWithByteCount ¶
func NewFileWithByteCount ¶
func NewFileWithByteCount(writer io.Writer) *FileWithByteCount
func NewFileWithByteCountFromFile ¶
func NewFileWithByteCountFromFile(filename string) *FileWithByteCount
func (*FileWithByteCount) Close ¶
func (file *FileWithByteCount) Close()
func (*FileWithByteCount) MustPrint ¶
func (file *FileWithByteCount) MustPrint(s string)
func (*FileWithByteCount) MustPrintf ¶
func (file *FileWithByteCount) MustPrintf(s string, v ...interface{})
func (*FileWithByteCount) MustPrintln ¶
func (file *FileWithByteCount) MustPrintln(v ...interface{})
type FilterSet ¶
* This set implementation can be used in one of two ways. An "include" set * returns true if an item is in the map and false otherwise, while an "exclude" * set returns false if an item is in the map and true otherwise, so that the * set can be used for filtering on items in lists. * * The alwaysMatchesFilter variable causes MatchesFilter() to always return true * if an empty list is passed, so that it doesn't attempt to filter on anything * The isExclude variable controls whether a set is an include set or an exclude * set.
func NewExcludeSet ¶
func NewIncludeSet ¶
func (*FilterSet) MatchesFilter ¶
type GpexpandFailureMessage ¶
type GpexpandFailureMessage string
type GpexpandSensor ¶
type GpexpandSensor struct {
// contains filtered or unexported fields
}
func NewGpexpandSensor ¶
func NewGpexpandSensor(myfs vfs.Filesystem, conn *dbconn.DBConn) GpexpandSensor
func (GpexpandSensor) IsGpexpandRunning ¶
func (sensor GpexpandSensor) IsGpexpandRunning() (bool, error)
type PipeThroughProgram ¶
type PipeThroughProgram struct { Name string OutputCommand string InputCommand string Extension string }
func GetPipeThroughProgram ¶
func GetPipeThroughProgram() PipeThroughProgram
type PluginConfig ¶
type PluginConfig struct { ExecutablePath string `yaml:"executablepath"` ConfigPath string `yaml:"-"` Options map[string]string `yaml:"options"` // contains filtered or unexported fields }
func ReadPluginConfig ¶
func ReadPluginConfig(configFile string) (*PluginConfig, error)
func (*PluginConfig) BackupFile ¶
func (plugin *PluginConfig) BackupFile(filenamePath string) error
func (*PluginConfig) BackupPluginVersion ¶
func (plugin *PluginConfig) BackupPluginVersion() string
func (*PluginConfig) BackupSegmentTOCs ¶
func (plugin *PluginConfig) BackupSegmentTOCs(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
func (*PluginConfig) CanRestoreSubset ¶
func (plugin *PluginConfig) CanRestoreSubset() bool
func (*PluginConfig) CheckPluginExistsOnAllHosts ¶
func (plugin *PluginConfig) CheckPluginExistsOnAllHosts(c *cluster.Cluster) string
func (*PluginConfig) CleanupPluginForBackup ¶
func (plugin *PluginConfig) CleanupPluginForBackup(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
func (*PluginConfig) CleanupPluginForRestore ¶
func (plugin *PluginConfig) CleanupPluginForRestore(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
func (*PluginConfig) CopyPluginConfigToAllHosts ¶
func (plugin *PluginConfig) CopyPluginConfigToAllHosts(c *cluster.Cluster)
func (*PluginConfig) DeletePluginConfigWhenEncrypting ¶
func (plugin *PluginConfig) DeletePluginConfigWhenEncrypting(c *cluster.Cluster)
func (*PluginConfig) GetPluginName ¶
func (plugin *PluginConfig) GetPluginName(c *cluster.Cluster) (pluginName string, err error)
func (*PluginConfig) MustBackupFile ¶
func (plugin *PluginConfig) MustBackupFile(filenamePath string)
func (*PluginConfig) MustRestoreFile ¶
func (plugin *PluginConfig) MustRestoreFile(filenamePath string)
func (*PluginConfig) RestoreSegmentTOCs ¶
func (plugin *PluginConfig) RestoreSegmentTOCs(c *cluster.Cluster, fpInfo filepath.FilePathInfo, origSize int, destSize int, batches int)
func (*PluginConfig) SetBackupPluginVersion ¶
func (plugin *PluginConfig) SetBackupPluginVersion(timestamp string, historicalPluginVersion string)
func (*PluginConfig) SetupPluginForBackup ¶
func (plugin *PluginConfig) SetupPluginForBackup(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
func (*PluginConfig) SetupPluginForRestore ¶
func (plugin *PluginConfig) SetupPluginForRestore(c *cluster.Cluster, fpInfo filepath.FilePathInfo)
func (*PluginConfig) UsesEncryption ¶
func (plugin *PluginConfig) UsesEncryption() bool
type PluginScope ¶
type PluginScope string
const ( COORDINATOR PluginScope = "coordinator" MASTER PluginScope = "master" SEGMENT_HOST PluginScope = "segment_host" SEGMENT PluginScope = "segment" )
The COORDINATOR and MASTER scopes are identical in function, we just support both so that creators of existing plugins as of GPDB 6 need not (re)write them to support the GPDB 7 verbiage. Plugin code should use COORDINATOR when carrying out internal functionality, but check for both COORDINATOR and MASTER when expecting external input.
type ProgressBar ¶
func NewProgressBar ¶
func NewProgressBar(count int, prefix string, showProgressBar int) ProgressBar
type VerboseProgressBar ¶
type VerboseProgressBar struct { *pb.ProgressBar // contains filtered or unexported fields }
func NewVerboseProgressBar ¶
func NewVerboseProgressBar(count int, prefix string) *VerboseProgressBar
func (*VerboseProgressBar) Increment ¶
func (vpb *VerboseProgressBar) Increment() int