IMPALA-4350: Crash with vlog level 2 in hash join node

Testing:
Reproduced by running test_mem_usage_scaling against an Impala with
-v=2. Confirmed the fix avoided the crash.

We don't have any routine testing of high log levels so there isn't
a clear way to get good coverage of all code paths where there might be
similar bugs.

Change-Id: Ieedd49d8a17709177a622ddc15b78a3f48e12d3f
Reviewed-on: http://gerrit.cloudera.org:8080/4830
Reviewed-by: Tim Armstrong <[email protected]>
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/838c1f54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/838c1f54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/838c1f54

Branch: refs/heads/master
Commit: 838c1f54428eec357bc21d27b302e25e125928c6
Parents: 01e7b11
Author: Tim Armstrong <[email protected]>
Authored: Mon Oct 24 11:13:02 2016 -0700
Committer: Internal Jenkins <[email protected]>
Committed: Tue Oct 25 23:03:42 2016 +0000

----------------------------------------------------------------------
 be/src/exec/partitioned-hash-join-node.cc | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/838c1f54/be/src/exec/partitioned-hash-join-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/partitioned-hash-join-node.cc 
b/be/src/exec/partitioned-hash-join-node.cc
index 024fdc3..b4f8b50 100644
--- a/be/src/exec/partitioned-hash-join-node.cc
+++ b/be/src/exec/partitioned-hash-join-node.cc
@@ -1048,18 +1048,25 @@ string PartitionedHashJoinNode::NodeDebugString() const 
{
   stringstream ss;
   ss << "PartitionedHashJoinNode (id=" << id() << " op=" << join_op_
      << " state=" << PrintState()
-     << " #hash_partitions=" << builder_->num_hash_partitions()
      << " #spilled_partitions=" << spilled_partitions_.size() << ")" << endl;
 
-  ss << "PhjBuilder: " << builder_->DebugString();
+  if (builder_ != NULL) {
+    ss << "PhjBuilder: " << builder_->DebugString();
+  }
 
   ss << "Probe hash partitions: " << probe_hash_partitions_.size() << ":" << 
endl;
   for (int i = 0; i < probe_hash_partitions_.size(); ++i) {
     ProbePartition* probe_partition = probe_hash_partitions_[i].get();
-    ss << "  Probe hash partition " << i << ": probe ptr=" << probe_partition
-       << "    Probe Rows: " << probe_partition->probe_rows()->num_rows()
-       << "    (Blocks pinned: " << 
probe_partition->probe_rows()->blocks_pinned() << ")"
-       << endl;
+    ss << "  Probe hash partition " << i << ": ";
+    if (probe_partition != NULL) {
+      ss << "probe ptr=" << probe_partition;
+      BufferedTupleStream* probe_rows = probe_partition->probe_rows();
+      if (probe_rows != NULL) {
+         ss << "    Probe Rows: " << probe_rows->num_rows()
+            << "    (Blocks pinned: " << probe_rows->blocks_pinned() << ")";
+      }
+    }
+    ss << endl;
   }
 
   if (!spilled_partitions_.empty()) {

Reply via email to