You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +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
|
||||
{
|
||||
// Sending down current Managed Shmem size. If EMIndexImpl instance size doesn't match
|
||||
// fEMIndexShminfo->allocdSize makeExtentMapIndexImpl will remap managed shmem segment.
|
||||
fPExtMapIndexImpl_ =
|
||||
ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(), fEMIndexShminfo->allocdSize);
|
||||
if (op == READ)
|
||||
{
|
||||
fMST.getTable_upgrade(MasterSegmentTable::EMIndex);
|
||||
emIndexLocked = true;
|
||||
|
||||
if (r_only)
|
||||
fPExtMapIndexImpl_->makeReadOnly();
|
||||
// Sending down current Managed Shmem size. If EMIndexImpl instance size doesn't match
|
||||
// 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)
|
||||
{
|
||||
fPExtMapIndexImpl_->refreshShm();
|
||||
fPExtMapIndexImpl_ =
|
||||
ExtentMapIndexImpl::makeExtentMapIndexImpl(getInitialEMIndexShmkey(), fEMIndexShminfo->allocdSize);
|
||||
if (op == READ)
|
||||
{
|
||||
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_)
|
||||
{
|
||||
// effectively umpas a mapped managed shmem segment changing the segment VA address
|
||||
// when mapped next time.
|
||||
delete fInstance_;
|
||||
fInstance_ = nullptr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user