Skip to content

Commit

Permalink
fix poor performance due to aux tablet info cache miss
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenbomb authored and ob-robot committed Nov 9, 2023
1 parent d9052a6 commit ac0d44e
Show file tree
Hide file tree
Showing 127 changed files with 366 additions and 207 deletions.
Empty file modified src/share/backup/ob_backup_data_table_operator.cpp
100755 → 100644
Empty file.
Empty file modified src/share/backup/ob_backup_data_table_operator.h
100755 → 100644
Empty file.
Empty file modified src/share/backup/ob_backup_path.cpp
100755 → 100644
Empty file.
Empty file modified src/share/backup/ob_backup_path.h
100755 → 100644
Empty file.
Empty file modified src/share/backup/ob_backup_struct.cpp
100755 → 100644
Empty file.
Empty file modified src/share/backup/ob_backup_struct.h
100755 → 100644
Empty file.
Empty file modified src/share/ls/ob_ls_creator.cpp
100755 → 100644
Empty file.
Empty file modified src/share/ls/ob_ls_creator.h
100755 → 100644
Empty file.
Empty file modified src/share/ls/ob_ls_operator.cpp
100755 → 100644
Empty file.
Empty file modified src/share/ls/ob_ls_operator.h
100755 → 100644
Empty file.
Empty file modified src/share/ls/ob_ls_status_operator.cpp
100755 → 100644
Empty file.
Empty file modified src/share/ls/ob_ls_status_operator.h
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/share/ob_tablet_autoincrement_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class ObTabletAutoincSeq : public memtable::ObIMultiSourceDataUnit, public stora
virtual int deep_copy(
char *dst_buf,
const int64_t buf_size,
storage::ObIStorageMetaObj *&value) const;
virtual int64_t get_deep_copy_size() const { return sizeof(ObTabletAutoincSeq) + sizeof(ObTabletAutoincInterval) * intervals_count_; }
storage::ObIStorageMetaObj *&value) const override;
virtual int64_t get_deep_copy_size() const override { return sizeof(ObTabletAutoincSeq) + sizeof(ObTabletAutoincInterval) * intervals_count_; }
virtual void reset() override;
virtual bool is_valid() const override;
virtual inline int64_t get_data_size() const override { return get_deep_copy_size(); }
Expand Down
Empty file modified src/share/scheduler/ob_dag_scheduler.cpp
100755 → 100644
Empty file.
Empty file modified src/share/scheduler/ob_dag_scheduler_config.h
100755 → 100644
Empty file.
Empty file modified src/share/scheduler/ob_dag_warning_history_mgr.h
100755 → 100644
Empty file.
Empty file modified src/share/scheduler/ob_diagnose_config.h
100755 → 100644
Empty file.
Empty file modified src/storage/CMakeLists.txt
100755 → 100644
Empty file.
Empty file modified src/storage/access/ob_dml_param.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/access/ob_dml_param.h
100755 → 100644
Empty file.
Empty file modified src/storage/access/ob_index_tree_prefetcher.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/access/ob_table_scan_iterator.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_ctx.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_data_store.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_data_store.h
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_data_struct.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_data_struct.h
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_operator.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_task.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_utils.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/backup/ob_backup_utils.h
100755 → 100644
Empty file.
Empty file modified src/storage/blocksstable/ob_index_block_tree_cursor.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/blocksstable/ob_micro_block_cache.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/blocksstable/ob_micro_block_row_lock_checker.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/blocksstable/ob_micro_block_writer.h
100755 → 100644
Empty file.
Empty file modified src/storage/blocksstable/ob_shared_macro_block_manager.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_compaction_diagnose.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_compaction_diagnose.h
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_medium_compaction_func.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_medium_compaction_func.h
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_medium_compaction_info.h
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_partition_merge_policy.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_partition_merge_progress.h
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_sstable_merge_info_mgr.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tablet_merge_ctx.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tablet_merge_ctx.h
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tablet_merge_task.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tenant_tablet_scheduler.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tenant_tablet_scheduler.h
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tx_table_merge_task.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/compaction/ob_tx_table_merge_task.h
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_complement_data_task.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_ddl_merge_task.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_ddl_merge_task.h
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_ddl_redo_log_replayer.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_ddl_redo_log_writer.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_ddl_replay_executor.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_direct_insert_sstable_ctx.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ddl/ob_tablet_ddl_kv.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/direct_load/ob_direct_load_origin_table.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/direct_load/ob_direct_load_origin_table.h
100755 → 100644
Empty file.
Empty file modified src/storage/high_availability/ob_ls_migration_handler.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/high_availability/ob_ls_prepare_migration.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/high_availability/ob_storage_ha_dag.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/high_availability/ob_storage_ha_src_provider.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/high_availability/ob_storage_ha_tablet_builder.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ls/ob_ls.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ls/ob_ls.h
100755 → 100644
Empty file.
Empty file modified src/storage/ls/ob_ls_get_mod.h
100755 → 100644
Empty file.
Empty file modified src/storage/ls/ob_ls_tablet_service.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ls/ob_ls_tablet_service.h
100755 → 100644
Empty file.
Empty file modified src/storage/memtable/mvcc/ob_mvcc_acc_ctx.h
100755 → 100644
Empty file.
Empty file modified src/storage/memtable/mvcc/ob_mvcc_iterator.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/memtable/ob_memtable.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/memtable/ob_memtable_iterator.cpp
100755 → 100644
Empty file.
116 changes: 112 additions & 4 deletions src/storage/meta_mem/ob_storage_meta_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
#include "lib/stat/ob_diagnose_info.h"
#include "lib/statistic_event/ob_stat_event.h"
#include "share/io/ob_io_struct.h"
#include "share/ob_tablet_autoincrement_param.h"
#include "storage/blocksstable/ob_sstable.h"
#include "storage/blocksstable/ob_storage_cache_suite.h"
#include "storage/slog_ckpt/ob_tenant_checkpoint_slog_handler.h"
#include "storage/tablet/ob_tablet_table_store.h"
#include "storage/tablet/ob_tablet.h"
#include "share/ob_tablet_autoincrement_param.h"
#include "storage/tablet/ob_tablet.h"
#include "storage/blocksstable/ob_storage_cache_suite.h"
#include "storage/meta_mem/ob_tenant_meta_mem_mgr.h"

Expand Down Expand Up @@ -113,12 +112,14 @@ ObStorageMetaValue::StorageMetaProcessor ObStorageMetaValue::processor[ObStorage
= { ObStorageMetaValue::process_sstable,
ObStorageMetaValue::process_table_store,
ObStorageMetaValue::process_autoinc_seq,
ObStorageMetaValue::process_aux_tablet_info
};

ObStorageMetaValue::StorageMetaBypassProcessor ObStorageMetaValue::bypass_processor[MetaType::MAX]
= { ObStorageMetaValue::bypass_process_storage_meta<blocksstable::ObSSTable>,
nullptr, // not support bypass process table store.
ObStorageMetaValue::bypass_process_storage_meta<share::ObTabletAutoincSeq>,
ObStorageMetaValue::bypass_process_storage_meta_for_aux_tablet_info
};


Expand Down Expand Up @@ -244,6 +245,21 @@ int ObStorageMetaValue::get_autoinc_seq(const share::ObTabletAutoincSeq *&seq) c
return ret;
}

int ObStorageMetaValue::get_aux_tablet_info(const ObTabletBindingMdsUserData *&aux_tablet_info) const
{
int ret = OB_SUCCESS;
if (OB_ISNULL(obj_)) {
ret = OB_NOT_INIT;
LOG_WARN("not inited", K(ret));
} else if (OB_UNLIKELY(MetaType::AUX_TABLET_INFO != type_)) {
ret = OB_STATE_NOT_MATCH;
LOG_WARN("not aux tablet info", K(ret), K(type_));
} else {
aux_tablet_info = static_cast<ObTabletBindingMdsUserData *>(obj_);
}
return ret;
}

int ObStorageMetaValue::process_sstable(
ObStorageMetaValueHandle &handle,
const ObStorageMetaKey &key,
Expand Down Expand Up @@ -356,6 +372,98 @@ int ObStorageMetaValue::process_autoinc_seq(
return ret;
}

int ObStorageMetaValue::process_aux_tablet_info(
ObStorageMetaValueHandle &handle,
const ObStorageMetaKey &key,
const char *buf,
const int64_t size,
const ObTablet *tablet)
{
UNUSED(tablet);
int ret = OB_SUCCESS;
ObArenaAllocator allocator(common::ObMemAttr(MTL_ID(), "AuxTabletInfo"));
mds::MdsDumpKV dump_kv;
ObTabletBindingMdsUserData aux_tablet_info;
ObIStorageMetaObj *tiny_meta = nullptr;
int64_t pos = 0;

if (OB_ISNULL(buf) || OB_UNLIKELY(size <= 0 || !handle.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid arguments", K(ret), KP(buf), K(size), K(handle));
} else if (OB_FAIL(dump_kv.deserialize(allocator, buf, size, pos))) {
LOG_WARN("fail to deserialize mds dump kv", K(ret), KP(buf), K(size));
} else {
pos = 0; // reset pos
char *tmp_buf = nullptr;
const common::ObString &str = dump_kv.v_.user_data_;
if (OB_FAIL(aux_tablet_info.deserialize(str.ptr(), str.length(), pos))) {
LOG_WARN("fail to deserialize aux tablet info", K(ret), K(str));
} else if (OB_ISNULL(tmp_buf = static_cast<char *>(allocator.alloc(aux_tablet_info.get_deep_copy_size())))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to allocate buffer", K(ret), "deep_copy_size", aux_tablet_info.get_deep_copy_size());
} else if (OB_FAIL(aux_tablet_info.deep_copy(tmp_buf, aux_tablet_info.get_deep_copy_size(), tiny_meta))) {
LOG_WARN("fail to deep copy auto inc seq", K(ret), KP(tmp_buf), K(aux_tablet_info));
} else {
ObStorageMetaCacheValue *cache_value = handle.get_cache_value();
ObStorageMetaValue value(MetaType::AUX_TABLET_INFO, tiny_meta);
if (OB_FAIL(OB_STORE_CACHE.get_storage_meta_cache().put_and_fetch(key, value, cache_value->value_, cache_value->cache_handle_))) {
LOG_WARN("fail to put and fetch value into storage meta cache", K(ret), K(key), K(value), K(cache_value));
}
}
}
if (OB_NOT_NULL(tiny_meta)) {
tiny_meta->~ObIStorageMetaObj();
}

return ret;
}


int ObStorageMetaValue::bypass_process_storage_meta_for_aux_tablet_info(
const MetaType type,
common::ObSafeArenaAllocator &allocator,
ObStorageMetaValueHandle &handle,
const char *buf,
const int64_t size)
{
int ret = OB_SUCCESS;
ObArenaAllocator tmp_allocator(common::ObMemAttr(MTL_ID(), "ProcMetaVaule"));
int64_t pos = 0;
mds::MdsDumpKV dump_kv;
char *buffer = nullptr;
if (OB_ISNULL(buf) || OB_UNLIKELY(size <= 0 || !handle.is_valid())) {
ret = OB_INVALID_ARGUMENT;
STORAGE_LOG(WARN, "invalid arguments", K(ret), KP(buf), K(size), K(handle));
} else if (OB_UNLIKELY(type != ObStorageMetaValue::AUX_TABLET_INFO)) {
ret = OB_INVALID_ARGUMENT;
STORAGE_LOG(WARN, "invalid meta type", K(ret), K(type));
} else if (OB_FAIL(dump_kv.deserialize(tmp_allocator, buf, size, pos))) {
STORAGE_LOG(WARN, "fail to deserialize ", K(ret), KP(buf), K(size));
} else {
pos = 0;
ObTabletBindingMdsUserData aux_tablet_info;
const common::ObString &str = dump_kv.v_.user_data_;
if (OB_FAIL(aux_tablet_info.deserialize(str.ptr(), str.length(), pos))) {
STORAGE_LOG(WARN, "fail to deserialize aux tablet info", K(ret), K(str));
} else {
ObIStorageMetaObj *tiny_meta = nullptr;
const int64_t buffer_pos = sizeof(ObStorageMetaValue);
const int64_t buffer_size = sizeof(ObStorageMetaValue) + aux_tablet_info.get_deep_copy_size();
if (OB_ISNULL(buffer = static_cast<char *>(allocator.alloc(buffer_size)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
STORAGE_LOG(WARN, "fail to allocate memory", K(ret), K(buffer_size));
} else {
if (OB_FAIL(aux_tablet_info.deep_copy(buffer + buffer_pos, aux_tablet_info.get_deep_copy_size(), tiny_meta))) {
STORAGE_LOG(WARN, "fail to deserialize aux tablet info", K(ret), KP(buf), K(size));
} else {
handle.get_cache_value()->value_ = new (buffer) ObStorageMetaValue(type, tiny_meta);
}
}
}
}
return ret;
}

ObStorageMetaValueHandle::ObStorageMetaValueHandle(const ObStorageMetaValueHandle &other)
: cache_value_(nullptr),
allocator_(nullptr)
Expand Down Expand Up @@ -576,9 +684,9 @@ int ObStorageMetaCache::ObStorageMetaIOCallback::inner_process(const char *data_
} else if (OB_UNLIKELY(size <= 0 || data_buffer == nullptr)) {
ret = OB_INVALID_DATA;
LOG_WARN("invalid data buffer size", K(ret), K(size), KP(data_buffer));
} else if (OB_UNLIKELY(NULL == (data_buf_ = (char*) (allocator_->alloc(size))))) {
} else if (OB_ISNULL(data_buf_ = static_cast<char*>(allocator_->alloc(size)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("Fail to allocate memory, ", K(ret), K(size));
LOG_WARN("Fail to allocate memory", K(ret), K(size));
} else {
MEMCPY(data_buf_, data_buffer, size);
char *buf = nullptr;
Expand Down
40 changes: 28 additions & 12 deletions src/storage/meta_mem/ob_storage_meta_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "storage/meta_mem/ob_meta_obj_struct.h"
#include "storage/blockstore/ob_shared_block_reader_writer.h"
#include "storage/access/ob_table_read_info.h"
#include "storage/tablet/ob_tablet_binding_mds_user_data.h"

namespace oceanbase
{
Expand All @@ -36,6 +37,7 @@ namespace storage

class ObTablet;
class ObTabletTableStore;
class ObTabletBindingMdsUserData;
class ObStorageMetaCache;
class ObStorageMetaValueHandle;

Expand Down Expand Up @@ -70,10 +72,11 @@ class ObStorageMetaValue final : public common::ObIKVCacheValue
public:
enum MetaType : uint16_t
{
SSTABLE = 0,
TABLE_STORE = 1,
AUTO_INC_SEQ = 2,
MAX = 3,
SSTABLE = 0,
TABLE_STORE = 1,
AUTO_INC_SEQ = 2,
AUX_TABLET_INFO = 3,
MAX = 4,
};
public:
ObStorageMetaValue();
Expand All @@ -85,6 +88,7 @@ class ObStorageMetaValue final : public common::ObIKVCacheValue
int get_sstable(blocksstable::ObSSTable *&sstable) const;
int get_table_store(const ObTabletTableStore *&store) const;
int get_autoinc_seq(const share::ObTabletAutoincSeq *&seq) const;
int get_aux_tablet_info(const ObTabletBindingMdsUserData *&aux_tablet_info) const;
bool is_valid() const;
void reset()
{
Expand Down Expand Up @@ -112,6 +116,12 @@ class ObStorageMetaValue final : public common::ObIKVCacheValue
const char *buf,
const int64_t size,
const ObTablet *tablet);
static int process_aux_tablet_info(
ObStorageMetaValueHandle &handle,
const ObStorageMetaKey &key,
const char *buf,
const int64_t size,
const ObTablet *tablet);
TO_STRING_KV(K_(type), KP_(obj));
public:
typedef int (*StorageMetaProcessor)(
Expand All @@ -136,6 +146,12 @@ class ObStorageMetaValue final : public common::ObIKVCacheValue
ObStorageMetaValueHandle &handle,
const char *buf,
const int64_t size);
static int bypass_process_storage_meta_for_aux_tablet_info(
const MetaType type,
common::ObSafeArenaAllocator &allocator,
ObStorageMetaValueHandle &handle,
const char *buf,
const int64_t size);
private:
MetaType type_;
ObIStorageMetaObj *obj_;
Expand Down Expand Up @@ -290,24 +306,24 @@ int ObStorageMetaValue::bypass_process_storage_meta(
ObArenaAllocator tmp_allocator(common::ObMemAttr(MTL_ID(), "ProcMetaVaule"));
int64_t pos = 0;
T t;
char *buff = nullptr;
char *buffer = nullptr;
if (OB_ISNULL(buf) || OB_UNLIKELY(size <= 0 || !handle.is_valid())) {
ret = OB_INVALID_ARGUMENT;
STORAGE_LOG(WARN, "invalid arguments", K(ret), KP(buf), K(size), K(handle));
} else if (OB_FAIL(t.deserialize(tmp_allocator, buf, size, pos))) {
STORAGE_LOG(WARN, "fail to deserialize ", K(ret), KP(buf), K(size));
} else {
ObIStorageMetaObj *tiny_meta = nullptr;
const int64_t buff_pos = sizeof(ObStorageMetaValue);
const int64_t buff_size = sizeof(ObStorageMetaValue) + t.get_deep_copy_size();
if (OB_ISNULL(buff = static_cast<char *>(allocator.alloc(buff_size)))) {
const int64_t buffer_pos = sizeof(ObStorageMetaValue);
const int64_t buffer_size = sizeof(ObStorageMetaValue) + t.get_deep_copy_size();
if (OB_ISNULL(buffer = static_cast<char *>(allocator.alloc(buffer_size)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
STORAGE_LOG(WARN, "fail to allocate memory", K(ret), K(buff_size));
STORAGE_LOG(WARN, "fail to allocate memory", K(ret), K(buffer_size));
} else {
if (OB_FAIL(t.deep_copy(buff + buff_pos, t.get_deep_copy_size(), tiny_meta))) {
STORAGE_LOG(WARN, "fail to deserialize sstable", K(ret), KP(buf), K(size));
if (OB_FAIL(t.deep_copy(buffer + buffer_pos, t.get_deep_copy_size(), tiny_meta))) {
STORAGE_LOG(WARN, "fail to deserialize T", K(ret), KP(buf), K(size));
} else {
handle.get_cache_value()->value_ = new (buff) ObStorageMetaValue(type, tiny_meta);
handle.get_cache_value()->value_ = new (buffer) ObStorageMetaValue(type, tiny_meta);
}
}
}
Expand Down
Empty file modified src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/ob_storage_rpc.h
100755 → 100644
Empty file.
Empty file modified src/storage/ob_storage_struct.h
100755 → 100644
Empty file.
Empty file modified src/storage/ob_super_block_struct.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/slog_ckpt/ob_tenant_checkpoint_slog_handler.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/slog_ckpt/ob_tenant_storage_checkpoint_writer.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/tablelock/ob_mem_ctx_table_lock.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/tablelock/ob_table_lock_common.h
100755 → 100644
Empty file.
Empty file modified src/storage/tablelock/ob_table_lock_rpc_struct.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/tablelock/ob_table_lock_rpc_struct.h
100755 → 100644
Empty file.
Empty file modified src/storage/tablelock/ob_table_lock_service.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/tablelock/ob_table_lock_service.h
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions src/storage/tablet/ob_i_tablet_mds_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "storage/meta_mem/ob_tablet_pointer.h"
#include "storage/tablet/ob_tablet_mds_data.h"
#include "storage/tablet/ob_tablet_member_wrapper.h"
#include "storage/tablet/ob_tablet_obj_load_helper.h"
#include "storage/ls/ob_ls_switch_checker.h"

namespace oceanbase
Expand Down
60 changes: 15 additions & 45 deletions src/storage/tablet/ob_i_tablet_mds_interface.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ inline int ObITabletMdsInterface::get_mds_data_from_tablet<ObTabletCreateDeleteM
MDS_TG(10_ms);
int ret = OB_SUCCESS;
ObTabletCreateDeleteMdsUserData data;
const mds::MdsDumpKV *kv = nullptr;
mds::MdsDumpKV *kv = nullptr;
ObArenaAllocator allocator("mds_reader");
const ObTabletComplexAddr<mds::MdsDumpKV> &tablet_status_addr = get_mds_data_().tablet_status_.committed_kv_;
const ObTabletCreateDeleteMdsUserData &tablet_status_cache = get_mds_data_().tablet_status_cache_;
Expand Down Expand Up @@ -179,7 +179,7 @@ inline int ObITabletMdsInterface::get_mds_data_from_tablet<ObTabletCreateDeleteM
}
}

ObTabletMdsData::free_mds_dump_kv(allocator, kv);
ObTabletObjLoadHelper::free(allocator, kv);
}
return ret;
#undef PRINT_WRAPPER
Expand All @@ -189,53 +189,23 @@ template <>
inline int ObITabletMdsInterface::get_mds_data_from_tablet<ObTabletBindingMdsUserData>(
const common::ObFunction<int(const ObTabletBindingMdsUserData&)> &read_op) const
{
#define PRINT_WRAPPER KR(ret), K(data), KPC(kv), K(*this)
#define PRINT_WRAPPER KR(ret), K(aux_tablet_info_addr), K(*this)
MDS_TG(10_ms);
int ret = OB_SUCCESS;
ObTabletBindingMdsUserData data;
const mds::MdsDumpKV *kv = nullptr;
ObTabletBindingMdsUserData *aux_tablet_info = nullptr;
ObArenaAllocator allocator("mds_reader");
const ObTabletComplexAddr<mds::MdsDumpKV> &aux_tablet_info_addr = get_mds_data_().aux_tablet_info_.committed_kv_;
const ObTabletBindingMdsUserData &aux_tablet_info_cache = get_mds_data_().aux_tablet_info_cache_;

if (aux_tablet_info_addr.is_memory_object()) {
if (CLICK_FAIL(read_op(aux_tablet_info_cache))) {
MDS_LOG_GET(WARN, "failed to read_op");
}
} else if (aux_tablet_info_addr.is_none_object()) {
if (CLICK_FAIL(ObTabletMdsData::load_aux_tablet_info(allocator, aux_tablet_info_addr, aux_tablet_info))) {
MDS_LOG_GET(WARN, "failed to load auto inc seq");
} else if (nullptr == aux_tablet_info) {
ret = OB_EMPTY_RESULT;
} else if (aux_tablet_info_addr.is_disk_object()) {
if (aux_tablet_info_cache.is_valid()) {
if (CLICK_FAIL(read_op(aux_tablet_info_cache))) {
MDS_LOG_GET(WARN, "failed to read_op");
}
} else {
if (CLICK_FAIL(ObTabletMdsData::load_mds_dump_kv(allocator, aux_tablet_info_addr, kv))) {
MDS_LOG_GET(WARN, "failed to load mds dump kv");
} else if (nullptr == kv) {
ret = OB_EMPTY_RESULT;
} else {
const common::ObString &user_data = kv->v_.user_data_;
int64_t pos = 0;
if (user_data.empty()) {
ret = OB_EMPTY_RESULT;
} else if (CLICK_FAIL(data.deserialize(user_data.ptr(), user_data.length(), pos))) {
MDS_LOG_GET(WARN, "failed to deserialize", K(user_data),
"user_data_length", user_data.length(),
"user_hash:%x", user_data.hash(),
"crc_check_number", kv->v_.crc_check_number_);
} else if (CLICK_FAIL(read_op(data))) {
MDS_LOG_GET(WARN, "failed to read_op");
}
}

ObTabletMdsData::free_mds_dump_kv(allocator, kv);
}
} else {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "unexpected addr", K(aux_tablet_info_addr));
} else if (CLICK_FAIL(read_op(*aux_tablet_info))) {
MDS_LOG_GET(WARN, "failed to read_op");
}

ObTabletObjLoadHelper::free(allocator, aux_tablet_info);

return ret;
#undef PRINT_WRAPPER
}
Expand All @@ -248,7 +218,7 @@ inline int ObITabletMdsInterface::get_mds_data_from_tablet<share::ObTabletAutoin
MDS_TG(10_ms);
int ret = OB_SUCCESS;
const ObTabletComplexAddr<share::ObTabletAutoincSeq> &auto_inc_seq_addr = get_mds_data_().auto_inc_seq_;
const share::ObTabletAutoincSeq *auto_inc_seq = nullptr;
share::ObTabletAutoincSeq *auto_inc_seq = nullptr;
ObArenaAllocator allocator("mds_reader");

if (CLICK_FAIL(ObTabletMdsData::load_auto_inc_seq(allocator, auto_inc_seq_addr, auto_inc_seq))) {
Expand All @@ -259,7 +229,7 @@ inline int ObITabletMdsInterface::get_mds_data_from_tablet<share::ObTabletAutoin
MDS_LOG_GET(WARN, "failed to read_op");
}

ObTabletMdsData::free_auto_inc_seq(allocator, auto_inc_seq);
ObTabletObjLoadHelper::free(allocator, auto_inc_seq);

return ret;
#undef PRINT_WRAPPER
Expand Down Expand Up @@ -667,7 +637,7 @@ int ObITabletMdsInterface::fill_virtual_info_by_complex_addr_(const ObTabletComp
ObArenaAllocator allocator("vir_mds_reader");
mds::MdsNodeInfoForVirtualTable *cur_virtual_info = nullptr;
mds::UserMdsNode<mds::DummyKey, T> user_mds_node;
const mds::MdsDumpKV *dump_kv = nullptr;
mds::MdsDumpKV *dump_kv = nullptr;

if (CLICK_FAIL(mds_node_info_array.push_back(mds::MdsNodeInfoForVirtualTable()))) {
MDS_LOG_GET(WARN, "fail to push_back");
Expand Down Expand Up @@ -697,7 +667,7 @@ int ObITabletMdsInterface::fill_virtual_info_by_complex_addr_(const ObTabletComp
}
}

ObTabletMdsData::free_mds_dump_kv(allocator, dump_kv);
ObTabletObjLoadHelper::free(allocator, dump_kv);
}
return ret;
#undef PRINT_WRAPPER
Expand Down
Empty file modified src/storage/tablet/ob_table_store_util.cpp
100755 → 100644
Empty file.
Empty file modified src/storage/tablet/ob_table_store_util.h
100755 → 100644
Empty file.

0 comments on commit ac0d44e

Please sign in to comment.