This is an automated email from the ASF dual-hosted git repository. michaelsmith pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit bf67c1e22edf3e7d54d93a52aeacc2906e0e2d35 Author: Michael Smith <[email protected]> AuthorDate: Mon Jun 26 15:28:55 2023 -0700 IMPALA-12244: Fix uninitialized test variable Addendum to IMPALA-12217: fixes isV2 being uninitialized when an error value is returned. Clarifies the behavior of FindCGroupMounts. Change-Id: I7aa8f1d9db33ffe9b4c889fb739fb0ac64af803b Reviewed-on: http://gerrit.cloudera.org:8080/20122 Reviewed-by: Riza Suminto <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- be/src/util/cgroup-util.h | 6 +++--- be/src/util/proc-info-test.cc | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/be/src/util/cgroup-util.h b/be/src/util/cgroup-util.h index 4540dccca..fb4f3fdee 100644 --- a/be/src/util/cgroup-util.h +++ b/be/src/util/cgroup-util.h @@ -48,9 +48,9 @@ class CGroupUtil { /// the full path relative to the system-wide cgroups outside of the container. /// E.g. /sys/fs/cgroup/memory/kubepods/burstable/pod-<long unique id> may be mounted at /// /sys/fs/cgroup/memory inside the container. In that case this function would return - /// ("/sys/fs/cgroup/memory", "/kubepods/burstable/pod-<long unique id>"). - /// CGroup v2 uses a unified hierarchy, so the result will be the same for any - /// value of 'subsystem'. Returns whether the mount is for cgroup v1 or v2. + /// ("/sys/fs/cgroup/memory", "/kubepods/burstable/pod-<long unique id>"). CGroup v2 + /// uses a unified hierarchy, so the result will be the same for any value of + /// 'subsystem'. If Status is Ok, returns whether the mount is for cgroup v1 or v2. static Status FindCGroupMounts(const std::string& subsystem, std::string* mount_path, std::string* system_path, bool* is_v2); }; diff --git a/be/src/util/proc-info-test.cc b/be/src/util/proc-info-test.cc index 4d4983085..d1e5cf2c6 100644 --- a/be/src/util/proc-info-test.cc +++ b/be/src/util/proc-info-test.cc @@ -42,7 +42,8 @@ TEST(CGroupInfo, Basic) { // Test error handling when cgroup is not present. TEST(CGroupInfo, ErrorHandling) { string mp, sp; - bool isV2; + // Initialize isV2 so we choose the else branch if an error is returned. + bool isV2 = false; Status err = CGroupUtil::FindCGroupMounts("fake-cgroup", &mp, &sp, &isV2); if (isV2) { // Ignores subsystem, so should always succeed.
