1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

chore(logging): move cgroup /cgroup version log from constructor to getTotalMemory to avoid duplicate log as constructor is called per query

This commit is contained in:
mariadb-AlexeyVorovich
2023-09-25 15:17:09 -04:00
committed by GitHub
parent 4bfce51628
commit fd94ab5042

View File

@@ -78,21 +78,12 @@ CGroupConfigurator::CGroupConfigurator()
cGroupDefined = false;
else
cGroupDefined = true;
cout << __func__ << " cGroupDefined (from getConfig)" << cGroupDefined << endl;
ifstream v2Check("/sys/fs/cgroup/cgroup.controllers");
cGroupVersion_ = (v2Check) ? v2 : v1;
string cGroupVersion_str="";
switch(cGroupVersion_){
case v1:
cGroupVersion_str="v1";
break;
case v2:
cGroupVersion_str="v2";
break;
}
cout << __func__<< " cGroupVersion_str " << cGroupVersion_str << endl;
}
CGroupConfigurator::~CGroupConfigurator()
@@ -200,17 +191,19 @@ uint64_t CGroupConfigurator::getTotalMemory()
if (totalMemory != 0)
return totalMemory;
cout << __func__ << " cGroupDefined (from getConfig) " << cGroupDefined << endl;
if (!cGroupDefined)
ret = getTotalMemoryFromProc();
else
{
cout << __func__ << " cGroupVersion " << ((cGroupVersion_ == v2) ? std::string("v2") : std::string("v1")) << endl;
ret = getTotalMemoryFromCGroup();
if (ret == 0 || ret == std::numeric_limits<uint64_t>::max())
ret = getTotalMemoryFromProc();
}
cout <<__func__ << " Total mem available (bytes) " << ret << " (GIB) " << ret/GIB << endl;
cout << __func__ << " Total mem available (bytes) " << ret << " (GIB) " << ret/GIB << endl;
totalMemory = ret;
return totalMemory;
}