Skip to content

Commit c962f92

Browse files
hanweimy-ship-it
authored andcommitted
Fix dangling pointer issue when mix data from diffrent ORCA caches
When execute many sql statements in a session, it maybe panic. Cause a kind of cache will refer another cache, but another cache's entries will be evicted over time and lead to dangling pointer. So deep copy is sometimes neccesary.
1 parent 9193e63 commit c962f92

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/gpopt/translate/CTranslatorScalarToDXL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ CTranslatorScalarToDXL::CreateScalarCmpFromOpExpr(
542542
const CWStringConst *str = GetDXLArrayCmpType(mdid);
543543

544544
CDXLScalarComp *dxlop = GPOS_NEW(m_mp) CDXLScalarComp(
545-
m_mp, mdid, GPOS_NEW(m_mp) CWStringConst(str->GetBuffer()));
545+
m_mp, mdid, GPOS_NEW(m_mp) CWStringConst(m_mp, str->GetBuffer()));
546546

547547
// create the DXL node holding the scalar comparison operator
548548
CDXLNode *dxlnode = GPOS_NEW(m_mp) CDXLNode(m_mp, dxlop);
@@ -592,7 +592,7 @@ CTranslatorScalarToDXL::TranslateOpExprToDXL(
592592

593593
CDXLScalarOpExpr *dxlop = GPOS_NEW(m_mp)
594594
CDXLScalarOpExpr(m_mp, mdid, return_type_mdid,
595-
GPOS_NEW(m_mp) CWStringConst(str->GetBuffer()));
595+
GPOS_NEW(m_mp) CWStringConst(m_mp, str->GetBuffer()));
596596

597597
// create the DXL node holding the scalar opexpr
598598
CDXLNode *dxlnode = GPOS_NEW(m_mp) CDXLNode(m_mp, dxlop);
@@ -702,7 +702,7 @@ CTranslatorScalarToDXL::CreateScalarArrayCompFromExpr(
702702
m_mp,
703703
GPOS_NEW(m_mp)
704704
CMDIdGPDB(IMDId::EmdidGeneral, scalar_array_op_expr->opno),
705-
GPOS_NEW(m_mp) CWStringConst(op_name->GetBuffer()), type);
705+
GPOS_NEW(m_mp) CWStringConst(m_mp, op_name->GetBuffer()), type);
706706

707707
// create the DXL node holding the scalar opexpr
708708
CDXLNode *dxlnode = GPOS_NEW(m_mp) CDXLNode(m_mp, dxlop);

0 commit comments

Comments
 (0)