impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject [10/50] incubator-impala git commit: IMPALA-3243: Delete unneeded code that doesn't work on RHEL 5
Date Tue, 12 Apr 2016 21:18:44 GMT
IMPALA-3243: Delete unneeded code that doesn't work on RHEL 5

The MaxCPUIndex() interface was added by Kudu, but the code that
initializes it doesn't work on RHEL 5. Impala doesn't depend on
MaxCpuIndex() at all, but the value is calculated and cached at startup
time so it still executes.  So, let's just delete this effectively
dead code that doesn't work on RHEL 5.

Change-Id: I82b71de60e5bf8abec18f981d13528991265908f
Reviewed-on: http://gerrit.cloudera.org:8080/2626
Reviewed-by: Dan Hecht <dhecht@cloudera.com>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/5e51f1cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/5e51f1cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/5e51f1cd

Branch: refs/heads/master
Commit: 5e51f1cd0366bfd590ade2a9c54f0bab942c79ac
Parents: 7e76e92
Author: Dan Hecht <dhecht@cloudera.com>
Authored: Thu Mar 24 20:35:48 2016 -0700
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Mon Mar 28 20:19:41 2016 +0000

----------------------------------------------------------------------
 be/src/gutil/sysinfo.cc | 33 ---------------------------------
 be/src/gutil/sysinfo.h  |  4 ----
 2 files changed, 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5e51f1cd/be/src/gutil/sysinfo.cc
----------------------------------------------------------------------
diff --git a/be/src/gutil/sysinfo.cc b/be/src/gutil/sysinfo.cc
index 60c461b..f9232d1 100644
--- a/be/src/gutil/sysinfo.cc
+++ b/be/src/gutil/sysinfo.cc
@@ -74,7 +74,6 @@ namespace base {
 
 static double cpuinfo_cycles_per_second = 1.0;  // 0.0 might be dangerous
 static int cpuinfo_num_cpus = 1;  // Conservative guess
-static int cpuinfo_max_cpu_index = -1;
 
 void SleepForNanoseconds(int64_t nanoseconds) {
   // Sleep for nanosecond duration
@@ -145,25 +144,6 @@ static bool ReadIntFromFile(const char *file, int *value) {
   return false;
 }
 
-static int ReadMaxCPUIndex() {
-  char buf[1024];
-  CHECK(SlurpSmallTextFile("/sys/devices/system/cpu/present", buf, arraysize(buf)));
-
-  // On a single-core machine, 'buf' will contain the string '0' with a newline.
-  if (strcmp(buf, "0\n") == 0) {
-    return 0;
-  }
-
-  // On multi-core, it will have a CPU range like '0-7'.
-  CHECK_EQ(0, memcmp(buf, "0-", 2)) << "bad list of possible CPUs: " << buf;
-
-  char* max_cpu_str = &buf[2];
-  char* err;
-  int val = strtol(max_cpu_str, &err, 10);
-  CHECK(*err == '\n' || *err == '\0') << "unable to parse max CPU index from: " <<
buf;
-  return val;
-}
-
 #endif
 
 // WARNING: logging calls back to InitializeSystemInfo() so it must
@@ -306,7 +286,6 @@ static void InitializeSystemInfo() {
   if (num_cpus > 0) {
     cpuinfo_num_cpus = num_cpus;
   }
-  cpuinfo_max_cpu_index = ReadMaxCPUIndex();
 
 #elif defined __FreeBSD__
   // For this sysctl to work, the machine must be configured without
@@ -385,13 +364,6 @@ static void InitializeSystemInfo() {
   // Generic cycles per second counter
   cpuinfo_cycles_per_second = EstimateCyclesPerSecond(1000);
 #endif
-
-  // On platforms where we can't determine the max CPU index, just use the
-  // number of CPUs. This might break if CPUs are taken offline, but
-  // better than a wild guess.
-  if (cpuinfo_max_cpu_index < 0) {
-    cpuinfo_max_cpu_index = cpuinfo_num_cpus - 1;
-  }
 }
 
 double CyclesPerSecond(void) {
@@ -404,9 +376,4 @@ int NumCPUs(void) {
   return cpuinfo_num_cpus;
 }
 
-int MaxCPUIndex(void) {
-  InitializeSystemInfo();
-  return cpuinfo_max_cpu_index;
-}
-
 } // namespace base

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5e51f1cd/be/src/gutil/sysinfo.h
----------------------------------------------------------------------
diff --git a/be/src/gutil/sysinfo.h b/be/src/gutil/sysinfo.h
index ec3abe7..1ce95d0 100644
--- a/be/src/gutil/sysinfo.h
+++ b/be/src/gutil/sysinfo.h
@@ -41,10 +41,6 @@ namespace base {
 // value of sched_getcpu().
 extern int NumCPUs();
 
-// Return the maximum CPU index that may be returned by sched_getcpu(). For example, on
-// an 8-core machine, this will return '7' even if some of the CPUs have been disabled.
-extern int MaxCPUIndex();
-
 void SleepForNanoseconds(int64_t nanoseconds);
 void SleepForMilliseconds(int64_t milliseconds);
 


Mime
View raw message