dont't reuse allocator until prefetch.end
This commit is contained in:
@ -721,8 +721,9 @@ int ObDDLSStableAllRangeIterator::get_index_row_count(const ObDatumRange &range,
|
|||||||
bool tmp_reach_cursor_end = false;
|
bool tmp_reach_cursor_end = false;
|
||||||
ObMicroIndexRowItem tmp_index_item;
|
ObMicroIndexRowItem tmp_index_item;
|
||||||
int64_t tmp_row_offset = 0;
|
int64_t tmp_row_offset = 0;
|
||||||
|
ObArenaAllocator idx_row_allocator("DDL_Row_Cnt", OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
|
||||||
while (OB_SUCC(ret)) {
|
while (OB_SUCC(ret)) {
|
||||||
if (OB_FAIL(tmp_index_macro_iter.get_next_idx_row(idx_row_allocator_, tmp_index_item, tmp_row_offset, tmp_reach_cursor_end))) {
|
if (OB_FAIL(tmp_index_macro_iter.get_next_idx_row(idx_row_allocator, tmp_index_item, tmp_row_offset, tmp_reach_cursor_end))) {
|
||||||
if (OB_ITER_END != ret) {
|
if (OB_ITER_END != ret) {
|
||||||
LOG_WARN("fail to get next idx info", K(ret), K(tmp_index_item), K(tmp_reach_cursor_end), K(tmp_index_macro_iter));
|
LOG_WARN("fail to get next idx info", K(ret), K(tmp_index_item), K(tmp_reach_cursor_end), K(tmp_index_macro_iter));
|
||||||
} else {
|
} else {
|
||||||
@ -736,6 +737,8 @@ int ObDDLSStableAllRangeIterator::get_index_row_count(const ObDatumRange &range,
|
|||||||
if (OB_FAIL(ret)) {
|
if (OB_FAIL(ret)) {
|
||||||
index_row_count = 0;
|
index_row_count = 0;
|
||||||
}
|
}
|
||||||
|
tmp_index_item.reset();
|
||||||
|
idx_row_allocator.reset();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,17 @@ int ObMicroIndexRowItem::init(ObIAllocator &allocator,
|
|||||||
LOG_WARN("invalid arguemen", K(ret), KP(idx_row_header), KP(endkey), KP(idx_minor_info), KP(agg_row_buf));
|
LOG_WARN("invalid arguemen", K(ret), KP(idx_row_header), KP(endkey), KP(idx_minor_info), KP(agg_row_buf));
|
||||||
} else {
|
} else {
|
||||||
allocator_ = &allocator;
|
allocator_ = &allocator;
|
||||||
endkey_ = endkey; // already deep_copied outside
|
|
||||||
agg_buf_size_ = agg_buf_size;
|
agg_buf_size_ = agg_buf_size;
|
||||||
|
|
||||||
|
void *key_buf = nullptr;
|
||||||
|
if (OB_ISNULL(key_buf = allocator_->alloc(sizeof(ObDatumRowkey)))) {
|
||||||
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
|
LOG_WARN("allocate memory failed", K(ret), K(sizeof(ObDatumRowkey)));
|
||||||
|
} else if (FALSE_IT(endkey_ = new (key_buf) ObDatumRowkey())) {
|
||||||
|
} else if (OB_FAIL(endkey->deep_copy(*endkey_, allocator))) {
|
||||||
|
LOG_WARN("fail to deep copy rowkey", K(ret), KPC(endkey_), KPC(endkey));
|
||||||
|
}
|
||||||
|
|
||||||
void *header_buf = nullptr;
|
void *header_buf = nullptr;
|
||||||
if (OB_ISNULL(header_buf = allocator_->alloc(sizeof(ObIndexBlockRowHeader)))) {
|
if (OB_ISNULL(header_buf = allocator_->alloc(sizeof(ObIndexBlockRowHeader)))) {
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
@ -86,9 +94,13 @@ int ObMicroIndexRowItem::init(ObIAllocator &allocator,
|
|||||||
void ObMicroIndexRowItem::reset()
|
void ObMicroIndexRowItem::reset()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
endkey_ = nullptr;
|
|
||||||
agg_buf_size_ = 0;
|
agg_buf_size_ = 0;
|
||||||
if (OB_NOT_NULL(allocator_)) {
|
if (OB_NOT_NULL(allocator_)) {
|
||||||
|
if (OB_NOT_NULL(endkey_)){
|
||||||
|
endkey_->~ObDatumRowkey();
|
||||||
|
allocator_->free(endkey_);
|
||||||
|
endkey_ = nullptr;
|
||||||
|
}
|
||||||
if (OB_NOT_NULL(idx_row_header_)){
|
if (OB_NOT_NULL(idx_row_header_)){
|
||||||
idx_row_header_->~ObIndexBlockRowHeader();
|
idx_row_header_->~ObIndexBlockRowHeader();
|
||||||
allocator_->free(idx_row_header_);
|
allocator_->free(idx_row_header_);
|
||||||
@ -107,6 +119,17 @@ void ObMicroIndexRowItem::reset()
|
|||||||
allocator_ = nullptr;
|
allocator_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObMicroIndexRowItem::reuse()
|
||||||
|
{
|
||||||
|
int ret = OB_SUCCESS;
|
||||||
|
endkey_ = nullptr;
|
||||||
|
agg_buf_size_ = 0;
|
||||||
|
idx_row_header_ = nullptr;
|
||||||
|
idx_minor_info_ = nullptr;
|
||||||
|
agg_row_buf_ = nullptr;
|
||||||
|
allocator_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
ObIndexBlockMacroIterator::ObIndexBlockMacroIterator()
|
ObIndexBlockMacroIterator::ObIndexBlockMacroIterator()
|
||||||
: sstable_(nullptr), iter_range_(nullptr),
|
: sstable_(nullptr), iter_range_(nullptr),
|
||||||
tree_cursor_(), allocator_(nullptr),
|
tree_cursor_(), allocator_(nullptr),
|
||||||
@ -361,8 +384,7 @@ int ObIndexBlockMacroIterator::get_next_idx_row(ObIAllocator &item_allocator, Ob
|
|||||||
LOG_WARN("Fail to get current endkey", K(ret), K_(tree_cursor));
|
LOG_WARN("Fail to get current endkey", K(ret), K_(tree_cursor));
|
||||||
} else if (OB_FAIL(deep_copy_rowkey(rowkey, curr_key_, curr_key_buf_))) {
|
} else if (OB_FAIL(deep_copy_rowkey(rowkey, curr_key_, curr_key_buf_))) {
|
||||||
STORAGE_LOG(WARN, "Failed to save curr key", K(ret), K(rowkey));
|
STORAGE_LOG(WARN, "Failed to save curr key", K(ret), K(rowkey));
|
||||||
} else if (FALSE_IT(macro_index_item.reset())) {
|
} else if (FALSE_IT(macro_index_item.reuse())) {
|
||||||
} else if (FALSE_IT(item_allocator.reuse())) {
|
|
||||||
} else if (OB_FAIL(macro_index_item.init(item_allocator, idx_row_header, &curr_key_, minor_meta_info, agg_row_buf, agg_buf_size))) {
|
} else if (OB_FAIL(macro_index_item.init(item_allocator, idx_row_header, &curr_key_, minor_meta_info, agg_row_buf, agg_buf_size))) {
|
||||||
STORAGE_LOG(WARN, "Failed to init macro index item", K(ret), K(macro_index_item));
|
STORAGE_LOG(WARN, "Failed to init macro index item", K(ret), K(macro_index_item));
|
||||||
} else if (OB_FAIL(tree_cursor_.move_forward(is_reverse_scan_))) {
|
} else if (OB_FAIL(tree_cursor_.move_forward(is_reverse_scan_))) {
|
||||||
|
@ -80,11 +80,12 @@ public:
|
|||||||
const char *agg_row_buf,
|
const char *agg_row_buf,
|
||||||
const int64_t agg_buf_size);
|
const int64_t agg_buf_size);
|
||||||
void reset();
|
void reset();
|
||||||
|
void reuse();
|
||||||
TO_STRING_KV(KPC(idx_row_header_), KPC(endkey_), KPC(idx_minor_info_), K(agg_row_buf_), K(agg_buf_size_), KP(allocator_));
|
TO_STRING_KV(KPC(idx_row_header_), KPC(endkey_), KPC(idx_minor_info_), K(agg_row_buf_), K(agg_buf_size_), KP(allocator_));
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ObIAllocator *allocator_;
|
ObIAllocator *allocator_;
|
||||||
const blocksstable::ObDatumRowkey *endkey_;
|
blocksstable::ObDatumRowkey *endkey_;
|
||||||
ObIndexBlockRowHeader *idx_row_header_;
|
ObIndexBlockRowHeader *idx_row_header_;
|
||||||
ObIndexBlockRowMinorMetaInfo *idx_minor_info_;
|
ObIndexBlockRowMinorMetaInfo *idx_minor_info_;
|
||||||
char *agg_row_buf_; //max 1024
|
char *agg_row_buf_; //max 1024
|
||||||
|
Reference in New Issue
Block a user