1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00

fix(BRM): MCOL-5879 DBRM::clearShm runs crit sections w/o sync mechanism (#3390)

This commit is contained in:
drrtuy 2025-02-20 16:33:28 +00:00 committed by GitHub
parent c0fade0c55
commit 6001db44ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 24 deletions

View File

@ -330,7 +330,7 @@ void partitionByValue_common(UDF_ARGS* args, // inp
string functionName) // input
{
// identify partitions by the range
BRM::DBRM::refreshShm();
BRM::DBRM::refreshShmWithLock();
DBRM em;
vector<struct EMEntry> entries;
vector<struct EMEntry>::iterator iter;
@ -575,7 +575,7 @@ extern "C"
const char* calshowpartitions(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
char* is_null, char* error)
{
BRM::DBRM::refreshShm();
BRM::DBRM::refreshShmWithLock();
DBRM em;
vector<struct EMEntry> entries;
vector<struct EMEntry>::iterator iter;
@ -1170,7 +1170,7 @@ extern "C"
const char* calshowpartitionsbyvalue(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
char* is_null, char* error)
{
BRM::DBRM::refreshShm();
BRM::DBRM::refreshShmWithLock();
DBRM em;
vector<struct EMEntry> entries;
vector<struct EMEntry>::iterator iter;

View File

@ -196,27 +196,13 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
return 0;
}
struct refresher
{
BRM::DBRM* guarded;
refresher()
{
guarded = new BRM::DBRM();
}
~refresher()
{
delete guarded;
BRM::DBRM::refreshShm();
}
};
static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
{
BRM::OID_t cond_oid = 0;
TABLE* table = tables->table;
BRM::DBRM* emp;
refresher shmRefresher;
emp = shmRefresher.guarded;
BRM::DBRM::refreshShmWithLock();
BRM::DBRM* emp = new BRM::DBRM();
if (!emp || !emp->isDBRMReady())
{

View File

@ -215,7 +215,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
{
BRM::DBRM::refreshShm();
BRM::DBRM::refreshShmWithLock();
BRM::DBRM* emp = new BRM::DBRM();
BRM::OID_t cond_oid = 0;
TABLE* table = tables->table;

View File

@ -101,11 +101,11 @@ class DBRM
EXPORT DBRM(bool noBRMFcns = false);
EXPORT ~DBRM();
EXPORT static void refreshShm()
static void refreshShmWithLock()
{
MasterSegmentTableImpl::refreshShm();
ExtentMapRBTreeImpl::refreshShm();
FreeListImpl::refreshShm();
MasterSegmentTableImpl::refreshShmWithLock();
ExtentMapRBTreeImpl::refreshShmWithLock();
FreeListImpl::refreshShmWithLock();
}
// @bug 1055+ - Added functions below for multiple files per OID enhancement.

View File

@ -265,6 +265,12 @@ class ExtentMapRBTreeImpl
static ExtentMapRBTreeImpl* makeExtentMapRBTreeImpl(unsigned key, off_t size, bool readOnly = false);
static void refreshShmWithLock()
{
boost::mutex::scoped_lock lk(fInstanceMutex);
return refreshShm();
}
static void refreshShm()
{
if (fInstance)
@ -317,6 +323,13 @@ class FreeListImpl
~FreeListImpl(){};
static FreeListImpl* makeFreeListImpl(unsigned key, off_t size, bool readOnly = false);
static void refreshShmWithLock()
{
boost::mutex::scoped_lock lk(fInstanceMutex);
return refreshShm();
}
static void refreshShm()
{
if (fInstance)

View File

@ -61,6 +61,12 @@ class MasterSegmentTableImpl
~MasterSegmentTableImpl(){};
static MasterSegmentTableImpl* makeMasterSegmentTableImpl(int key, int size);
static void refreshShmWithLock()
{
boost::mutex::scoped_lock lk(fInstanceMutex);
return refreshShm();
}
static void refreshShm()
{
if (fInstance)