You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
fix(extent-map): MCOL-5559 This patch extends the scope of the crit section to cover remap operation to avoid access races running EMIndex operations
This commit is contained in:
@ -2080,20 +2080,54 @@ void ExtentMap::grabEMIndex(OPS op)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Sending down current Managed Shmem size. If EMIndexImpl instance size doesn't match
|
if (op == READ)
|
||||||
// fEMIndexShminfo->allocdSize makeExtentMapIndexImpl will remap managed shmem segment.
|
{
|
||||||
fPExtMapIndexImpl_ =
|
fMST.getTable_upgrade(MasterSegmentTable::EMIndex);
|
||||||
ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(), fEMIndexShminfo->allocdSize);
|
emIndexLocked = true;
|
||||||
|
|
||||||
if (r_only)
|
// Sending down current Managed Shmem size. If EMIndexImpl instance size doesn't match
|
||||||
fPExtMapIndexImpl_->makeReadOnly();
|
// fEMIndexShminfo->allocdSize makeExtentMapIndexImpl will remap managed shmem segment.
|
||||||
|
fPExtMapIndexImpl_ = ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(),
|
||||||
|
fEMIndexShminfo->allocdSize);
|
||||||
|
|
||||||
|
if (r_only)
|
||||||
|
fPExtMapIndexImpl_->makeReadOnly();
|
||||||
|
|
||||||
|
emIndexLocked = false;
|
||||||
|
fMST.getTable_downgrade(MasterSegmentTable::EMIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fPExtMapIndexImpl_ = ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(),
|
||||||
|
fEMIndexShminfo->allocdSize);
|
||||||
|
|
||||||
|
if (r_only)
|
||||||
|
fPExtMapIndexImpl_->makeReadOnly();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fPExtMapIndexImpl_->getShmemImplSize() != (unsigned)fEMIndexShminfo->allocdSize)
|
else if (fPExtMapIndexImpl_->getShmemImplSize() != (unsigned)fEMIndexShminfo->allocdSize)
|
||||||
{
|
{
|
||||||
fPExtMapIndexImpl_->refreshShm();
|
if (op == READ)
|
||||||
fPExtMapIndexImpl_ =
|
{
|
||||||
ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(), fEMIndexShminfo->allocdSize);
|
fMST.getTable_upgrade(MasterSegmentTable::EMIndex);
|
||||||
|
emIndexLocked = true;
|
||||||
|
|
||||||
|
fPExtMapIndexImpl_->refreshShm();
|
||||||
|
|
||||||
|
fPExtMapIndexImpl_ =
|
||||||
|
ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(), fEMIndexShminfo->allocdSize);
|
||||||
|
|
||||||
|
emIndexLocked = false;
|
||||||
|
fMST.getTable_downgrade(MasterSegmentTable::EMIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fPExtMapIndexImpl_->refreshShm();
|
||||||
|
|
||||||
|
fPExtMapIndexImpl_ =
|
||||||
|
ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(), fEMIndexShminfo->allocdSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,6 +372,8 @@ class ExtentMapIndexImpl
|
|||||||
{
|
{
|
||||||
if (fInstance_)
|
if (fInstance_)
|
||||||
{
|
{
|
||||||
|
// effectively umpas a mapped managed shmem segment changing the segment VA address
|
||||||
|
// when mapped next time.
|
||||||
delete fInstance_;
|
delete fInstance_;
|
||||||
fInstance_ = nullptr;
|
fInstance_ = nullptr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user