This is an automated email from the ASF dual-hosted git repository.

avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new 38cd645bd4f Fix Oid display errors in the log or message
38cd645bd4f is described below

commit 38cd645bd4f54019eed4305439a9fe61abce0257
Author: fairyfar <[email protected]>
AuthorDate: Sat Feb 28 09:50:29 2026 +0800

    Fix Oid display errors in the log or message
    
    Oid is unsigned int. Therefore, when the Oid reaches 2^31, printing it with 
%d will display a negative value.
    This is a defect of the original GPDB. GPDB has fixed similar defects on 
commit 7279a1e6('Fix getResUsage integer overflow'), but there are still 
omissions.
---
 src/backend/commands/resgroupcmds.c              | 4 ++--
 src/backend/commands/user.c                      | 2 +-
 src/backend/utils/resgroup/cgroup-ops-linux-v1.c | 6 +++---
 src/backend/utils/resgroup/cgroup-ops-linux-v2.c | 6 +++---
 src/backend/utils/resgroup/resgroup.c            | 8 ++++----
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/backend/commands/resgroupcmds.c 
b/src/backend/commands/resgroupcmds.c
index 9be40eba69f..384675edb7f 100644
--- a/src/backend/commands/resgroupcmds.c
+++ b/src/backend/commands/resgroupcmds.c
@@ -697,7 +697,7 @@ GetResGroupCapabilities(Relation rel, Oid groupId, 
ResGroupCaps *resgroupCaps)
        {
                ereport(ERROR,
                                (errcode(ERRCODE_UNDEFINED_OBJECT),
-                                errmsg("cannot find limit capabilities for 
resource group: %d",
+                                errmsg("cannot find limit capabilities for 
resource group: %u",
                                                groupId)));
        }
 }
@@ -1370,7 +1370,7 @@ validateCapabilities(Relation rel,
 
                        ereport(ERROR,
                                        (errcode(ERRCODE_DUPLICATE_OBJECT),
-                                        errmsg("found duplicate resource group 
id: %d",
+                                        errmsg("found duplicate resource group 
id: %u",
                                                        groupid)));
                }
 
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 39f23c2b849..54f4df765ec 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -1521,7 +1521,7 @@ AlterRole(AlterRoleStmt *stmt)
                if (!HeapTupleIsValid(profiletuple))
                        ereport(ERROR,
                                                
(errcode(ERRCODE_UNDEFINED_OBJECT),
-                                                errmsg("profile \"%d\" does 
not exist", profileid)));
+                                                errmsg("profile \"%u\" does 
not exist", profileid)));
 
                /* Get PASSWORD_REUSE_MAX from profile tuple and transform it 
to normal value */
                profileform = (Form_pg_profile) GETSTRUCT(profiletuple);
diff --git a/src/backend/utils/resgroup/cgroup-ops-linux-v1.c 
b/src/backend/utils/resgroup/cgroup-ops-linux-v1.c
index 0ad53ee35ab..c5d0dee0c76 100644
--- a/src/backend/utils/resgroup/cgroup-ops-linux-v1.c
+++ b/src/backend/utils/resgroup/cgroup-ops-linux-v1.c
@@ -658,7 +658,7 @@ createcgroup_v1(Oid group)
                (gp_resource_group_enable_cgroup_cpuset &&
                 !createDir(group, CGROUP_COMPONENT_CPUSET, "")))
        {
-               CGROUP_ERROR("can't create cgroup for resource group '%d': %m", 
group);
+               CGROUP_ERROR("can't create cgroup for resource group '%u': %m", 
group);
        }
 
        /*
@@ -707,7 +707,7 @@ create_default_cpuset_group_v1(void)
 
        if (!createDir(DEFAULT_CPUSET_GROUP_ID, component, ""))
        {
-               CGROUP_ERROR("can't create cpuset cgroup for resgroup '%d': %m",
+               CGROUP_ERROR("can't create cpuset cgroup for resgroup '%u': %m",
                                         DEFAULT_CPUSET_GROUP_ID);
        }
 
@@ -926,7 +926,7 @@ destroycgroup_v1(Oid group, bool migrate)
                (gp_resource_group_enable_cgroup_cpuset &&
                 !deleteDir(group, CGROUP_COMPONENT_CPUSET, NULL, migrate, 
detachcgroup_v1)))
        {
-               CGROUP_ERROR("can't remove cgroup for resource group '%d': %m", 
group);
+               CGROUP_ERROR("can't remove cgroup for resource group '%u': %m", 
group);
        }
 }
 
diff --git a/src/backend/utils/resgroup/cgroup-ops-linux-v2.c 
b/src/backend/utils/resgroup/cgroup-ops-linux-v2.c
index 6b5f667fe7f..ab773c8d0cb 100644
--- a/src/backend/utils/resgroup/cgroup-ops-linux-v2.c
+++ b/src/backend/utils/resgroup/cgroup-ops-linux-v2.c
@@ -389,7 +389,7 @@ createcgroup_v2(Oid group)
        if (!createDir(group, CGROUP_COMPONENT_PLAIN, "") ||
                !createDir(group, CGROUP_COMPONENT_PLAIN, 
CGROUPV2_LEAF_INDENTIFIER))
        {
-               CGROUP_ERROR("can't create cgroup for resource group '%d': %m", 
group);
+               CGROUP_ERROR("can't create cgroup for resource group '%u': %m", 
group);
        }
 
        /*
@@ -421,7 +421,7 @@ create_default_cpuset_group_v2(void)
 
        if (!createDir(DEFAULT_CPUSET_GROUP_ID, component, ""))
        {
-               CGROUP_ERROR("can't create cpuset cgroup for resgroup '%d': %m",
+               CGROUP_ERROR("can't create cpuset cgroup for resgroup '%u': %m",
                                         DEFAULT_CPUSET_GROUP_ID);
        }
 
@@ -626,7 +626,7 @@ destroycgroup_v2(Oid group, bool migrate)
 {
        if (!deleteDir(group, CGROUP_COMPONENT_PLAIN, NULL, migrate, 
detachcgroup_v2))
        {
-               CGROUP_ERROR("can't remove cgroup for resource group '%d': %m", 
group);
+               CGROUP_ERROR("can't remove cgroup for resource group '%u': %m", 
group);
        }
 }
 
diff --git a/src/backend/utils/resgroup/resgroup.c 
b/src/backend/utils/resgroup/resgroup.c
index 72f1ac75d41..e474e106490 100644
--- a/src/backend/utils/resgroup/resgroup.c
+++ b/src/backend/utils/resgroup/resgroup.c
@@ -1936,7 +1936,7 @@ groupHashFind(Oid groupId, bool raise)
        {
                ereport(raise ? ERROR : LOG,
                                (errcode(ERRCODE_DATA_CORRUPTED),
-                                errmsg("cannot find resource group with Oid %d 
in shared memory",
+                                errmsg("cannot find resource group with Oid %u 
in shared memory",
                                                groupId)));
                return NULL;
        }
@@ -1971,7 +1971,7 @@ groupHashRemove(Oid groupId)
        if (!found)
                ereport(ERROR,
                                (errcode(ERRCODE_DATA_CORRUPTED),
-                                errmsg("cannot find resource group with Oid %d 
in shared memory to remove",
+                                errmsg("cannot find resource group with Oid %u 
in shared memory to remove",
                                                groupId)));
 
        group = &pResGroupControl->groups[entry->index];
@@ -3537,7 +3537,7 @@ ResGroupMoveQuery(int sessionId, Oid groupId, const char 
*groupName)
        {
                ereport(ERROR,
                                (errcode(ERRCODE_UNDEFINED_OBJECT),
-                                (errmsg("invalid resource group id: %d", 
groupId))));
+                                (errmsg("invalid resource group id: %u", 
groupId))));
        }
 
        groupInfo.group = group;
@@ -3546,7 +3546,7 @@ ResGroupMoveQuery(int sessionId, Oid groupId, const char 
*groupName)
        if (slot == NULL)
                ereport(ERROR,
                                (errcode(ERRCODE_INSUFFICIENT_RESOURCES),
-                                (errmsg("cannot get slot in resource group 
%d", groupId))));
+                                (errmsg("cannot get slot in resource group 
%u", groupId))));
 
        PG_TRY();
        {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to