return tablet_resident_info
This commit is contained in:
parent
314c286416
commit
3994193c2a
@ -146,7 +146,7 @@ int ObAllVirtualTabletPtr::process_curr_tenant(ObNewRow *&row)
|
||||
ls_id = key.ls_id_;
|
||||
tablet_id = key.tablet_id_;
|
||||
tablet_pointer = static_cast<const ObTabletPointer*>(ptr_hdl.get_resource_ptr());
|
||||
ObTabletResidentInfo tablet_info(key, *tablet_pointer);
|
||||
ObTabletResidentInfo tablet_info = tablet_pointer->get_tablet_resident_info(key);
|
||||
|
||||
const int64_t col_cnt = output_column_ids_.count();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < col_cnt; i++) {
|
||||
|
@ -2247,17 +2247,23 @@ int ObLSTabletService::get_ls_migration_required_size(int64_t &required_size)
|
||||
LOG_WARN("fail to get all tablet ids from set", K(ret));
|
||||
} else {
|
||||
key.ls_id_ = ls_id;
|
||||
ObTabletResidentInfo info;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < tablet_ids.count(); ++i) {
|
||||
key.tablet_id_ = tablet_ids.at(i);
|
||||
if (OB_FAIL(t3m->get_tablet_migration_required_size(key, tmp_size))) {
|
||||
if (OB_FAIL(t3m->get_tablet_resident_info(key, info))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
// do nothing (expected: add no lock when fetching tablets from tablet_id_set_)
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("fail to get tablet required_size", K(ret), K(key), K(tmp_size));
|
||||
}
|
||||
} else if (!info.is_valid()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("in_valid resident_info", K(ret), K(key), K(info));
|
||||
} else {
|
||||
required_size += tmp_size;
|
||||
required_size += info.get_tablet_meta_size() + // meta_size
|
||||
info.get_required_size() - // data_size
|
||||
info.get_ss_public_sstable_occupy_size(); // shared_data size
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
|
@ -402,6 +402,11 @@ int ObTabletPointer::deep_copy(char *buf, const int64_t buf_len, ObTabletPointer
|
||||
return ret;
|
||||
}
|
||||
|
||||
ObTabletResidentInfo ObTabletPointer::get_tablet_resident_info(const ObTabletMapKey &key) const
|
||||
{
|
||||
return ObTabletResidentInfo(attr_, phy_addr_, key.ls_id_, key.tablet_id_);
|
||||
}
|
||||
|
||||
bool ObTabletPointer::get_initial_state() const
|
||||
{
|
||||
return ATOMIC_LOAD(&initial_state_);
|
||||
@ -705,13 +710,6 @@ int ObTabletPointer::set_tablet_attr(const ObTabletAttr &attr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ObTabletResidentInfo::ObTabletResidentInfo(const ObTabletMapKey &key, const ObTabletPointer &tablet_ptr)
|
||||
: attr_(tablet_ptr.attr_), tablet_addr_(tablet_ptr.phy_addr_)
|
||||
{
|
||||
tablet_id_ = key.tablet_id_;
|
||||
ls_id_ = key.ls_id_;
|
||||
}
|
||||
|
||||
int64_t ObITabletFilterOp::total_skip_cnt_ = 0;
|
||||
int64_t ObITabletFilterOp::total_tablet_cnt_ = 0;
|
||||
int64_t ObITabletFilterOp::not_in_mem_tablet_cnt_ = 0;
|
||||
|
@ -28,6 +28,7 @@ namespace storage
|
||||
{
|
||||
class ObTablet;
|
||||
class ObTabletDDLKvMgr;
|
||||
struct ObTabletResidentInfo;
|
||||
typedef ObMetaObjGuard<ObTabletDDLKvMgr> ObDDLKvMgrHandle;
|
||||
|
||||
struct ObTabletAttr final
|
||||
@ -169,6 +170,7 @@ public:
|
||||
K_(protected_memtable_mgr_handle), K_(ddl_info), K_(initial_state), KP_(old_version_chain));
|
||||
public:
|
||||
bool get_initial_state() const;
|
||||
ObTabletResidentInfo get_tablet_resident_info(const ObTabletMapKey &key) const;
|
||||
void set_initial_state(const bool initial_state);
|
||||
int create_ddl_kv_mgr(const share::ObLSID &ls_id, const ObTabletID &tablet_id, ObDDLKvMgrHandle &ddl_kv_mgr_handle);
|
||||
void get_ddl_kv_mgr(ObDDLKvMgrHandle &ddl_kv_mgr_handle);
|
||||
@ -218,12 +220,15 @@ private:
|
||||
struct ObTabletResidentInfo final
|
||||
{
|
||||
public:
|
||||
ObTabletResidentInfo(ObTabletAttr &attr, ObTabletID &tablet_id, share::ObLSID &ls_id)
|
||||
: attr_(attr), tablet_addr_(), tablet_id_(tablet_id), ls_id_(ls_id)
|
||||
ObTabletResidentInfo() { reset(); }
|
||||
ObTabletResidentInfo(
|
||||
const ObTabletAttr &attr,
|
||||
const ObMetaDiskAddr &tablet_addr,
|
||||
const share::ObLSID &ls_id,
|
||||
const ObTabletID &tablet_id)
|
||||
: attr_(attr), tablet_addr_(tablet_addr), ls_id_(ls_id), tablet_id_(tablet_id)
|
||||
{}
|
||||
|
||||
ObTabletResidentInfo(const ObTabletMapKey &key, const ObTabletPointer &tablet_ptr);
|
||||
~ObTabletResidentInfo() = default;
|
||||
~ObTabletResidentInfo() { reset(); };
|
||||
bool is_valid() const { return attr_.valid_ && tablet_id_.is_valid() && tablet_addr_.is_valid(); }
|
||||
bool has_transfer_table() const { return attr_.has_transfer_table_; }
|
||||
bool is_empty_shell() const { return attr_.is_empty_shell_; }
|
||||
@ -234,12 +239,19 @@ public:
|
||||
uint64_t get_tablet_meta_size() const { return attr_.tablet_meta_size_; }
|
||||
int64_t get_ss_public_sstable_occupy_size() const { return attr_.ss_public_sstable_occupy_size_; }
|
||||
int64_t get_backup_size() const { return attr_.backup_bytes_; }
|
||||
void reset()
|
||||
{
|
||||
attr_.reset();
|
||||
tablet_addr_.set_none_addr();
|
||||
tablet_id_ = ObTabletID::INVALID_TABLET_ID;
|
||||
ls_id_ = ObLSID::INVALID_LS_ID;
|
||||
}
|
||||
TO_STRING_KV(K_(ls_id), K_(tablet_id), K_(tablet_addr), K_(attr));
|
||||
public:
|
||||
const ObTabletAttr &attr_;
|
||||
ObTabletAttr attr_;
|
||||
ObMetaDiskAddr tablet_addr_; // used to identify one tablet
|
||||
ObTabletID tablet_id_;
|
||||
share::ObLSID ls_id_;
|
||||
ObTabletID tablet_id_;
|
||||
};
|
||||
|
||||
class ObITabletFilterOp
|
||||
|
@ -254,7 +254,7 @@ int ObTabletPointerMap::try_get_in_memory_meta_obj_with_filter(
|
||||
STORAGE_LOG(DEBUG, "pointer addr is none, no object to be got", K(ret), K(key), KPC(t_ptr));
|
||||
} else if (t_ptr->is_in_memory()) {
|
||||
if (t_ptr->is_attr_valid()) { // try skip tablet with attr
|
||||
ObTabletResidentInfo info(key, *t_ptr);
|
||||
ObTabletResidentInfo info = t_ptr->get_tablet_resident_info(key);
|
||||
bool is_skipped = false;
|
||||
if (OB_FAIL(op(info, is_skipped))) {
|
||||
STORAGE_LOG(WARN, "fail to skip tablet", K(ret), KP(t_ptr), K(key), K(info));
|
||||
|
@ -1862,9 +1862,9 @@ int ObTenantMetaMemMgr::get_tablet_pointer_initial_state(const ObTabletMapKey &k
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantMetaMemMgr::get_tablet_migration_required_size(
|
||||
int ObTenantMetaMemMgr::get_tablet_resident_info(
|
||||
const ObTabletMapKey &key,
|
||||
int64_t &required_size)
|
||||
ObTabletResidentInfo &info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletPointerHandle ptr_handle(tablet_map_);
|
||||
@ -1890,10 +1890,7 @@ int ObTenantMetaMemMgr::get_tablet_migration_required_size(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet_pointer is invalied", K(ret), KPC(tablet_ptr));
|
||||
} else {
|
||||
ObTabletResidentInfo tablet_info(key, *tablet_ptr);
|
||||
required_size = tablet_info.get_tablet_meta_size() + // meta_size
|
||||
tablet_info.get_required_size() - // data_size
|
||||
tablet_info.get_ss_public_sstable_occupy_size(); // shared_data size
|
||||
info = tablet_ptr->get_tablet_resident_info(key);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -288,9 +288,9 @@ public:
|
||||
int get_meta_mem_status(common::ObIArray<ObTenantMetaMemStatus> &info) const;
|
||||
|
||||
int get_tablet_pointer_initial_state(const ObTabletMapKey &key, bool &initial_state);
|
||||
int get_tablet_migration_required_size(
|
||||
int get_tablet_resident_info(
|
||||
const ObTabletMapKey &key,
|
||||
int64_t &required_size);
|
||||
ObTabletResidentInfo &info);
|
||||
int get_tablet_ddl_kv_mgr(const ObTabletMapKey &key, ObDDLKvMgrHandle &ddl_kv_mgr_handle);
|
||||
ObFullTabletCreator &get_mstx_tablet_creator() { return full_tablet_creator_; }
|
||||
common::ObIAllocator &get_meta_cache_io_allocator() { return meta_cache_io_allocator_; }
|
||||
|
@ -230,7 +230,7 @@ int ObDiskUsageReportTask::count_tenant_data(const uint64_t tenant_id)
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
STORAGE_LOG(WARN, "failed to cast ptr to ObTabletPointer*", K(ret), K(pointer_handle));
|
||||
} else {
|
||||
ObTabletResidentInfo tablet_info(tablet_map_key, *tablet_pointer);
|
||||
ObTabletResidentInfo tablet_info = tablet_pointer->get_tablet_resident_info(tablet_map_key);
|
||||
occupy_size += tablet_info.get_occupy_size();
|
||||
data_size += tablet_info.get_required_size();
|
||||
meta_size += tablet_info.get_tablet_meta_size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user