patch 4.0
This commit is contained in:
@ -21,6 +21,7 @@ using namespace common;
|
||||
using namespace join;
|
||||
using namespace blocksstable;
|
||||
|
||||
|
||||
ObHJBatch::~ObHJBatch()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -41,7 +42,7 @@ int ObHJBatch::load_next_chunk()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(chunk_iter_.load_next_chunk(row_store_iter_))) {
|
||||
LOG_WARN("failed to load next chunk", K(ret));
|
||||
LOG_WARN("faild to load next chunk", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -70,37 +71,37 @@ int ObHJBatch::dump(bool all_dump)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObHJBatch::add_row(const common::ObNewRow& row, ObStoredJoinRow*& stored_row)
|
||||
int ObHJBatch::add_row(const common::ObNewRow &row, ObStoredJoinRow *&stored_row)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObChunkRowStore::StoredRow* hash_store_row = nullptr;
|
||||
ObChunkRowStore::StoredRow *hash_store_row = nullptr;
|
||||
if (OB_FAIL(chunk_row_store_.add_row(row, &hash_store_row))) {
|
||||
LOG_WARN("failed to add row", K(ret));
|
||||
} else {
|
||||
stored_row = static_cast<ObStoredJoinRow*>(hash_store_row);
|
||||
stored_row = static_cast<ObStoredJoinRow *>(hash_store_row);
|
||||
++n_add_rows_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObHJBatch::convert_row(const common::ObNewRow*& row, const ObStoredJoinRow*& stored_row)
|
||||
int ObHJBatch::convert_row(const common::ObNewRow *&row, const ObStoredJoinRow *&stored_row)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObNewRow* inner_row = nullptr;
|
||||
ObNewRow *inner_row = nullptr;
|
||||
if (OB_FAIL(row_store_iter_.convert_to_row_full(inner_row, stored_row))) {
|
||||
LOG_WARN("failed to convert row", K(ret));
|
||||
} else {
|
||||
row = static_cast<const ObNewRow*>(inner_row);
|
||||
row = static_cast<const ObNewRow *>(inner_row);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObHJBatch::get_next_row(const common::ObNewRow*& row, const ObStoredJoinRow*& stored_row)
|
||||
int ObHJBatch::get_next_row(const common::ObNewRow *&row, const ObStoredJoinRow *&stored_row)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
stored_row = nullptr;
|
||||
row = nullptr;
|
||||
const ObChunkRowStore::StoredRow* inner_stored_row = nullptr;
|
||||
const ObChunkRowStore::StoredRow *inner_stored_row = nullptr;
|
||||
while (OB_SUCC(ret) && nullptr == inner_stored_row) {
|
||||
if (OB_FAIL(row_store_iter_.get_next_row(inner_stored_row))) {
|
||||
if (OB_ITER_END != ret) {
|
||||
@ -112,19 +113,15 @@ int ObHJBatch::get_next_row(const common::ObNewRow*& row, const ObStoredJoinRow*
|
||||
LOG_WARN("failed to get next row", K(ret));
|
||||
} else if (n_get_rows_ != chunk_row_store_.get_row_cnt()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("Got row count is not match with row count of chunk row store",
|
||||
K(ret),
|
||||
K(n_get_rows_),
|
||||
K(chunk_row_store_.get_row_cnt()));
|
||||
LOG_WARN("Got row count is not match with row count of chunk row store", K(ret), K(n_get_rows_), K(chunk_row_store_.get_row_cnt()));
|
||||
} else {
|
||||
// LOG_TRACE("trace get row count", K(part_level_), K(batchno_), K(ret), K(n_get_rows_),
|
||||
// K(chunk_row_store_.get_row_cnt()));
|
||||
// LOG_TRACE("trace get row count", K(part_level_), K(batchno_), K(ret), K(n_get_rows_), K(chunk_row_store_.get_row_cnt()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
++n_get_rows_;
|
||||
stored_row = static_cast<const ObStoredJoinRow*>(inner_stored_row);
|
||||
stored_row = static_cast<const ObStoredJoinRow *>(inner_stored_row);
|
||||
if (OB_FAIL(convert_row(row, stored_row))) {
|
||||
LOG_WARN("failed to convert row", K(ret));
|
||||
}
|
||||
@ -133,11 +130,11 @@ int ObHJBatch::get_next_row(const common::ObNewRow*& row, const ObStoredJoinRow*
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObHJBatch::get_next_row(const ObStoredJoinRow*& stored_row)
|
||||
int ObHJBatch::get_next_row(const ObStoredJoinRow *&stored_row)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
stored_row = nullptr;
|
||||
const ObChunkRowStore::StoredRow* inner_stored_row = nullptr;
|
||||
const ObChunkRowStore::StoredRow *inner_stored_row = nullptr;
|
||||
while (OB_SUCC(ret) && nullptr == inner_stored_row) {
|
||||
if (OB_FAIL(row_store_iter_.get_next_row(inner_stored_row))) {
|
||||
if (OB_ITER_END != ret) {
|
||||
@ -149,28 +146,21 @@ int ObHJBatch::get_next_row(const ObStoredJoinRow*& stored_row)
|
||||
LOG_WARN("failed to get next row", K(ret));
|
||||
} else if (n_get_rows_ != chunk_row_store_.get_row_cnt()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("Got row count is not match with row count of chunk row store",
|
||||
K(ret),
|
||||
K(n_get_rows_),
|
||||
K(chunk_row_store_.get_row_cnt()));
|
||||
LOG_WARN("Got row count is not match with row count of chunk row store", K(ret), K(n_get_rows_), K(chunk_row_store_.get_row_cnt()));
|
||||
} else {
|
||||
LOG_TRACE("trace get row count",
|
||||
K(part_level_),
|
||||
K(batchno_),
|
||||
K(ret),
|
||||
K(n_get_rows_),
|
||||
K(chunk_row_store_.get_row_cnt()));
|
||||
LOG_TRACE("trace get row count", K(part_level_), K(batchno_), K(ret), K(n_get_rows_), K(chunk_row_store_.get_row_cnt()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
++n_get_rows_;
|
||||
stored_row = static_cast<const ObStoredJoinRow*>(inner_stored_row);
|
||||
stored_row = static_cast<const ObStoredJoinRow *>(inner_stored_row);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 可能会读多次,所以每次都应该set iterator,同时reset
|
||||
int ObHJBatch::set_iterator(bool is_chunk_iter)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -181,6 +171,7 @@ int ObHJBatch::set_iterator(bool is_chunk_iter)
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("buf_mgr_ is null", K(ret));
|
||||
} else if (is_chunk_iter) {
|
||||
// 上层逻辑手动调load_next_chunk来驱动获取一批数据
|
||||
chunk_size = buf_mgr_->get_reserve_memory_size();
|
||||
if (buf_mgr_->get_reserve_memory_size() > chunk_row_store_.get_mem_used() + chunk_row_store_.get_file_size()) {
|
||||
chunk_size = chunk_row_store_.get_mem_used() + chunk_row_store_.get_file_size();
|
||||
@ -208,13 +199,10 @@ int ObHJBatch::set_iterator(bool is_chunk_iter)
|
||||
int ObHJBatch::init()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(chunk_row_store_.init(0,
|
||||
tenant_id_,
|
||||
common::ObCtxIds::WORK_AREA,
|
||||
common::ObModIds::OB_ARENA_HASH_JOIN,
|
||||
true,
|
||||
ObChunkRowStore::STORE_MODE::FULL,
|
||||
8))) {
|
||||
if (OB_FAIL(chunk_row_store_.init(0, tenant_id_,
|
||||
common::ObCtxIds::WORK_AREA,
|
||||
common::ObModIds::OB_ARENA_HASH_JOIN,
|
||||
true, ObChunkRowStore::STORE_MODE::FULL, 8))) {
|
||||
LOG_WARN("failed to init chunk row store", K(ret));
|
||||
} else {
|
||||
chunk_row_store_.set_callback(buf_mgr_);
|
||||
@ -236,3 +224,5 @@ int ObHJBatch::close()
|
||||
buf_mgr_ = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user