From 61ee286f26d4e2a3d9f55dd0409ccc9fe1c8ce5b Mon Sep 17 00:00:00 2001 From: obdev Date: Tue, 20 Jul 2021 10:21:14 +0800 Subject: [PATCH] Fix FALLOC_FL_PUNCH_HOLE not defined when glibc version is low --- src/storage/blocksstable/ob_store_file.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/storage/blocksstable/ob_store_file.cpp b/src/storage/blocksstable/ob_store_file.cpp index 55340b0d1f..7ba909bde1 100644 --- a/src/storage/blocksstable/ob_store_file.cpp +++ b/src/storage/blocksstable/ob_store_file.cpp @@ -1036,7 +1036,9 @@ void ObStoreFile::free_block(const uint32_t block_idx, bool& is_freed) free_block_push_pos_ = (free_block_push_pos_ + 1) % store_file_system_->get_total_macro_block_count(); ++free_block_cnt_; - // punch hole + // FALLOC_FL_PUNCH_HOLE is only supported after glibc-2.17 + // https://bugzilla.redhat.com/show_bug.cgi?id=1476120 +# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17)) if (is_fs_support_punch_hole_ && GCONF._enable_block_file_punch_hole) { const int64_t len = store_file_system_->get_macro_block_size(); const int64_t offset = store_file_system_->get_macro_block_size() * block_idx; @@ -1056,6 +1058,7 @@ void ObStoreFile::free_block(const uint32_t block_idx, bool& is_freed) SHARE_LOG(INFO, "Punch hole success", K(block_idx), K(offset), K(len)); } } +#endif } } -- GitLab