use tablet_allocator to get_tablets in virtual table

This commit is contained in:
obdev
2023-03-13 11:16:48 +00:00
committed by ob-robot
parent 92c7e1c42f
commit a06d22d628
6 changed files with 19 additions and 6 deletions

View File

@ -26,6 +26,7 @@ ObAllVirtualTableMgr::ObAllVirtualTableMgr()
: ObVirtualTableScannerIterator(),
addr_(),
tablet_iter_(nullptr),
tablet_allocator_("VTTable"),
tablet_handle_(),
ls_id_(share::ObLSID::INVALID_LS_ID),
all_tables_(),
@ -54,6 +55,7 @@ void ObAllVirtualTableMgr::reset()
}
tablet_handle_.reset();
tablet_allocator_.reset();
ObVirtualTableScannerIterator::reset();
}
@ -108,10 +110,11 @@ int ObAllVirtualTableMgr::get_next_tablet()
{
int ret = OB_SUCCESS;
tablet_allocator_.reuse();
if (nullptr == tablet_iter_) {
tablet_allocator_.set_tenant_id(MTL_ID());
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m, *allocator_);
if (OB_ISNULL(tablet_iter_)) {
if (OB_ISNULL(tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m, tablet_allocator_))) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "fail to new tablet_iter_", K(ret));
}

View File

@ -77,6 +77,7 @@ private:
private:
common::ObAddr addr_;
storage::ObTenantTabletIterator *tablet_iter_;
common::ObArenaAllocator tablet_allocator_;
ObTabletHandle tablet_handle_;
int64_t ls_id_;
char ip_buf_[common::OB_IP_STR_BUFF];

View File

@ -24,6 +24,7 @@ ObAllVirtualTabletCompactionInfo::ObAllVirtualTabletCompactionInfo()
ObMultiTenantOperator(),
addr_(),
tablet_iter_(nullptr),
tablet_allocator_("VTTable"),
tablet_handle_(),
ls_id_(share::ObLSID::INVALID_LS_ID),
iter_buf_(nullptr),
@ -51,6 +52,7 @@ void ObAllVirtualTabletCompactionInfo::reset()
iter_buf_ = nullptr;
}
tablet_handle_.reset();
tablet_allocator_.reset();
ObVirtualTableScannerIterator::reset();
}
@ -106,10 +108,11 @@ int ObAllVirtualTabletCompactionInfo::get_next_tablet()
{
int ret = OB_SUCCESS;
tablet_allocator_.reuse();
if (nullptr == tablet_iter_) {
tablet_allocator_.set_tenant_id(MTL_ID());
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m);
if (OB_ISNULL(tablet_iter_)) {
if (OB_ISNULL(tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m, tablet_allocator_))) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "fail to new tablet_iter_", K(ret));
}

View File

@ -58,6 +58,7 @@ private:
private:
common::ObAddr addr_;
storage::ObTenantTabletIterator *tablet_iter_;
common::ObArenaAllocator tablet_allocator_;
ObTabletHandle tablet_handle_;
int64_t ls_id_;
char ip_buf_[common::OB_IP_STR_BUFF];

View File

@ -67,6 +67,7 @@ ObAllVirtualTabletSSTableMacroInfo::ObAllVirtualTabletSSTableMacroInfo()
: ObVirtualTableScannerIterator(),
addr_(),
tablet_iter_(nullptr),
tablet_allocator_("VTTable"),
tablet_handle_(),
ls_id_(share::ObLSID::INVALID_LS_ID),
all_tables_(),
@ -111,6 +112,7 @@ void ObAllVirtualTabletSSTableMacroInfo::reset()
memset(objs_, 0, sizeof(objs_));
iter_allocator_.reset();
rowkey_allocator_.reset();
tablet_allocator_.reset();
ObVirtualTableScannerIterator::reset();
}
@ -233,6 +235,7 @@ int ObAllVirtualTabletSSTableMacroInfo::get_macro_info(
MacroInfo &info)
{
int ret = OB_SUCCESS;
rowkey_allocator_.reuse();
const ObTableReadInfo &read_info = tablet_handle_.get_obj()->get_index_read_info();
if (OB_UNLIKELY(!macro_desc.is_valid())) {
ret = OB_INVALID_ARGUMENT;
@ -499,10 +502,11 @@ int ObAllVirtualTabletSSTableMacroInfo::process_curr_tenant(common::ObNewRow *&r
int ObAllVirtualTabletSSTableMacroInfo::get_next_tablet()
{
int ret = OB_SUCCESS;
tablet_allocator_.reuse();
if (nullptr == tablet_iter_) {
tablet_allocator_.set_tenant_id(MTL_ID());
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m, *allocator_);
if (OB_ISNULL(tablet_iter_)) {
if (OB_ISNULL(tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m, tablet_allocator_))) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "fail to new tablet_iter_", K(ret));
}

View File

@ -122,6 +122,7 @@ private:
private:
common::ObAddr addr_;
ObTenantTabletIterator *tablet_iter_;
common::ObArenaAllocator tablet_allocator_;
ObTabletHandle tablet_handle_;
int64_t ls_id_;
char ip_buf_[common::OB_IP_STR_BUFF];