Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dbcon/mysql/ha_mcs_partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 2 additions & 16 deletions dbcon/mysql/is_columnstore_extents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
2 changes: 1 addition & 1 deletion dbcon/mysql/is_columnstore_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions versioning/BRM/dbrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions versioning/BRM/extentmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions versioning/BRM/mastersegmenttable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down