fix typo and uninitialized variable

This commit is contained in:
hiddenbomb 2024-02-09 08:13:48 +00:00 committed by ob-robot
parent 1a85bf7025
commit caeb5290b2
4 changed files with 27 additions and 28 deletions

View File

@ -1834,7 +1834,7 @@ int ObLSTabletService::replay_create_tablet(
ObTablet *tablet = nullptr;
int64_t pos = 0;
ObMetaDiskAddr old_addr;
ObTabletPoolType pool_type;
ObTabletPoolType pool_type(ObTabletPoolType::TP_MAX);
ObBucketHashWLockGuard lock_guard(bucket_lock_, tablet_id.hash());
time_guard.click("Lock");
if (OB_FAIL(ObTabletCreateDeleteHelper::create_tmp_tablet(key, allocator, tablet_hdl))) {
@ -1869,7 +1869,6 @@ int ObLSTabletService::replay_create_tablet(
}
if (OB_FAIL(ret)) {
// do nothing
} else if (OB_FAIL(t3m->compare_and_swap_tablet(key, old_addr, disk_addr, pool_type, true /* whether to set tablet pool */))) {
LOG_WARN("fail to compare and swap tablat in t3m", K(ret), K(key), K(old_addr), K(disk_addr));
} else if (FALSE_IT(time_guard.click("CASwap"))) {

View File

@ -61,7 +61,7 @@ public:
const int64_t timeout = 0) const;
int fill_virtual_info(ObIArray<mds::MdsNodeInfoForVirtualTable> &mds_node_info_array) const;
TO_STRING_KV(KP(this), "is_inited", check_is_inited_(), "ls_id", get_tablet_meta_().ls_id_,
"tablet_id", get_table_id_(), KP(get_tablet_ponter_()));
"tablet_id", get_table_id_(), KP(get_tablet_pointer_()));
int get_mds_table_rec_log_scn(share::SCN &rec_scn);
int mds_table_flush(const share::SCN &recycle_scn);
protected:// implemented by ObTablet
@ -70,7 +70,7 @@ protected:// implemented by ObTablet
virtual const ObTabletMeta &get_tablet_meta_() const = 0;
virtual int get_mds_table_handle_(mds::MdsTableHandle &handle,
const bool create_if_not_exist) const = 0;
virtual ObTabletPointer *get_tablet_ponter_() const = 0;
virtual ObTabletPointer *get_tablet_pointer_() const = 0;
template <typename T>
int get_mds_data_from_tablet(const common::ObFunction<int(const T&)> &read_op) const;

View File

@ -151,11 +151,11 @@ inline int ObITabletMdsInterface::check_tablet_status_written(bool &written)
if (OB_UNLIKELY(!check_is_inited_())) {
ret = OB_NOT_INIT;
MDS_LOG(WARN, "not inited", K(ret), KPC(this));
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG(ERROR, "tablet pointer is null", K(ret), KPC(this));
} else {
written = get_tablet_ponter_()->is_tablet_status_written();
written = get_tablet_pointer_()->is_tablet_status_written();
}
return ret;
}
@ -271,13 +271,13 @@ int ObITabletMdsInterface::set(T &&data, mds::MdsCtx &ctx, const int64_t lock_ti
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (MDS_FAIL(handle.set(std::forward<T>(data), ctx, lock_timeout_us))) {
MDS_LOG_SET(WARN, "failed to set dummy key unit data");
} else if (std::is_same<ObTabletCreateDeleteMdsUserData, typename std::decay<T>::type>::value) {
get_tablet_ponter_()->set_tablet_status_written();
get_tablet_pointer_()->set_tablet_status_written();
}
return ret;
#undef PRINT_WRAPPER
@ -298,13 +298,13 @@ int ObITabletMdsInterface::replay(T &&data, mds::MdsCtx &ctx, const share::SCN &
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.replay(std::forward<T>(data), ctx, scn))) {
MDS_LOG_SET(WARN, "failed to replay dummy key unit data");
} else if (std::is_same<ObTabletCreateDeleteMdsUserData, typename std::decay<T>::type>::value) {
get_tablet_ponter_()->set_tablet_status_written();
get_tablet_pointer_()->set_tablet_status_written();
}
}
return ret;
@ -323,13 +323,13 @@ int ObITabletMdsInterface::set(const Key &key, Value &&data, mds::MdsCtx &ctx, c
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.set(key, std::forward<Value>(data), ctx, lock_timeout_us))) {
MDS_LOG_SET(WARN, "failed to set multi key unit data");
} else {
get_tablet_ponter_()->set_tablet_status_written();
get_tablet_pointer_()->set_tablet_status_written();
MDS_LOG_SET(TRACE, "success to set multi key unit data");
}
return ret;
@ -354,13 +354,13 @@ int ObITabletMdsInterface::replay(const Key &key,
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.replay(key, std::forward<Value>(mds), ctx, scn))) {
MDS_LOG_SET(WARN, "failed to replay multi key unit data");
} else {
get_tablet_ponter_()->set_tablet_status_written();
get_tablet_pointer_()->set_tablet_status_written();
MDS_LOG_SET(TRACE, "success to replay multi key unit data");
}
}
@ -380,16 +380,16 @@ int ObITabletMdsInterface::remove(const Key &key, mds::MdsCtx &ctx, const int64_
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.remove(key, ctx, lock_timeout_us))) {
MDS_LOG_SET(WARN, "failed to remove multi key unit data");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else {
get_tablet_ponter_()->set_tablet_status_written();
get_tablet_pointer_()->set_tablet_status_written();
MDS_LOG_SET(TRACE, "success to remove multi key unit data");
}
return ret;
@ -408,13 +408,13 @@ int ObITabletMdsInterface::replay_remove(const Key &key, mds::MdsCtx &ctx, const
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_SET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (CLICK() && OB_SUCCESS != (ret = handle.replay_remove<Key, Value>(key, ctx, scn))) {
MDS_LOG_SET(WARN, "failed to replay remove multi key unit data");
} else {
get_tablet_ponter_()->set_tablet_status_written();
get_tablet_pointer_()->set_tablet_status_written();
MDS_LOG_SET(TRACE, "success to remove multi key unit data");
}
return ret;
@ -442,10 +442,10 @@ int ObITabletMdsInterface::is_locked_by_others(bool &is_locked, const mds::MdsWr
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_ponter_()->get_ls(), is_online))) {
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_pointer_()->get_ls(), is_online))) {
MDS_LOG_GET(WARN, "check ls online state failed", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.is_locked_by_others<T>(is_locked, self))) {
if (OB_SNAPSHOT_DISCARDED != ret) {
@ -490,10 +490,10 @@ int ObITabletMdsInterface::get_latest(OP &&read_op, bool &is_committed, const in
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_ponter_()->get_ls(), is_online))) {
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_pointer_()->get_ls(), is_online))) {
MDS_LOG_GET(WARN, "check ls online state failed", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.get_latest<T>(read_op, is_committed, read_seq))) {
if (OB_SNAPSHOT_DISCARDED != ret) {
@ -550,10 +550,10 @@ int ObITabletMdsInterface::get_snapshot(OP &&read_op,
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_ponter_()->get_ls(), is_online))) {
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_pointer_()->get_ls(), is_online))) {
MDS_LOG_GET(WARN, "check ls online state failed", K(ret), KPC(this));
} else if (CLICK_FAIL(handle.get_snapshot<T>(read_op, snapshot, read_seq, timeout_us))) {
if (OB_SNAPSHOT_DISCARDED != ret) {
@ -614,10 +614,10 @@ int ObITabletMdsInterface::get_snapshot(const Key &key,
} else if (!handle.is_valid()) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "mds cannot be NULL");
} else if (OB_ISNULL(get_tablet_ponter_())) {
} else if (OB_ISNULL(get_tablet_pointer_())) {
ret = OB_ERR_UNEXPECTED;
MDS_LOG_GET(WARN, "tablet pointer is null", K(ret), KPC(this));
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_ponter_()->get_ls(), is_online))) {
} else if (MDS_FAIL(ls_switch_checker.check_ls_switch_state(get_tablet_pointer_()->get_ls(), is_online))) {
MDS_LOG_GET(WARN, "check ls online state failed", K(ret), KPC(this));
} else if (CLICK() && OB_SUCCESS != (ret = handle.get_snapshot<Key, Value>(key, read_op, snapshot, read_seq, timeout_us))) {
if (OB_SNAPSHOT_DISCARDED != ret) {

View File

@ -593,7 +593,7 @@ protected:// for MDS use
virtual const ObTabletMeta &get_tablet_meta_() const override final { return tablet_meta_; }
virtual int get_mds_table_handle_(mds::MdsTableHandle &handle,
const bool create_if_not_exist) const override final;
virtual ObTabletPointer *get_tablet_ponter_() const override final {
virtual ObTabletPointer *get_tablet_pointer_() const override final {
return static_cast<ObTabletPointer*>(pointer_hdl_.get_resource_ptr());
}
private: