to issue<51908205>:fix refcursor core
This commit is contained in:
@ -2224,13 +2224,19 @@ int ObPLCursorInfo::prepare_spi_result(ObPLExecCtx *ctx, ObSPIResultSet *&spi_re
|
|||||||
CK (OB_NOT_NULL(ctx));
|
CK (OB_NOT_NULL(ctx));
|
||||||
CK (OB_NOT_NULL(ctx->exec_ctx_));
|
CK (OB_NOT_NULL(ctx->exec_ctx_));
|
||||||
CK (OB_NOT_NULL(ctx->exec_ctx_->get_my_session()));
|
CK (OB_NOT_NULL(ctx->exec_ctx_->get_my_session()));
|
||||||
if (OB_ISNULL(spi_cursor_)) {
|
if (OB_ISNULL(spi_cursor_) || !last_stream_cursor_) {
|
||||||
OV (OB_NOT_NULL(get_allocator()));
|
OV (OB_NOT_NULL(get_allocator()));
|
||||||
|
if (OB_SUCC(ret) && OB_NOT_NULL(spi_cursor_) && OB_NOT_NULL(static_cast<ObSPICursor*>(spi_cursor_))) {
|
||||||
|
static_cast<ObSPICursor*>(spi_cursor_)->~ObSPICursor();
|
||||||
|
get_allocator()->free(spi_cursor_);
|
||||||
|
spi_cursor_ = NULL;
|
||||||
|
}
|
||||||
OX (spi_cursor_ = get_allocator()->alloc(sizeof(ObSPIResultSet)));
|
OX (spi_cursor_ = get_allocator()->alloc(sizeof(ObSPIResultSet)));
|
||||||
OV (OB_NOT_NULL(spi_cursor_), OB_ALLOCATE_MEMORY_FAILED);
|
OV (OB_NOT_NULL(spi_cursor_), OB_ALLOCATE_MEMORY_FAILED);
|
||||||
}
|
}
|
||||||
OX (spi_result = new (spi_cursor_) ObSPIResultSet());
|
OX (spi_result = new (spi_cursor_) ObSPIResultSet());
|
||||||
OZ (spi_result->init(*ctx->exec_ctx_->get_my_session()));
|
OZ (spi_result->init(*ctx->exec_ctx_->get_my_session()));
|
||||||
|
OX (last_stream_cursor_ = true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2252,6 +2258,7 @@ int ObPLCursorInfo::prepare_spi_cursor(ObSPICursor *&spi_cursor,
|
|||||||
OV (OB_NOT_NULL(spi_cursor_), OB_ALLOCATE_MEMORY_FAILED);
|
OV (OB_NOT_NULL(spi_cursor_), OB_ALLOCATE_MEMORY_FAILED);
|
||||||
}
|
}
|
||||||
OX (spi_cursor = new (spi_cursor_) ObSPICursor(*spi_allocator));
|
OX (spi_cursor = new (spi_cursor_) ObSPICursor(*spi_allocator));
|
||||||
|
OX (last_stream_cursor_ = false);
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
if (OB_INVALID_SIZE == mem_limit) {
|
if (OB_INVALID_SIZE == mem_limit) {
|
||||||
mem_limit = GCONF._chunk_row_store_mem_limit;
|
mem_limit = GCONF._chunk_row_store_mem_limit;
|
||||||
|
|||||||
@ -778,7 +778,8 @@ public:
|
|||||||
cursor_flag_(CURSOR_FLAG_UNDEF),
|
cursor_flag_(CURSOR_FLAG_UNDEF),
|
||||||
ref_count_(0),
|
ref_count_(0),
|
||||||
is_scrollable_(false),
|
is_scrollable_(false),
|
||||||
last_execute_time_(0)
|
last_execute_time_(0),
|
||||||
|
last_stream_cursor_(false)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@ -796,7 +797,8 @@ public:
|
|||||||
is_scrollable_(false),
|
is_scrollable_(false),
|
||||||
snapshot_(),
|
snapshot_(),
|
||||||
is_need_check_snapshot_(false),
|
is_need_check_snapshot_(false),
|
||||||
last_execute_time_(0)
|
last_execute_time_(0),
|
||||||
|
last_stream_cursor_(false)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@ -1043,6 +1045,7 @@ protected:
|
|||||||
transaction::ObTxReadSnapshot snapshot_;
|
transaction::ObTxReadSnapshot snapshot_;
|
||||||
bool is_need_check_snapshot_;
|
bool is_need_check_snapshot_;
|
||||||
int64_t last_execute_time_; // 记录上一次cursor操作的时间点
|
int64_t last_execute_time_; // 记录上一次cursor操作的时间点
|
||||||
|
bool last_stream_cursor_; // cursor复用场景下,记录上一次是否是流式cursor
|
||||||
};
|
};
|
||||||
|
|
||||||
class ObPLGetCursorAttrInfo
|
class ObPLGetCursorAttrInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user