Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
value: "Thank you for reporting the problem! We really appreciate your efforts to improve cbcopy. Before reporting it, please (ideally) test on the latest release or main to see if the issue is fixed."
- type: textarea
attributes:
label: Cloudberry Database and cbcopy version
label: Apache Cloudberry and cbcopy version
description: What version are you using?
- type: textarea
attributes:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Cloudberry Database community welcomes contributions from anyone, new and
Apache Cloudberry community welcomes contributions from anyone, new and
experienced! We appreciate your interest in contributing. This guide will help
you get started with the contribution.

## Code of Conduct

Everyone who participates in Cloudberry Database, either as a user or a
Everyone who participates in Apache Cloudberry, either as a user or a
contributor, is obliged to follow our community [Code of
Conduct](./CODE_OF_CONDUCT.md). Every violation against it will be reviewed
and investigated and will result in a response that is deemed necessary and
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cbcopy

cbcopy is an efficient database migration tool designed to transfer data and metadata from Greenplum Database(GPDB) to Cloudberry Database(Cloudberrydb), while also supporting migrations between Greenplum databases and between Cloudberry databases for disaster recovery and database version upgrades.
cbcopy is an efficient database migration tool designed to transfer data and metadata from Greenplum Database(GPDB) to Apache Cloudberry(Cloudberrydb), while also supporting migrations between Greenplum databases and between Cloudberry databases for disaster recovery and database version upgrades.

![cbcopy_arch](.github/cbcopy_arch.png)

Expand Down Expand Up @@ -252,7 +252,7 @@ For more detailed examples, you can refer to our test files:

## cbcopy reference
```
cbcopy utility for migrating data from Greenplum Database (GPDB) to Cloudberry Database (CBDB)
cbcopy utility for migrating data from Greenplum Database (GPDB) to Apache Cloudberry (CBDB)

Usage:
cbcopy [flags]
Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Thanks for helping make Cloudberry Database safe!
Thanks for helping make Apache Cloudberry safe!

---

Expand Down Expand Up @@ -48,14 +48,14 @@ For better collaboration, we hope you:

Here's an overview of the security issues handling process:

* The reporter reports the security issues to the Cloudberry Database
* The reporter reports the security issues to the Apache Cloudberry
team.
* The Cloudberry Database team investigates the report and decides to
* The Apache Cloudberry team investigates the report and decides to
accept or reject the report. If our team rejects the report, the
team will explain why to the reporter. If we accept the report, our
team will work privately with the reporter to fix the security
issues.
* Release the new version of the Cloudberry Database that includes the
* Release the new version of the Apache Cloudberry that includes the
fix.
* Public the security issues.

Expand Down
2 changes: 1 addition & 1 deletion cbcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func main() {

var rootCmd = &cobra.Command{
Use: "cbcopy",
Short: "cbcopy utility for migrating data from Greenplum Database (GPDB) to Cloudberry Database (CBDB)",
Short: "cbcopy utility for migrating data from Greenplum Database (GPDB) to Apache Cloudberry (CBDB)",
Args: cobra.NoArgs,
Version: utils.GetVersion(),
Run: func(cmd *cobra.Command, args []string) {
Expand Down
10 changes: 7 additions & 3 deletions internal/dbconn/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ type DBType int
const (
Unknown DBType = iota
GPDB // Greenplum Database
CBDB // Cloudberry Database
CBDB // Apache Cloudberry
HDW // HashData Database
PGSQL // PostgreSQL
)

const (
gpdbPattern = `\(Greenplum Database ([0-9]+\.[0-9]+\.[0-9]+)[^)]*\)`
cbdbPattern = `\(Cloudberry Database ([0-9]+\.[0-9]+\.[0-9]+)[^)]*\)`
cbdbNewPattern = `\(Apache Cloudberry ([0-9]+\.[0-9]+\.[0-9]+)[^)]*\)`
hdwPattern = `\(HashData Warehouse ([0-9]+\.[0-9]+\.[0-9]+)[^)]*\)`
pgsqlPattern = `^PostgreSQL\s+([0-9]+\.[0-9]+\.[0-9]+)`
)
Expand All @@ -33,7 +34,7 @@ func (t DBType) String() string {
case GPDB:
return "Greenplum Database"
case CBDB:
return "Cloudberry Database"
return "Apache Cloudberry"
case HDW:
return "HashData Database"
case PGSQL:
Expand Down Expand Up @@ -81,7 +82,7 @@ func NewVersion(versionStr string) GPDBVersion {
//
// Cloudberry:
//
// PostgreSQL 14.4 (Cloudberry Database 1.2.0 build commit:5b5ae3f8aa638786f01bbd08307b6474a1ba1997)
// PostgreSQL 14.4 (Apache Cloudberry 1.2.0 build commit:5b5ae3f8aa638786f01bbd08307b6474a1ba1997)
// on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11), 64-bit compiled on Feb 16 2023 23:44:39
//
// Greenplum:
Expand Down Expand Up @@ -114,6 +115,9 @@ func (dbversion *GPDBVersion) ParseVersionInfo(versionString string) {
if ver, ok := dbversion.extractVersion(cbdbPattern); ok {
dbversion.Type = CBDB
dbversion.SemVer = ver
} else if ver, ok := dbversion.extractVersion(cbdbNewPattern); ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle both Apache Cloudberry and Cloudberry Database by classifying them as CBDB, this approach could lead to issues in the future:

  1. Version number conflicts: For example, in [Bug] Error in copy some tables #13 we see Apache Cloudberry 1.6.0, but Cloudberry Database 1.6.0 also exists. These are different database products with the same version number.

  2. Catalog differences: Apache Cloudberry and Cloudberry Database likely have different catalogs. By treating them as the same type (CBDB), how can we correctly handle their metadata differences when generating DDL statements?

Are you sure that Apache Cloudberry and Cloudberry Database have exactly the same catalog? If not, we need to identify the differences to ensure our metadata queries work correctly for both databases and can generate appropriate DDL statements for each.

We should identify them as different database types and handle version checks differently in all places where we query metadata and generate DDL statements.

dbversion.Type = CBDB
dbversion.SemVer = ver
} else if ver, ok := dbversion.extractVersion(gpdbPattern); ok {
dbversion.Type = GPDB
dbversion.SemVer = ver
Expand Down
4 changes: 2 additions & 2 deletions testutils/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ func GetServerVersion(host string, port int, user string) string {
/*
PostgreSQL 9.4.26 (Greenplum Database 6.20.0 build 9999) (HashData Warehouse 3.13.8 build 27594) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11), 64-bit compiled on Feb 10 2023 17:22:03

PostgreSQL 14.4 (Cloudberry Database 1.2.0 build commit:5b5ae3f8aa638786f01bbd08307b6474a1ba1997) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11), 64-bit compiled on Feb 16 2023 23:44:39
PostgreSQL 14.4 (Apache Cloudberry 1.2.0 build commit:5b5ae3f8aa638786f01bbd08307b6474a1ba1997) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11), 64-bit compiled on Feb 16 2023 23:44:39
*/

re := regexp.MustCompile(`\d+\.\d+(\.\d+)?`)
Expand All @@ -665,7 +665,7 @@ func GetPslVersion() string {
psqlVersion := strings.TrimSpace(string(out))

/*
psql (Cloudberry Database) 14.4
psql (Apache Cloudberry) 14.4

psql (PostgreSQL) 9.4.26
*/
Expand Down