This is an automated email from the ASF dual-hosted git repository.
gfphoenix78 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-go-libs.git
The following commit(s) were added to refs/heads/main by this push:
new bdf2613 Revert "Initial commit: add support for CloudberryDB" (#7)
bdf2613 is described below
commit bdf2613f194c12023a7556d9be25d82e411af4c2
Author: Hao Wu <[email protected]>
AuthorDate: Mon Jul 14 10:41:19 2025 +0800
Revert "Initial commit: add support for CloudberryDB" (#7)
This reverts commit 3c26b847cec572251a945dabe22f78bd551f5c94.
---
cluster/cluster.go | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/cluster/cluster.go b/cluster/cluster.go
index 06d643b..0fd9135 100644
--- a/cluster/cluster.go
+++ b/cluster/cluster.go
@@ -496,11 +496,30 @@ func (cluster *Cluster) GetDirsForHost(hostname string)
[]string {
func GetSegmentConfiguration(connection *dbconn.DBConn, getMirrors ...bool)
([]SegConfig, error) {
includeMirrors := len(getMirrors) == 1 && getMirrors[0]
query := ""
- whereClause := "WHERE role = 'p'"
- if includeMirrors {
- whereClause = ""
- }
- query = fmt.Sprintf(`
+ if connection.Version.Before("6") {
+ whereClause := "WHERE s.role = 'p' AND f.fsname = 'pg_system'"
+ if includeMirrors {
+ whereClause = "WHERE f.fsname = 'pg_system'"
+ }
+ query = fmt.Sprintf(`
+SELECT
+ s.dbid,
+ s.content as contentid,
+ s.role,
+ s.port,
+ s.hostname,
+ e.fselocation as datadir
+FROM gp_segment_configuration s
+JOIN pg_filespace_entry e ON s.dbid = e.fsedbid
+JOIN pg_filespace f ON e.fsefsoid = f.oid
+%s
+ORDER BY s.content, s.role DESC;`, whereClause)
+ } else {
+ whereClause := "WHERE role = 'p'"
+ if includeMirrors {
+ whereClause = ""
+ }
+ query = fmt.Sprintf(`
SELECT
dbid,
content as contentid,
@@ -511,6 +530,7 @@ SELECT
FROM gp_segment_configuration
%s
ORDER BY content, role DESC;`, whereClause)
+ }
results := make([]SegConfig, 0)
err := connection.Select(&results, query)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]