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(BRM): MCOL-5879 DBRM::clearShm runs crit sections w/o sync mechanism (#3390)
This commit is contained in:
@ -330,7 +330,7 @@ void partitionByValue_common(UDF_ARGS* args, // inp
|
|||||||
string functionName) // input
|
string functionName) // input
|
||||||
{
|
{
|
||||||
// identify partitions by the range
|
// identify partitions by the range
|
||||||
BRM::DBRM::refreshShm();
|
BRM::DBRM::refreshShmWithLock();
|
||||||
DBRM em;
|
DBRM em;
|
||||||
vector<struct EMEntry> entries;
|
vector<struct EMEntry> entries;
|
||||||
vector<struct EMEntry>::iterator iter;
|
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,
|
const char* calshowpartitions(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
||||||
char* is_null, char* error)
|
char* is_null, char* error)
|
||||||
{
|
{
|
||||||
BRM::DBRM::refreshShm();
|
BRM::DBRM::refreshShmWithLock();
|
||||||
DBRM em;
|
DBRM em;
|
||||||
vector<struct EMEntry> entries;
|
vector<struct EMEntry> entries;
|
||||||
vector<struct EMEntry>::iterator iter;
|
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,
|
const char* calshowpartitionsbyvalue(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
|
||||||
char* is_null, char* error)
|
char* is_null, char* error)
|
||||||
{
|
{
|
||||||
BRM::DBRM::refreshShm();
|
BRM::DBRM::refreshShmWithLock();
|
||||||
DBRM em;
|
DBRM em;
|
||||||
vector<struct EMEntry> entries;
|
vector<struct EMEntry> entries;
|
||||||
vector<struct EMEntry>::iterator iter;
|
vector<struct EMEntry>::iterator iter;
|
||||||
|
@ -196,27 +196,13 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
|
|||||||
return 0;
|
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)
|
static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||||
{
|
{
|
||||||
BRM::OID_t cond_oid = 0;
|
BRM::OID_t cond_oid = 0;
|
||||||
TABLE* table = tables->table;
|
TABLE* table = tables->table;
|
||||||
|
|
||||||
BRM::DBRM* emp;
|
BRM::DBRM::refreshShmWithLock();
|
||||||
refresher shmRefresher;
|
BRM::DBRM* emp = new BRM::DBRM();
|
||||||
emp = shmRefresher.guarded;
|
|
||||||
|
|
||||||
if (!emp || !emp->isDBRMReady())
|
if (!emp || !emp->isDBRMReady())
|
||||||
{
|
{
|
||||||
|
@ -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)
|
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::DBRM* emp = new BRM::DBRM();
|
||||||
BRM::OID_t cond_oid = 0;
|
BRM::OID_t cond_oid = 0;
|
||||||
TABLE* table = tables->table;
|
TABLE* table = tables->table;
|
||||||
|
@ -101,11 +101,11 @@ class DBRM
|
|||||||
EXPORT DBRM(bool noBRMFcns = false);
|
EXPORT DBRM(bool noBRMFcns = false);
|
||||||
EXPORT ~DBRM();
|
EXPORT ~DBRM();
|
||||||
|
|
||||||
EXPORT static void refreshShm()
|
static void refreshShmWithLock()
|
||||||
{
|
{
|
||||||
MasterSegmentTableImpl::refreshShm();
|
MasterSegmentTableImpl::refreshShmWithLock();
|
||||||
ExtentMapRBTreeImpl::refreshShm();
|
ExtentMapRBTreeImpl::refreshShmWithLock();
|
||||||
FreeListImpl::refreshShm();
|
FreeListImpl::refreshShmWithLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @bug 1055+ - Added functions below for multiple files per OID enhancement.
|
// @bug 1055+ - Added functions below for multiple files per OID enhancement.
|
||||||
|
@ -265,6 +265,12 @@ class ExtentMapRBTreeImpl
|
|||||||
|
|
||||||
static ExtentMapRBTreeImpl* makeExtentMapRBTreeImpl(unsigned key, off_t size, bool readOnly = false);
|
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()
|
static void refreshShm()
|
||||||
{
|
{
|
||||||
if (fInstance)
|
if (fInstance)
|
||||||
@ -317,6 +323,13 @@ class FreeListImpl
|
|||||||
~FreeListImpl(){};
|
~FreeListImpl(){};
|
||||||
|
|
||||||
static FreeListImpl* makeFreeListImpl(unsigned key, off_t size, bool readOnly = false);
|
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()
|
static void refreshShm()
|
||||||
{
|
{
|
||||||
if (fInstance)
|
if (fInstance)
|
||||||
|
@ -61,6 +61,12 @@ class MasterSegmentTableImpl
|
|||||||
~MasterSegmentTableImpl(){};
|
~MasterSegmentTableImpl(){};
|
||||||
static MasterSegmentTableImpl* makeMasterSegmentTableImpl(int key, int size);
|
static MasterSegmentTableImpl* makeMasterSegmentTableImpl(int key, int size);
|
||||||
|
|
||||||
|
static void refreshShmWithLock()
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lk(fInstanceMutex);
|
||||||
|
return refreshShm();
|
||||||
|
}
|
||||||
|
|
||||||
static void refreshShm()
|
static void refreshShm()
|
||||||
{
|
{
|
||||||
if (fInstance)
|
if (fInstance)
|
||||||
|
Reference in New Issue
Block a user