Documentation ¶
Index ¶
- Constants
- func AppendBackupParams(infoArr *[]LineInfo, paramsStr string)
- func CheckAgentErrorsOnSegments(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo) error
- func CheckExclusiveFlags(flags *pflag.FlagSet, flagNames ...string)
- func CheckGpexpandRunning(errMsg GpexpandFailureMessage)
- func CleanUpHelperFilesOnAllHosts(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
- func CleanUpSegmentHelperProcesses(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo, operation string)
- func ConstructEmailMessage(timestamp string, contactList string, reportFilePath string, utility string) string
- func CopyFile(src, dest string) error
- func CreateFirstSegmentPipeOnAllHosts(oid string, c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
- func DollarQuoteString(literal string) string
- func EmailReport(c *cluster.Cluster, timestamp string, reportFilePath string, utility string)
- func EnsureBackupVersionCompatibility(backupVersion string, restoreVersion string)
- func EnsureDatabaseVersionCompatibility(backupGPDBVersion string, restoreGPDBVersion dbconn.GPDBVersion)
- func EscapeSingleQuotes(str string) string
- func GetContacts(filename string, utility string) string
- func GetDurationInfo(timestamp string, endTime time.Time) (string, string, string)
- func GetIncludedPartitionRoots(tocDataEntries []MasterDataEntry, includeRelations []string) []string
- func GetSecretKey(pluginName string, mdd string) (string, error)
- func GetUserAndHostInfo() (string, string, string)
- func HandleSingleDashes(args []string) []string
- func InitializePipeThroughParameters(compress bool, compressionLevel int)
- func InitializeSignalHandler(cleanupFunc func(), procDesc string, termFlag *bool)
- func MakeFQN(schema string, object string) string
- func MustGetFlagBool(cmdFlags *pflag.FlagSet, flagName string) bool
- func MustGetFlagInt(cmdFlags *pflag.FlagSet, flagName string) int
- func MustGetFlagString(cmdFlags *pflag.FlagSet, flagName string) string
- func MustGetFlagStringArray(cmdFlags *pflag.FlagSet, flagName string) []string
- func MustGetFlagStringSlice(cmdFlags *pflag.FlagSet, flagName string) []string
- func MustPrintBytes(file io.Writer, bytes []byte) uint64
- func MustPrintf(file io.Writer, s string, v ...interface{}) uint64
- func MustPrintln(file io.Writer, v ...interface{}) uint64
- func ParseErrorMessage(errStr string) string
- func PrintObjectCounts(reportFile io.WriteCloser, objectCounts map[string]int)
- func QuoteIdent(connectionPool *dbconn.DBConn, ident string) string
- func SetPipeThroughProgram(compression PipeThroughProgram)
- func SliceToQuotedString(slice []string) string
- func StartAgent(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo, operation string, ...)
- func TerminateHangingCopySessions(connectionPool *dbconn.DBConn, fpInfo backup_filepath.FilePathInfo, ...)
- func UnquoteIdent(ident string) string
- func ValidateFQNs(fqns []string)
- 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 backup_filepath.FilePathInfo)
- func WriteOids(writer io.Writer, oidList []string) error
- func WriteOidsToFile(filename string, oidList []string)
- func WriteRestoreReportFile(reportFilename string, backupTimestamp string, startTimestamp string, ...)
- type AOEntry
- type ContactFile
- type EmailContact
- type FileWithByteCount
- type FilterSet
- type GpexpandFailureMessage
- type GpexpandSensor
- type IncrementalEntries
- type LineInfo
- type MasterDataEntry
- type MetadataEntry
- type PipeThroughProgram
- type PluginConfig
- func (plugin *PluginConfig) BackupFile(filenamePath string) error
- func (plugin *PluginConfig) BackupPluginVersion() string
- func (plugin *PluginConfig) BackupSegmentTOCs(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
- func (plugin *PluginConfig) CheckPluginExistsOnAllHosts(c *cluster.Cluster) string
- func (plugin *PluginConfig) CleanupPluginForBackup(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
- func (plugin *PluginConfig) CleanupPluginForRestore(c *cluster.Cluster, fpInfo backup_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 backup_filepath.FilePathInfo)
- func (plugin *PluginConfig) SetBackupPluginVersion(timestamp string, historicalPluginVersion string)
- func (plugin *PluginConfig) SetupPluginForBackup(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
- func (plugin *PluginConfig) SetupPluginForRestore(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
- func (plugin *PluginConfig) UsesEncryption() bool
- type PluginScope
- type ProgressBar
- type Report
- type SegmentDataEntry
- type SegmentTOC
- type StatementWithType
- type TOC
- func (toc *TOC) AddMasterDataEntry(schema string, name string, oid uint32, attributeString string, ...)
- func (toc *TOC) AddMetadataEntry(section string, entry MetadataEntry, start, end uint64)
- func (toc *TOC) GetDataEntriesMatching(includeSchemas []string, excludeSchemas []string, includeTableFQNs []string, ...) []MasterDataEntry
- func (toc *TOC) GetSQLStatementForObjectTypes(section string, metadataFile io.ReaderAt, includeObjectTypes []string, ...) []StatementWithType
- func (toc *TOC) InitializeMetadataEntryMap()
- func (toc *TOC) WriteToFileAndMakeReadOnly(filename string)
- type TOCObject
- type TOCObjectWithMetadata
- type VerboseProgressBar
Constants ¶
const ( BACKUP_DIR = "backup-dir" COMPRESSION_LEVEL = "compression-level" DATA_ONLY = "data-only" DBNAME = "dbname" DEBUG = "debug" EXCLUDE_RELATION = "exclude-table" EXCLUDE_RELATION_FILE = "exclude-table-file" EXCLUDE_SCHEMA = "exclude-schema" FROM_TIMESTAMP = "from-timestamp" INCLUDE_RELATION = "include-table" INCLUDE_RELATION_FILE = "include-table-file" INCLUDE_SCHEMA = "include-schema" INCREMENTAL = "incremental" JOBS = "jobs" LEAF_PARTITION_DATA = "leaf-partition-data" METADATA_ONLY = "metadata-only" NO_COMPRESSION = "no-compression" PLUGIN_CONFIG = "plugin-config" QUIET = "quiet" SINGLE_DATA_FILE = "single-data-file" VERBOSE = "verbose" WITH_STATS = "with-stats" CREATE_DB = "create-db" ON_ERROR_CONTINUE = "on-error-continue" REDIRECT_DB = "redirect-db" TIMESTAMP = "timestamp" WITH_GLOBALS = "with-globals" )
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 */ MasterDataDirQuery = `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 MINIMUM_GPDB4_VERSION = "4.3.17"
const MINIMUM_GPDB5_VERSION = "5.1.0"
const RequiredPluginVersion = "0.3.0"
const SecretKeyFile = ".encrypt"
Variables ¶
This section is empty.
Functions ¶
func AppendBackupParams ¶
func CheckAgentErrorsOnSegments ¶
func CheckAgentErrorsOnSegments(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo) error
func CheckExclusiveFlags ¶
At most one of the flags passed to this function may be set
func CheckGpexpandRunning ¶
func CheckGpexpandRunning(errMsg GpexpandFailureMessage)
func CleanUpHelperFilesOnAllHosts ¶
func CleanUpHelperFilesOnAllHosts(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
func CleanUpSegmentHelperProcesses ¶
func CleanUpSegmentHelperProcesses(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo, operation string)
func ConstructEmailMessage ¶
func CreateFirstSegmentPipeOnAllHosts ¶
func CreateFirstSegmentPipeOnAllHosts(oid string, c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
func DollarQuoteString ¶
Dollar-quoting logic is based on appendStringLiteralDQ() in pg_dump.
func EmailReport ¶
func EnsureBackupVersionCompatibility ¶
* This function will not error out if the user has gprestore X.Y.Z * and gpbackup X.Y.Z+dev, when technically the uncommitted code changes * in the +dev version of gpbackup may have incompatibilities with the * committed version of gprestore. * * We assume this condition will never arise in practice, as gpbackup and * gprestore will be built with identical versions during development, and * users will never use a +dev version in production.
func EnsureDatabaseVersionCompatibility ¶
func EnsureDatabaseVersionCompatibility(backupGPDBVersion string, restoreGPDBVersion dbconn.GPDBVersion)
func EscapeSingleQuotes ¶
func GetContacts ¶
func GetDurationInfo ¶
func GetIncludedPartitionRoots ¶
func GetIncludedPartitionRoots(tocDataEntries []MasterDataEntry, includeRelations []string) []string
func GetUserAndHostInfo ¶
func HandleSingleDashes ¶
* Convert arguments that contain a single dash to double dashes for backward * compatibility.
func InitializeSignalHandler ¶
func MustGetFlagStringArray ¶
func MustGetFlagStringSlice ¶
func MustPrintln ¶
func ParseErrorMessage ¶
func PrintObjectCounts ¶
func PrintObjectCounts(reportFile io.WriteCloser, objectCounts map[string]int)
func SetPipeThroughProgram ¶
func SetPipeThroughProgram(compression PipeThroughProgram)
func SliceToQuotedString ¶
func StartAgent ¶
func StartAgent(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo, operation string, pluginConfigFile string, compressStr string)
func TerminateHangingCopySessions ¶
func TerminateHangingCopySessions(connectionPool *dbconn.DBConn, fpInfo backup_filepath.FilePathInfo, appName string)
TODO: Uniquely identify COPY commands in the multiple data file case to allow terminating sessions
func UnquoteIdent ¶
func ValidateFQNs ¶
func ValidateFQNs(fqns []string)
func ValidateFullPath ¶
func WriteOidListToSegments ¶
func WriteOidListToSegments(oidList []string, c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
func WriteOidsToFile ¶
Types ¶
type ContactFile ¶
type ContactFile struct {
Contacts map[string][]EmailContact
}
type EmailContact ¶
type FileWithByteCount ¶
type FileWithByteCount struct { Filename string ByteCount uint64 // contains filtered or unexported fields }
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 IncrementalEntries ¶
type MasterDataEntry ¶
type MetadataEntry ¶
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 backup_filepath.FilePathInfo)
func (*PluginConfig) CheckPluginExistsOnAllHosts ¶
func (plugin *PluginConfig) CheckPluginExistsOnAllHosts(c *cluster.Cluster) string
func (*PluginConfig) CleanupPluginForBackup ¶
func (plugin *PluginConfig) CleanupPluginForBackup(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
func (*PluginConfig) CleanupPluginForRestore ¶
func (plugin *PluginConfig) CleanupPluginForRestore(c *cluster.Cluster, fpInfo backup_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 backup_filepath.FilePathInfo)
func (*PluginConfig) SetBackupPluginVersion ¶
func (plugin *PluginConfig) SetBackupPluginVersion(timestamp string, historicalPluginVersion string)
func (*PluginConfig) SetupPluginForBackup ¶
func (plugin *PluginConfig) SetupPluginForBackup(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
func (*PluginConfig) SetupPluginForRestore ¶
func (plugin *PluginConfig) SetupPluginForRestore(c *cluster.Cluster, fpInfo backup_filepath.FilePathInfo)
func (*PluginConfig) UsesEncryption ¶
func (plugin *PluginConfig) UsesEncryption() bool
type PluginScope ¶
type PluginScope string
const ( MASTER PluginScope = "master" SEGMENT_HOST PluginScope = "segment_host" SEGMENT PluginScope = "segment" )
type ProgressBar ¶
type ProgressBar interface { Start() *pb.ProgressBar Finish() Increment() int }
func NewProgressBar ¶
func NewProgressBar(count int, prefix string, showProgressBar int) ProgressBar
type Report ¶
type Report struct { BackupParamsString string DatabaseSize string backup_history.BackupConfig }
* This struct holds information that will be printed to the report file * after a backup, as well as information printed to the configuration * file that we will want to read in for a restore.
func (*Report) ConstructBackupParamsString ¶
func (report *Report) ConstructBackupParamsString()
type SegmentDataEntry ¶
type SegmentTOC ¶
type SegmentTOC struct {
DataEntries map[uint]SegmentDataEntry
}
func NewSegmentTOC ¶
func NewSegmentTOC(filename string) *SegmentTOC
func (*SegmentTOC) AddSegmentDataEntry ¶
func (toc *SegmentTOC) AddSegmentDataEntry(oid uint, startByte uint64, endByte uint64)
func (*SegmentTOC) WriteToFileAndMakeReadOnly ¶
func (toc *SegmentTOC) WriteToFileAndMakeReadOnly(filename string) error
This function return an error rather than Fataling because it is called by the helper
type StatementWithType ¶
type StatementWithType struct { Schema string Name string ObjectType string ReferenceObject string Statement string }
func RemoveActiveRole ¶
func RemoveActiveRole(activeUser string, statements []StatementWithType) []StatementWithType
func SubstituteRedirectDatabaseInStatements ¶
func SubstituteRedirectDatabaseInStatements(statements []StatementWithType, oldQuotedName string, newQuotedName string) []StatementWithType
type TOC ¶
type TOC struct { GlobalEntries []MetadataEntry PredataEntries []MetadataEntry PostdataEntries []MetadataEntry StatisticsEntries []MetadataEntry DataEntries []MasterDataEntry IncrementalMetadata IncrementalEntries // contains filtered or unexported fields }
func (*TOC) AddMasterDataEntry ¶
func (*TOC) AddMetadataEntry ¶
func (toc *TOC) AddMetadataEntry(section string, entry MetadataEntry, start, end uint64)
func (*TOC) GetDataEntriesMatching ¶
func (*TOC) GetSQLStatementForObjectTypes ¶
func (*TOC) InitializeMetadataEntryMap ¶
func (toc *TOC) InitializeMetadataEntryMap()
func (*TOC) WriteToFileAndMakeReadOnly ¶
type TOCObject ¶
type TOCObject interface {
GetMetadataEntry() (string, MetadataEntry)
}
type TOCObjectWithMetadata ¶
type TOCObjectWithMetadata interface { GetMetadataEntry() (string, MetadataEntry) FQN() string }
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