From c8bf4203dccd90b9f48e7cdc281848e079bb7989 Mon Sep 17 00:00:00 2001 From: nroskill Date: Fri, 18 Nov 2022 03:40:42 +0000 Subject: [PATCH] fix coredump in ObMicroBlockDecoder::release --- src/storage/blocksstable/ob_micro_block_cache.cpp | 10 +++++++++- src/storage/blocksstable/ob_sstable_meta_info.cpp | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/storage/blocksstable/ob_micro_block_cache.cpp b/src/storage/blocksstable/ob_micro_block_cache.cpp index fe0391d8ce..c4f1e83f64 100644 --- a/src/storage/blocksstable/ob_micro_block_cache.cpp +++ b/src/storage/blocksstable/ob_micro_block_cache.cpp @@ -167,7 +167,11 @@ int ObMicroBlockCacheValue::deep_copy(char *buf, const int64_t buf_len, ObIKVCac const ObIndexBlockDataHeader *src_idx_header = reinterpret_cast(block_data_.get_extra_buf()); ObIndexBlockDataTransformer *transformer = nullptr; - if (OB_ISNULL(transformer = GET_TSI_MULT(ObIndexBlockDataTransformer, 1))) { + ObDecoderAllocator *allocator = nullptr; + if (OB_ISNULL(allocator = get_decoder_allocator())) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to allocate decoder allocator", K(ret)); + } else if (OB_ISNULL(transformer = GET_TSI_MULT(ObIndexBlockDataTransformer, 1))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("Fail to get thread local index block data transformer", K(ret)); } else if (OB_FAIL(transformer->update_index_block( @@ -1423,10 +1427,14 @@ int ObIndexMicroBlockCache::ObIndexMicroBlockIOCallback::write_extra_buf_on_dema { int ret = OB_SUCCESS; ObIndexBlockDataTransformer *transformer = nullptr; + ObDecoderAllocator *allocator = nullptr; if (OB_ISNULL(index_read_info_) || OB_UNLIKELY(!index_read_info_->is_valid() || !micro_data.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("Invalid argument", K(ret), KPC(index_read_info_), K(micro_data)); + } else if (OB_ISNULL(allocator = get_decoder_allocator())) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to allocate decoder allocator", K(ret)); } else if (OB_ISNULL(transformer = GET_TSI_MULT(ObIndexBlockDataTransformer, 1))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("Fail to allocate ObIndexBlockDataTransformer", K(ret)); diff --git a/src/storage/blocksstable/ob_sstable_meta_info.cpp b/src/storage/blocksstable/ob_sstable_meta_info.cpp index 8d8b14bd82..1d05da7e3e 100644 --- a/src/storage/blocksstable/ob_sstable_meta_info.cpp +++ b/src/storage/blocksstable/ob_sstable_meta_info.cpp @@ -212,9 +212,13 @@ int ObRootBlockInfo::transform_root_block_data(const ObTableReadInfo &read_info) int ret = OB_SUCCESS; if (OB_ISNULL(block_data_.get_extra_buf()) && OB_NOT_NULL(block_data_.get_buf())) { ObIndexBlockDataTransformer *transformer = nullptr; + ObDecoderAllocator *allocator = nullptr; if (OB_UNLIKELY(!read_info.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid read_info", K(ret)); + } else if (OB_ISNULL(allocator = get_decoder_allocator())) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to allocate decoder allocator", K(ret)); } else if (OB_ISNULL(transformer = GET_TSI_MULT(ObIndexBlockDataTransformer, 1))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate transformer", K(ret));