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 <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
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 @@
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.