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

laiyingchun pushed a commit to branch branch-1.17.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 3000f760212f82451a311a0cbcf4c90ffbd32b46
Author: xinghuayu007 <[email protected]>
AuthorDate: Tue Oct 24 11:52:38 2023 +0800

    Fix a unit test in aarch64 system
    
    The block size is not fixed in different architecture systems.
    For example, usually on x86 architecture it is 4k but on aarch64 some
    linux distribution (eg. 4.19.90-23.30.v2101.ky10.aarch6) can use a 64k
    block size kernel. Test EncryptionEnabled/LogBlockManagerTest.MetricsTest/1
    run fails in some aarch64 systems currently because of ignoring the
    block size of the architecture. Instead of setting a fixed
    value for FLAGS_log_container_max_size, it is better to use
    the variable block size to set it.
    
    Change-Id: Ide52a251b15b1af437d570c146beb0c30fed161b
    Reviewed-on: http://gerrit.cloudera.org:8080/20613
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
    (cherry picked from commit 976e9fc1105c2769d56a2ed32137d4969c8374bd)
    Reviewed-on: http://gerrit.cloudera.org:8080/20678
    Reviewed-by: Yingchun Lai <[email protected]>
    Reviewed-by: Wang Xixu <[email protected]>
---
 src/kudu/fs/log_block_manager-test.cc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/kudu/fs/log_block_manager-test.cc 
b/src/kudu/fs/log_block_manager-test.cc
index d3f5cbafc..dd3cc354e 100644
--- a/src/kudu/fs/log_block_manager-test.cc
+++ b/src/kudu/fs/log_block_manager-test.cc
@@ -354,11 +354,15 @@ TEST_P(LogBlockManagerTest, MetricsTest) {
 
   // Lower the max container size so that we can more easily test full
   // container metrics.
-  // TODO(abukor): If this is 1024, this becomes full when writing the first
-  // block because of alignments. If it is over 4k, it fails with encryption
-  // disabled due to having only 5 containers instead of 10. Investigate this.
-  FLAGS_log_container_max_size = GetParam() ? 8192 : 1024;
-
+  uint64_t fs_block_size;
+  ASSERT_OK(env_->GetBlockSize(test_dir_, &fs_block_size));
+  // The block size is not fixed in different file systems. some file systems
+  // are 4K, but the others are 64K. Hence, here use the block size to set
+  // FLAGS_log_container_max_size when encryption is enabled. Because the
+  // encryption header occuppies one block on disk, so set 
FLAGS_log_container_max_size
+  // (2 * fs_block_size) when the encryption is enabled and set it 
fs_block_size when
+  // the encryption is disabled.
+  FLAGS_log_container_max_size = GetParam() ? 2 * fs_block_size : 
fs_block_size;
   // One block --> one container.
   unique_ptr<WritableBlock> writer;
   ASSERT_OK(bm_->CreateBlock(test_block_opts_, &writer));

Reply via email to