You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2021/02/26 13:10:11 UTC

[impala] 03/03: IMPALA-10531: Fix TmpFileMgrTest.TestCompressBufferManagementEncryptedRemoteUpload failed in exhaustive release build

This is an automated email from the ASF dual-hosted git repository.

stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 9f1b5272a1ed0f1970ace7ba820d1c0dba590f46
Author: Yida Wu <wy...@gmail.com>
AuthorDate: Sun Feb 21 07:59:54 2021 -0800

    IMPALA-10531: Fix TmpFileMgrTest.TestCompressBufferManagementEncryptedRemoteUpload failed in exhaustive release build
    
    Fixed TmpFileMgrTest testcases failed in exhaustive release build.
    The cause is that in TmpFileGroup::AllocateRemoteSpace(), it uses
    DCHECK to check the return of TmpFileRemote::AllocateSpace(), because
    it always returns true, in the release build, the logic is optimized,
    so TmpFileRemote::AllocateSpace() isn't called in the release build.
    The solution is to use if instead of DCHECK.
    
    Tests:
    Reran TmpFileMgrTest/DiskIoMgrTest/BufferPoolTest in the release build.
    
    Change-Id: I7320ae41957c44151b7ec17886c383e72c2546e4
    Reviewed-on: http://gerrit.cloudera.org:8080/17101
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/runtime/tmp-file-mgr.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/be/src/runtime/tmp-file-mgr.cc b/be/src/runtime/tmp-file-mgr.cc
index cd00f42..738cc72 100644
--- a/be/src/runtime/tmp-file-mgr.cc
+++ b/be/src/runtime/tmp-file-mgr.cc
@@ -1051,17 +1051,17 @@ Status TmpFileGroup::AllocateRemoteSpace(int64_t num_bytes, TmpFile** tmp_file,
         tmp_dir_remote->bytes_limit, tmp_dir_remote->path));
   }
   UpdateScratchSpaceMetrics(file_size, true);
-
-  // It should be a successful return to allocate the first range from the new file.
-  DCHECK(tmp_file_remote->AllocateSpace(num_bytes, file_offset));
-
-  tmp_files_remote_.emplace_back(std::move(tmp_file_remote));
+  tmp_files_remote_.emplace_back(move(tmp_file_remote));
   *tmp_file = tmp_files_remote_.back().get();
+  // It should be a successful return to allocate the first range from the new file.
+  if (!(*tmp_file)->AllocateSpace(num_bytes, file_offset)) {
+    DCHECK(false) << "Should be a successful allocation for the first write range.";
+  }
+  DCHECK_EQ(*file_offset, 0);
   {
     lock_guard<SpinLock> lock(tmp_files_remote_ptrs_lock_);
     tmp_files_remote_ptrs_.emplace(*tmp_file, tmp_files_remote_.back());
   }
-  *file_offset = 0;
 
   // Try to reserve the space for local buffer with a quick return to avoid
   // a long wait, if failed, caller should do the reservation for the buffer.