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 2017/07/12 04:20:06 UTC

[2/7] incubator-impala git commit: IMPALA-5031: Set DiskIoMgr::ScanRange::is_cancelled_ before read

IMPALA-5031: Set DiskIoMgr::ScanRange::is_cancelled_ before read

Reading a uninitialized memory as a boolean is undefined behavior when
it isn't the bit pattern for true or false. Clang's undefined behavior
sanitizer caught is_cancelled_ being used before being initialized;
this patch also initializes the other booleans in DiskIoMgr::ScanRange
to prevent similar undefined behavior.

Change-Id: I22898ec96ac44c4902f8072f27453cfc58358cae
Reviewed-on: http://gerrit.cloudera.org:8080/7294
Reviewed-by: Jim Apple <jb...@apache.org>
Tested-by: Impala Public 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/b329e620
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/b329e620
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/b329e620

Branch: refs/heads/master
Commit: b329e6208766e12233e8c782851b863b739d7bc1
Parents: 5b670f4
Author: Jim Apple <jb...@apache.org>
Authored: Sat Jun 24 17:40:15 2017 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Wed Jul 12 00:34:12 2017 +0000

----------------------------------------------------------------------
 be/src/runtime/disk-io-mgr-scan-range.cc |  2 --
 be/src/runtime/disk-io-mgr.h             | 12 ++++++------
 2 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/b329e620/be/src/runtime/disk-io-mgr-scan-range.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/disk-io-mgr-scan-range.cc b/be/src/runtime/disk-io-mgr-scan-range.cc
index 113f15b..f9f96d0 100644
--- a/be/src/runtime/disk-io-mgr-scan-range.cc
+++ b/be/src/runtime/disk-io-mgr-scan-range.cc
@@ -213,8 +213,6 @@ bool DiskIoMgr::ScanRange::Validate() {
 
 DiskIoMgr::ScanRange::ScanRange(int capacity)
   : RequestRange(RequestType::READ),
-    try_cache_(false),
-    expected_local_(false),
     num_remote_bytes_(0),
     external_buffer_tag_(ExternalBufferTag::NO_BUFFER),
     ready_buffers_capacity_(capacity),

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/b329e620/be/src/runtime/disk-io-mgr.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/disk-io-mgr.h b/be/src/runtime/disk-io-mgr.h
index a7fcbad..0212f8d 100644
--- a/be/src/runtime/disk-io-mgr.h
+++ b/be/src/runtime/disk-io-mgr.h
@@ -484,14 +484,14 @@ class DiskIoMgr : public CacheLineAligned {
     /// If true, this scan range is expected to be cached. Note that this might be wrong
     /// since the block could have been uncached. In that case, the cached path
     /// will fail and we'll just put the scan range on the normal read path.
-    bool try_cache_;
+    bool try_cache_ = false;
 
     /// If true, we expect this scan range to be a local read. Note that if this is false,
     /// it does not necessarily mean we expect the read to be remote, and that we never
     /// create scan ranges where some of the range is expected to be remote and some of it
     /// local.
     /// TODO: we can do more with this
-    bool expected_local_;
+    bool expected_local_ = false;
 
     /// Total number of bytes read remotely. This is necessary to maintain a count of
     /// the number of remote scan ranges. Since IO statistics can be collected multiple
@@ -552,14 +552,14 @@ class DiskIoMgr : public CacheLineAligned {
     Status status_;
 
     /// If true, the last buffer for this scan range has been queued.
-    bool eosr_queued_;
+    bool eosr_queued_ = false;
 
     /// If true, the last buffer for this scan range has been returned.
-    bool eosr_returned_;
+    bool eosr_returned_ = false;
 
     /// If true, this scan range has been removed from the reader's in_flight_ranges
     /// queue because the ready_buffers_ queue is full.
-    bool blocked_on_queue_;
+    bool blocked_on_queue_ = false;
 
     /// IO buffers that are queued for this scan range.
     /// Condition variable for GetNext
@@ -581,7 +581,7 @@ class DiskIoMgr : public CacheLineAligned {
     boost::mutex hdfs_lock_;
 
     /// If true, this scan range has been cancelled.
-    bool is_cancelled_;
+    bool is_cancelled_ = false;
 
     /// Last modified time of the file associated with the scan range
     int64_t mtime_;