You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/04/22 15:28:09 UTC
[impala] 02/02: IMPALA-8414: Skip header when parsing /proc/net/dev
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 67f77d41d40523074385b8dbccfa6ef6ef81dd57
Author: Lars Volker <lv...@cloudera.com>
AuthorDate: Sun Apr 14 18:23:50 2019 -0700
IMPALA-8414: Skip header when parsing /proc/net/dev
The fix for IMPALA-8395 does not skip the first to header lines of
/proc/net/dev. This change skips the header to prevent unnecessary
warnings.
Testing: Manually checked that impalad.WARNING did not contain any
warnings about failure to parse /proc/net/dev.
Change-Id: I7ff931671050d44926d0baa77ec374afed1f8225
Reviewed-on: http://gerrit.cloudera.org:8080/13016
Reviewed-by: Lars Volker <lv...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
be/src/util/system-state-info.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/be/src/util/system-state-info.cc b/be/src/util/system-state-info.cc
index e808724..b5495c5 100644
--- a/be/src/util/system-state-info.cc
+++ b/be/src/util/system-state-info.cc
@@ -167,8 +167,11 @@ void SystemStateInfo::ReadProcNetDevString(const string& dev_string) {
memset(&sum_values, 0, sizeof(sum_values));
StringPiece sp(dev_string);
- vector<StringPiece> lines = Split(sp, "\n");
- for (const StringPiece& line : lines) {
+ vector<StringPiece> lines = Split(sp, "\n", SkipWhitespace());
+ // The first two lines contain the header, skip them.
+ DCHECK_GT(lines.size(), 2);
+ for (int i = 2; i < lines.size(); ++i) {
+ const StringPiece& line = lines[i];
NetworkValues line_values;
ReadProcNetDevLine(line, &line_values);
AddNetworkValues(line_values, &sum_values);