Open RealGrayRabbit opened 1 month ago
Hey, @RealGrayRabbit welcome!🎊 Thanks for taking the time to point this out.🙌
Hi @Terry1504 , could you please have a look at it when have time? Thanks
@my-ship-it @RealGrayRabbit
createdb cloudberrydb
psql cloudberrydb -c 'create extension gp_toolkit;'
and use the issue steps
gpbackup
issue for cloudberry/gpbackupdiff --git a/backup/predata_functions.go b/backup/predata_functions.go
index 61cd31d..e7a9bae 100644
--- a/backup/predata_functions.go
+++ b/backup/predata_functions.go
@@ -278,7 +278,10 @@ func PrintCreateCastStatement(metadataFile *utils.FileWithByteCount, toc *toc.TO
func PrintCreateExtensionStatements(metadataFile *utils.FileWithByteCount, toc *toc.TOC, extensionDefs []Extension, extensionMetadata MetadataMap) {
for _, extensionDef := range extensionDefs {
start := metadataFile.ByteCount
- metadataFile.MustPrintf("\n\nSET search_path=%s,pg_catalog;\nCREATE EXTENSION IF NOT EXISTS %s WITH SCHEMA %s;\nSET search_path=pg_catalog;", extensionDef.Schema, extensionDef.Name, extensionDef.Schema)
+ metadataFile.MustPrintf(
+ "\n\nCREATE SCHEMA IF NOT EXISTS %[1]s;\nSET search_path=%[1]s,pg_catalog;\nCREATE EXTENSION IF NOT EXISTS %[2]s WITH SCHEMA %[1]s;\nSET search_path=pg_catalog;\n",
+ extensionDef.Schema, extensionDef.Name)
+
section, entry := extensionDef.GetMetadataEntry()
toc.AddMetadataEntry(section, entry, start, metadataFile.ByteCount)
you can change the code in https://github.com/cloudberrydb/gpbackup or cherrypick from gpdb/gpbackup or https://github.com/arenadata/gpbackup then
make build
you can fix the issue
Hi @yihong0618 Great catch! Would you like to help submit one PR to the gpbackup
repo to fix this?
Hi @yihong0618 Great catch! Would you like to help submit one PR to the
gpbackup
repo to fix this?
yes but maybe later next week a little busy these days
Great work @yihong0618
@my-ship-it @tuhaihe https://github.com/cloudberrydb/gpbackup/pull/9
Cloudberry Database version
PostgreSQL 14.4 (Cloudberry Database 1.6.0 build 1) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22), 64-bit compiled on Sep 3 2024 07:22:14 (1 row)
What happened
System can not use gprestore to restore database. The case is descripted as below: Step 1: gpbackup --dbname cloudberry
Step 2: dropdb cloudberry
Why and how to resolve it?
What you think should happen instead
Since I use gpbackup and gprestore as user manual, It shall be able to restore the backed database normally. But it seems that gprestore can not create system schema "gp_toolkit"!
How to reproduce
As descripted in "What happen" section.
Operating System
Rocky Linux release 8.10 (Green Obsidian)
Anything else
No response
Are you willing to submit PR?
Code of Conduct