Skip to content

Commit

Permalink
Update the information fields for CloudberryDB
Browse files Browse the repository at this point in the history
Update the fields on CloudberryDB to improve the experience when users
run the gpbackup tool.
  • Loading branch information
tuhaihe committed Jan 17, 2024
1 parent 6695503 commit 4dfea48
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func DoSetup() {
timestamp := history.CurrentTimestamp()
createBackupLockFile(timestamp)
initializeConnectionPool(timestamp)
gplog.Info("Greenplum Database Version = %s", connectionPool.Version.VersionString)
gplog.Info("Cloudberry Database Version = %s", connectionPool.Version.VersionString)

gplog.Info("Starting backup of database %s", MustGetFlagString(options.DBNAME))
opts, err := options.NewOptions(cmdFlags)
Expand Down
2 changes: 1 addition & 1 deletion end_to_end/locks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var _ = Describe("Deadlock handling", func() {
})
It("runs gpbackup and defers 2 deadlocked tables to main worker", func() {
if true {
Skip(fmt.Sprintf("This test is not needed for old backup versions or GPDB versions < %s", backup.SNAPSHOT_GPDB_MIN_VERSION))
Skip(fmt.Sprintf("This test is not needed for old backup versions or CloudberryDB versions < %s", backup.SNAPSHOT_GPDB_MIN_VERSION))
}
// Acquire AccessExclusiveLock on public.foo to block gpbackup when it attempts
// to grab AccessShareLocks before its metadata dump section.
Expand Down
4 changes: 2 additions & 2 deletions gppkg/gpbackup_tools.spec.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: gpbackup_tools_%{operating_system}
Version: %{rpm_version}
Release: 1
Summary: Backup and restore utilities for Greenplum
Summary: Backup and restore utilities for CloudberryDB
License: Pivotal Software EULA
Source0: bin_gpbackup.tar.gz
BuildArch: x86_64
Expand All @@ -11,7 +11,7 @@ Prefix: /usr/local
AutoReqProv: no

%description
Backup and restore utilities for Greenplum
Backup and restore utilities for CloudberryDB

%prep
%setup -c -q -T -D -a 0
Expand Down
8 changes: 4 additions & 4 deletions integration/gpexpand_not_running_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var _ = Describe("gpexpand_sensor", func() {
}
}()

defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-Greenplum expansion currently in process. Once expansion is complete, it will be possible to restart gprestore, but please note existing backup sets taken with a different cluster configuration may no longer be compatible with the newly expanded cluster configuration`)
defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-CloudberryDB expansion currently in process. Once expansion is complete, it will be possible to restart gprestore, but please note existing backup sets taken with a different cluster configuration may no longer be compatible with the newly expanded cluster configuration`)
restore.DoSetup()
})
It("should prevent gprestore from starting when gpexpand is in phase 2", func() {
Expand All @@ -54,7 +54,7 @@ var _ = Describe("gpexpand_sensor", func() {
testhelper.AssertQueryRuns(postgresConn, "CREATE TABLE gpexpand.status (status text, updated timestamp)")
testhelper.AssertQueryRuns(postgresConn, "INSERT INTO gpexpand.status VALUES ('IN PROGRESS', now())")

defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-Greenplum expansion currently in process. Once expansion is complete, it will be possible to restart gprestore, but please note existing backup sets taken with a different cluster configuration may no longer be compatible with the newly expanded cluster configuration`)
defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-CloudberryDB expansion currently in process. Once expansion is complete, it will be possible to restart gprestore, but please note existing backup sets taken with a different cluster configuration may no longer be compatible with the newly expanded cluster configuration`)
restore.DoSetup()
})
It("should prevent gpbackup from starting when gpexpand is in phase 1", func() {
Expand All @@ -76,7 +76,7 @@ var _ = Describe("gpexpand_sensor", func() {
}
}()

defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-Greenplum expansion currently in process, please re-run gpbackup when the expansion has completed`)
defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-CloudberryDB expansion currently in process, please re-run gpbackup when the expansion has completed`)
backup.DoSetup()
})
It("should prevent gpbackup from starting when gpexpand is in phase 2", func() {
Expand All @@ -89,7 +89,7 @@ var _ = Describe("gpexpand_sensor", func() {
testhelper.AssertQueryRuns(postgresConn, "CREATE TABLE gpexpand.status (status text, updated timestamp)")
testhelper.AssertQueryRuns(postgresConn, "INSERT INTO gpexpand.status VALUES ('IN PROGRESS', now())")

defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-Greenplum expansion currently in process, please re-run gpbackup when the expansion has completed`)
defer testhelper.ShouldPanicWithMessage(`[CRITICAL]:-CloudberryDB expansion currently in process, please re-run gpbackup when the expansion has completed`)
backup.DoSetup()
})
})
8 changes: 4 additions & 4 deletions report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (report *Report) WriteBackupReportFile(reportFilename string, timestamp str
reportInfo := make([]LineInfo, 0)
reportInfo = append(reportInfo,
LineInfo{Key: "timestamp key:", Value: timestamp},
LineInfo{Key: "gpdb version:", Value: report.DatabaseVersion},
LineInfo{Key: "database version:", Value: report.DatabaseVersion},
LineInfo{Key: "gpbackup version:", Value: fmt.Sprintf("%s\n", report.BackupVersion)},
LineInfo{Key: "database name:", Value: report.DatabaseName},
LineInfo{Key: "command line:", Value: gpbackupCommandLine},
Expand Down Expand Up @@ -159,7 +159,7 @@ func (report *Report) WriteBackupReportFile(reportFilename string, timestamp str
reportInfo = append(reportInfo,
LineInfo{Key: "segment count:", Value: fmt.Sprintf("%d", report.SegmentCount)})

_, err = fmt.Fprint(reportFile, "Greenplum Database Backup Report\n\n")
_, err = fmt.Fprint(reportFile, "Cloudberry Database Backup Report\n\n")
if err != nil {
gplog.Error("Unable to write backup report file %s", reportFilename)
return
Expand All @@ -184,12 +184,12 @@ func WriteRestoreReportFile(reportFilename string, backupTimestamp string, start
gprestoreCommandLine := strings.Join(os.Args, " ")
start, end, duration := GetDurationInfo(startTimestamp, operating.System.Now())

utils.MustPrintf(reportFile, "Greenplum Database Restore Report\n\n")
utils.MustPrintf(reportFile, "Cloudberry Database Restore Report\n\n")

reportInfo := make([]LineInfo, 0)
reportInfo = append(reportInfo,
LineInfo{Key: "timestamp key:", Value: backupTimestamp},
LineInfo{Key: "gpdb version:", Value: connectionPool.Version.VersionString},
LineInfo{Key: "database version:", Value: connectionPool.Version.VersionString},
LineInfo{Key: "gprestore version:", Value: fmt.Sprintf("%s\n", restoreVersion)},
LineInfo{Key: "database name:", Value: connectionPool.DBName},
LineInfo{Key: "command line:", Value: fmt.Sprintf("%s\n", gprestoreCommandLine)},
Expand Down
40 changes: 21 additions & 19 deletions report/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ data file format: Single Data File Per Segment`,

It("writes a report for a successful backup", func() {
backupReport.WriteBackupReportFile("filename", timestamp, endtime, objectCounts, "")
Expect(buffer).To(Say(`Greenplum Database Backup Report
Expect(buffer).To(Say(`Cloudberry Database Backup Report
timestamp key: 20170101010101
gpdb version: 5\.0\.0 build test
gpbackup version: 0\.1\.0
database version: 5.0.0 build test
gpbackup version: 0.1.0
database name: testdb
command line: .*
Expand All @@ -124,11 +124,11 @@ types 1000`))
})
It("writes a report for a failed backup", func() {
backupReport.WriteBackupReportFile("filename", timestamp, endtime, objectCounts, "Cannot access /tmp/backups: Permission denied")
Expect(buffer).To(Say(`Greenplum Database Backup Report
Expect(buffer).To(Say(`Cloudberry Database Backup Report
timestamp key: 20170101010101
gpdb version: 5\.0\.0 build test
gpbackup version: 0\.1\.0
database version: 5.0.0 build test
gpbackup version: 0.1.0
database name: testdb
command line: .*
Expand Down Expand Up @@ -156,11 +156,11 @@ types 1000`))
It("writes a report without database size information", func() {
backupReport.DatabaseSize = ""
backupReport.WriteBackupReportFile("filename", timestamp, endtime, objectCounts, "")
Expect(buffer).To(Say(`Greenplum Database Backup Report
Expect(buffer).To(Say(`Cloudberry Database Backup Report
timestamp key: 20170101010101
gpdb version: 5\.0\.0 build test
gpbackup version: 0\.1\.0
database version: 5.0.0 build test
gpbackup version: 0.1.0
database name: testdb
command line: .*
Expand Down Expand Up @@ -245,11 +245,11 @@ incremental backup set:
It("writes a report for a failed restore", func() {
gplog.SetErrorCode(2)
report.WriteRestoreReportFile("filename", timestamp, restoreStartTime, connectionPool, restoreVersion, 3, 4, "Cannot access /tmp/backups: Permission denied")
Expect(buffer).To(Say(`Greenplum Database Restore Report
Expect(buffer).To(Say(`Cloudberry Database Restore Report
timestamp key: 20170101010101
gpdb version: 5\.0\.0 build test
gprestore version: 0\.1\.0
database version: 5.0.0 build test
gprestore version: 0.1.0
database name: testdb
command line: .*
Expand All @@ -266,11 +266,11 @@ restore error: Cannot access /tmp/backups: Permission denied`))
It("writes a report for a successful restore", func() {
gplog.SetErrorCode(0)
report.WriteRestoreReportFile("filename", timestamp, restoreStartTime, connectionPool, restoreVersion, 3, 3, "")
Expect(buffer).To(Say(`Greenplum Database Restore Report
Expect(buffer).To(Say(`Cloudberry Database Restore Report
timestamp key: 20170101010101
gpdb version: 5\.0\.0 build test
gprestore version: 0\.1\.0
database version: 5.0.0 build test
gprestore version: 0.1.0
database name: testdb
command line: .*
Expand All @@ -286,11 +286,11 @@ restore status: Success`))
It("writes a report for a successful restore with errors", func() {
gplog.SetErrorCode(1)
report.WriteRestoreReportFile("filename", timestamp, restoreStartTime, connectionPool, restoreVersion, 3, 3, "")
Expect(buffer).To(Say(`Greenplum Database Restore Report
Expect(buffer).To(Say(`Cloudberry Database Restore Report
timestamp key: 20170101010101
gpdb version: 5\.0\.0 build test
gprestore version: 0\.1\.0
database version: 5.0.0 build test
gprestore version: 0.1.0
database name: testdb
command line: .*
Expand Down Expand Up @@ -556,7 +556,7 @@ Content-Disposition: inline
<html>
<body>
<pre style=\"font: monospace\">
Greenplum Database Backup Report
Cloudberry Database Backup Report
Timestamp Key: 20170101010101
</pre>
Expand All @@ -576,7 +576,9 @@ Content-Disposition: inline
<html>
<body>
<pre style=\"font: monospace\">
Cloudberry Database Backup Report
Timestamp Key: 20170101010101
</pre>
</body>
</html>" | sendmail -t`
Expand Down
2 changes: 1 addition & 1 deletion restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func DoSetup() {

gplog.Info("gpbackup version = %s", backupConfig.BackupVersion)
gplog.Info("gprestore version = %s", GetVersion())
gplog.Info("Greenplum Database Version = %s", connectionPool.Version.VersionString)
gplog.Info("Database Version = %s", connectionPool.Version.VersionString)

BackupConfigurationValidation()
metadataFilename := globalFPInfo.GetMetadataFilePath()
Expand Down
4 changes: 2 additions & 2 deletions utils/gpexpand_sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

const (
BackupPreventedByGpexpandMessage GpexpandFailureMessage = `Greenplum expansion currently in process, please re-run gpbackup when the expansion has completed`
BackupPreventedByGpexpandMessage GpexpandFailureMessage = `CloudberryDB expansion currently in process, please re-run gpbackup when the expansion has completed`

RestorePreventedByGpexpandMessage GpexpandFailureMessage = `Greenplum expansion currently in process. Once expansion is complete, it will be possible to restart gprestore, but please note existing backup sets taken with a different cluster configuration may no longer be compatible with the newly expanded cluster configuration`
RestorePreventedByGpexpandMessage GpexpandFailureMessage = `CloudberryDB expansion currently in process. Once expansion is complete, it will be possible to restart gprestore, but please note existing backup sets taken with a different cluster configuration may no longer be compatible with the newly expanded cluster configuration`

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`
Expand Down

0 comments on commit 4dfea48

Please sign in to comment.