Fix direct load data buffer members inconsistent lifecycle
This commit is contained in:
@ -484,7 +484,7 @@ int ObLoadDataDirectImpl::DataDescIterator::get_next_data_desc(DataDesc &data_de
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ObLoadDataDirectImpl::DataBuffer::DataBuffer()
|
ObLoadDataDirectImpl::DataBuffer::DataBuffer()
|
||||||
: allocator_("MTL_DataBuffer"), file_buffer_(nullptr), pos_(0), is_end_file_(false)
|
: file_buffer_(nullptr), pos_(0), is_end_file_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,10 +506,10 @@ void ObLoadDataDirectImpl::DataBuffer::reset()
|
|||||||
{
|
{
|
||||||
if (nullptr != file_buffer_) {
|
if (nullptr != file_buffer_) {
|
||||||
file_buffer_->~ObLoadFileBuffer();
|
file_buffer_->~ObLoadFileBuffer();
|
||||||
|
ob_free(file_buffer_);
|
||||||
file_buffer_ = nullptr;
|
file_buffer_ = nullptr;
|
||||||
}
|
}
|
||||||
pos_ = 0;
|
pos_ = 0;
|
||||||
allocator_.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObLoadDataDirectImpl::DataBuffer::init(int64_t capacity)
|
int ObLoadDataDirectImpl::DataBuffer::init(int64_t capacity)
|
||||||
@ -524,9 +524,9 @@ int ObLoadDataDirectImpl::DataBuffer::init(int64_t capacity)
|
|||||||
} else {
|
} else {
|
||||||
const int64_t alloc_size =
|
const int64_t alloc_size =
|
||||||
MIN(capacity + sizeof(ObLoadFileBuffer), ObLoadFileBuffer::MAX_BUFFER_SIZE);
|
MIN(capacity + sizeof(ObLoadFileBuffer), ObLoadFileBuffer::MAX_BUFFER_SIZE);
|
||||||
allocator_.set_tenant_id(MTL_ID());
|
ObMemAttr attr(MTL_ID(), "MTL_DataBuffer");
|
||||||
void *buf = nullptr;
|
void *buf = nullptr;
|
||||||
if (OB_ISNULL(buf = allocator_.alloc(alloc_size))) {
|
if (OB_ISNULL(buf = ob_malloc(alloc_size, attr))) {
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
LOG_WARN("fail to allocate memory", KR(ret), K(alloc_size));
|
LOG_WARN("fail to allocate memory", KR(ret), K(alloc_size));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -229,8 +229,6 @@ private:
|
|||||||
int squash();
|
int squash();
|
||||||
void swap(DataBuffer &other);
|
void swap(DataBuffer &other);
|
||||||
TO_STRING_KV(KPC_(file_buffer), K_(pos));
|
TO_STRING_KV(KPC_(file_buffer), K_(pos));
|
||||||
private:
|
|
||||||
common::ObArenaAllocator allocator_;
|
|
||||||
public:
|
public:
|
||||||
ObLoadFileBuffer *file_buffer_;
|
ObLoadFileBuffer *file_buffer_;
|
||||||
int64_t pos_; // left pos
|
int64_t pos_; // left pos
|
||||||
|
|||||||
Reference in New Issue
Block a user