impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbap...@apache.org
Subject [3/4] incubator-impala git commit: IMPALA-4480: zero_length_region_ must be as aligned as max_align_t
Date Tue, 15 Nov 2016 02:00:28 GMT
IMPALA-4480: zero_length_region_ must be as aligned as max_align_t

MemPool::TryAllocateAligned returns memory that might be that aligned,
and it returns &MemPool::zero_length_region_ when called to allocate a
block of size 0.

While I'm here, do some things to make diagnosing test failures from
terminal output easier.

Change-Id: Ia31b27e38897f357478c4eedaab0c787e731b2d4
Reviewed-on: http://gerrit.cloudera.org:8080/5062
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/10a4c5a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/10a4c5a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/10a4c5a2

Branch: refs/heads/master
Commit: 10a4c5a2e47ec7bf1e563b6a75d1bf2afb47ebd8
Parents: 4258b9f
Author: Jim Apple <jbapple@cloudera.com>
Authored: Sun Nov 13 13:49:28 2016 -0800
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Mon Nov 14 21:25:42 2016 +0000

----------------------------------------------------------------------
 be/src/runtime/mem-pool-test.cc | 5 +++--
 be/src/runtime/mem-pool.h       | 7 ++++---
 bin/run-backend-tests.sh        | 1 +
 3 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/10a4c5a2/be/src/runtime/mem-pool-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/mem-pool-test.cc b/be/src/runtime/mem-pool-test.cc
index e6cb3b9..a39a120 100644
--- a/be/src/runtime/mem-pool-test.cc
+++ b/be/src/runtime/mem-pool-test.cc
@@ -504,8 +504,9 @@ TEST(MemPoolTest, TryAllocateAligned) {
 
   for (int i = 0; i < NUM_ALLOCATIONS; ++i) {
     uint8_t* ptr = pool.TryAllocateAligned(size, alignment);
-    ASSERT_TRUE(ptr != NULL);
-    ASSERT_EQ(0, reinterpret_cast<uintptr_t>(ptr) % alignment);
+    ASSERT_TRUE(ptr != NULL) << "size=" << size << " alignment=" <<
alignment;
+    ASSERT_EQ(0, reinterpret_cast<uintptr_t>(ptr) % alignment)
+        << "size=" << size << " alignment=" << alignment;
     alignment = alignment == alignof(std::max_align_t) ? 1 : alignment * 2;
     size = (size + 1) % MAX_ALLOCATION_SIZE;
   }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/10a4c5a2/be/src/runtime/mem-pool.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/mem-pool.h b/be/src/runtime/mem-pool.h
index b0fa694..234fc41 100644
--- a/be/src/runtime/mem-pool.h
+++ b/be/src/runtime/mem-pool.h
@@ -187,9 +187,10 @@ class MemPool {
         allocated_bytes(0) {}
   };
 
-  /// A static field used as non-NULL pointer for zero length allocations.
-  /// NULL is reserved for allocation failures.
-  static uint32_t zero_length_region_;
+  /// A static field used as non-NULL pointer for zero length allocations. NULL is
+  /// reserved for allocation failures. It must be as aligned as max_align_t for
+  /// TryAllocateAligned().
+  static uint32_t zero_length_region_ alignas(std::max_align_t);
 
   /// chunk from which we served the last Allocate() call;
   /// always points to the last chunk that contains allocated data;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/10a4c5a2/bin/run-backend-tests.sh
----------------------------------------------------------------------
diff --git a/bin/run-backend-tests.sh b/bin/run-backend-tests.sh
index d12950b..758c1bc 100755
--- a/bin/run-backend-tests.sh
+++ b/bin/run-backend-tests.sh
@@ -35,4 +35,5 @@ fi
 cd ${IMPALA_BE_DIR}
 . ${IMPALA_HOME}/bin/set-classpath.sh
 
+export CTEST_OUTPUT_ON_FAILURE=1
 make test ARGS="${BE_TEST_ARGS}"


Mime
View raw message