You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-10-30 07:25:34 +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:
@@ -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