[CP] fix memtable reference leaks due to not deconstruct lob cursor

This commit is contained in:
shadowao
2024-04-17 07:39:02 +00:00
committed by ob-robot
parent a5745e5c20
commit 6570b1eb6c
4 changed files with 49 additions and 0 deletions

View File

@ -331,6 +331,9 @@ int ObJsonExprHelper::get_json_for_partial_update(
} else {
j_base = delta_lob.get_json_bin();
}
if (OB_FAIL(ret)) {
delta_lob.reset();
}
} else if (! locator.is_persist_lob() || locator.is_inrow()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("persis lob or no-delta inrow lob locator not support", KR(ret), K(locator));
@ -364,6 +367,17 @@ int ObJsonExprHelper::get_json_for_partial_update(
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get j_base is null", KR(ret), K(locator));
}
if (OB_FAIL(ret)) {
if (OB_NOT_NULL(j_base)) {
j_base->reset();
j_base = nullptr;
}
if (OB_NOT_NULL(cursor)) {
cursor->reset();
cursor = nullptr;
}
}
return ret;
}
@ -2615,6 +2629,26 @@ int ObJsonDeltaLob::init(ObIAllocator *allocator, ObLobLocatorV2 locator, int64_
return ret;
}
void ObJsonDeltaLob::reset()
{
if (OB_NOT_NULL(j_base_)) {
j_base_->reset();
j_base_ = nullptr;
}
if (OB_NOT_NULL(update_ctx_)) {
update_ctx_->~ObJsonBinUpdateCtx();
update_ctx_ = nullptr;
}
if (OB_NOT_NULL(cursor_)) {
cursor_->~ObLobCursor();
cursor_ = nullptr;
}
if (OB_NOT_NULL(partial_data_)) {
partial_data_->~ObLobPartialData();
partial_data_ = nullptr;
}
}
int64_t ObJsonDeltaLob::get_lob_diff_serialize_size() const
{
int64_t len = 0;

View File

@ -490,6 +490,7 @@ public:
int init(ObJsonBin *j_bin);
int init(ObIAllocator *allocator, ObLobLocatorV2 locator, int64_t query_timeout_ts);
void reset();
int64_t get_partial_data_serialize_size() const;
int64_t get_lob_diff_serialize_size() const;