You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-10-28 19:54:55 +03:00
fix(CEJ, segfault): MCOL-6198 - segfault during crossengine join
* fix(CEJ, segfault): MCOL-6198 - segfault during crossengine join The patch moves joiners' initialization to a place after all possible allocations of smallSideRGs vector so pointer to it's data does not change anymore. This makes crash to cease. An appropriate test is added to bugfixes suite. * Change to test * Another dangling pointer * A change to test * A change to test
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
DROP DATABASE IF EXISTS MCOL_6198;
|
||||
CREATE DATABASE MCOL_6198;
|
||||
SELECT
|
||||
v.c36 AS hst,
|
||||
m.p6 AS g,
|
||||
COALESCE(g0.eg_id,'MARIA') AS g01,
|
||||
COALESCE(g1.eg_id,'MARIA') AS g02,
|
||||
SUM(v.c758 * m.p42 / 100 + v.c759 * m.p42 / 100 + v.c760 * m.p42 / 100) AS sval
|
||||
FROM
|
||||
c AS v
|
||||
JOIN p m on (v.c4 = m.a4)
|
||||
LEFT OUTER JOIN group_g01 AS g0 ON g0.key_id=m.p6
|
||||
LEFT OUTER JOIN group_g02 AS g1 ON g1.key_id=m.p6
|
||||
WHERE
|
||||
1=1
|
||||
GROUP BY c36,p6,g01,g02;
|
||||
DROP DATABASE MCOL_6198;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -72,6 +72,24 @@ using namespace logging;
|
||||
using namespace utils;
|
||||
using namespace joblist;
|
||||
|
||||
#define idblog(x) \
|
||||
do \
|
||||
{ \
|
||||
{ \
|
||||
std::ostringstream os; \
|
||||
\
|
||||
os << __FILE__ << "@" << __LINE__ << ": \'" << x << "\'"; \
|
||||
std::cerr << os.str() << std::endl; \
|
||||
logging::MessageLog logger((logging::LoggingID())); \
|
||||
logging::Message message; \
|
||||
logging::Message::Args args; \
|
||||
\
|
||||
args.add(os.str()); \
|
||||
message.format(args); \
|
||||
logger.logErrorMessage(message); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
namespace primitiveprocessor
|
||||
{
|
||||
#ifdef PRIMPROC_STOPWATCH
|
||||
@@ -386,15 +404,6 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs)
|
||||
smallSideRGRecvd = true;
|
||||
}
|
||||
|
||||
for (uint j = 0; j < processorThreads; ++j)
|
||||
{
|
||||
auto tlHasher = TupleJoiner::TypelessDataHasher(&outputRG, &tlLargeSideKeyColumns[i],
|
||||
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
||||
auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i],
|
||||
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
||||
tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator,
|
||||
utils::STLPoolAllocator<TLJoiner::value_type>(resourceManager)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,6 +417,7 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs)
|
||||
{
|
||||
deserializeVector(bs, smallSideRGs);
|
||||
idbassert(smallSideRGs.size() == joinerCount);
|
||||
mSmallSideRGPtr = mSmallSideRGPtr ? &smallSideRGs[0] : nullptr;
|
||||
smallSideRowLengths.reset(new uint32_t[joinerCount]);
|
||||
smallSideRowData.reset(new RGData[joinerCount]);
|
||||
smallNullRowData.reset(new RGData[joinerCount]);
|
||||
@@ -438,6 +448,24 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs)
|
||||
bs >> largeSideRG;
|
||||
bs >> joinedRG;
|
||||
}
|
||||
|
||||
for (i = 0; i < joinerCount; i++)
|
||||
{
|
||||
if (!typelessJoin[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (uint j = 0; j < processorThreads; ++j)
|
||||
{
|
||||
auto tlHasher = TupleJoiner::TypelessDataHasher(&outputRG, &tlLargeSideKeyColumns[i],
|
||||
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
||||
auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i],
|
||||
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
||||
tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator,
|
||||
utils::STLPoolAllocator<TLJoiner::value_type>(resourceManager)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&objLock);
|
||||
@@ -2412,8 +2440,7 @@ SBPP BatchPrimitiveProcessor::duplicate()
|
||||
bpp->hasJoinFEFilters = hasJoinFEFilters;
|
||||
bpp->hasSmallOuterJoin = hasSmallOuterJoin;
|
||||
bpp->mJOINHasSkewedKeyColumn = mJOINHasSkewedKeyColumn;
|
||||
bpp->mSmallSideRGPtr = mSmallSideRGPtr;
|
||||
bpp->mSmallSideKeyColumnsPtr = mSmallSideKeyColumnsPtr;
|
||||
bpp->mSmallSideKeyColumnsPtr = &(*bpp->tlSmallSideKeyColumns);
|
||||
if (!getTupleJoinRowGroupData && mJOINHasSkewedKeyColumn)
|
||||
{
|
||||
idbassert(!smallSideRGs.empty());
|
||||
@@ -2440,6 +2467,7 @@ SBPP BatchPrimitiveProcessor::duplicate()
|
||||
bpp->smallNullPointers = smallNullPointers;
|
||||
bpp->joinedRG = joinedRG;
|
||||
}
|
||||
bpp->mSmallSideRGPtr = &bpp->smallSideRGs[0];
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
pthread_mutex_unlock(&bpp->objLock);
|
||||
|
||||
Reference in New Issue
Block a user