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

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


The following commit(s) were added to refs/heads/branch-1.17.x by this push:
     new 6bc692f99 Fix CheckHolePunch for bigger than 4k blocks.
6bc692f99 is described below

commit 6bc692f9970d6310bf5255f58d9147e82484a456
Author: Zoltan Martonka <zmarto...@gmail.com>
AuthorDate: Mon Jan 15 13:53:03 2024 +0000

    Fix CheckHolePunch for bigger than 4k blocks.
    
    With the new 64k ARM core, you can use filesystems with up to 64k block
    size.
    Currently Kudu does not start if the data is on a filesystem with larger
    than 4k blocks.
    Problem: CheckHolePunch has hard-coded 4k block size instead of using the
    get env->GetBlockSize.
    Kudu seems to be running fine on a 64k fs after this fix.
    
    More info:
    https://kudu.apache.org/docs/troubleshooting.html#req_hole_punching
    
    Change-Id: Ib4af73f0aa25db674fe0a34355cecd27a0c68417
    Reviewed-on: http://gerrit.cloudera.org:8080/20894
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <ale...@apache.org>
    (cherry picked from commit de87aca3dd29177658790cffeb7a1de0c8d69231)
    Reviewed-on: http://gerrit.cloudera.org:8080/20930
    Tested-by: Alexey Serbin <ale...@apache.org>
    Reviewed-by: Wang Xixu <1450306...@qq.com>
    Reviewed-by: Yingchun Lai <laiyingc...@apache.org>
---
 src/kudu/fs/dir_util.cc | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/kudu/fs/dir_util.cc b/src/kudu/fs/dir_util.cc
index fabcf80a8..a65a79bb0 100644
--- a/src/kudu/fs/dir_util.cc
+++ b/src/kudu/fs/dir_util.cc
@@ -63,12 +63,6 @@ const char kHolePunchErrorMsg[] =
     "server. Raw error message follows";
 
 Status CheckHolePunch(Env* env, const string& path) {
-  // Arbitrary constants.
-  static uint64_t kFileSize = 4096 * 4;
-  static uint64_t kHoleOffset = 4096;
-  static uint64_t kHoleSize = 8192;
-  static uint64_t kPunchedFileSize = kFileSize - kHoleSize;
-
   // Open the test file.
   string filename = JoinPathSegments(path, "hole_punch_test_file");
   unique_ptr<RWFile> file;
@@ -79,6 +73,14 @@ Status CheckHolePunch(Env* env, const string& path) {
   opts.is_sensitive = false;
   RETURN_NOT_OK(env->NewRWFile(opts, filename, &file));
 
+  // Arbitrary constants.
+  uint64_t kBlockSize = 0;
+  RETURN_NOT_OK(env->GetBlockSize(filename, &kBlockSize));
+  const uint64_t kFileSize = kBlockSize * 4;
+  const uint64_t kHoleOffset = kBlockSize;
+  const uint64_t kHoleSize = kBlockSize * 2;
+  const uint64_t kPunchedFileSize = kFileSize - kHoleSize;
+
   // The file has been created; delete it on exit no matter what happens.
   auto file_deleter = MakeScopedCleanup([&]() {
     WARN_NOT_OK(env->DeleteFile(filename),

Reply via email to