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
Atomic bools for RWLockMonitor
This commit is contained in:
@ -20,7 +20,7 @@
|
|||||||
* $Id: extentmap.cpp 1936 2013-07-09 22:10:29Z dhall $
|
* $Id: extentmap.cpp 1936 2013-07-09 22:10:29Z dhall $
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <atomic>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -6036,17 +6036,17 @@ void ExtentMap::confirmChangesRBTree()
|
|||||||
undoRecordsRBTree.clear();
|
undoRecordsRBTree.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* ExtentMap::getEMFLLockStatus()
|
const std::atomic<bool>* ExtentMap::getEMFLLockStatus()
|
||||||
{
|
{
|
||||||
return &flLocked;
|
return &flLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* ExtentMap::getEMLockStatus()
|
const std::atomic<bool>* ExtentMap::getEMLockStatus()
|
||||||
{
|
{
|
||||||
return &emLocked;
|
return &emLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* ExtentMap::getEMIndexLockStatus()
|
const std::atomic<bool>* ExtentMap::getEMIndexLockStatus()
|
||||||
{
|
{
|
||||||
return &emIndexLocked;
|
return &emIndexLocked;
|
||||||
}
|
}
|
||||||
|
@ -1035,9 +1035,9 @@ class ExtentMap : public Undoable
|
|||||||
EXPORT std::vector<InlineLBIDRange> getFreeListEntries();
|
EXPORT std::vector<InlineLBIDRange> getFreeListEntries();
|
||||||
|
|
||||||
EXPORT void dumpTo(std::ostream& os);
|
EXPORT void dumpTo(std::ostream& os);
|
||||||
EXPORT const bool* getEMLockStatus();
|
EXPORT const std::atomic<bool>* getEMLockStatus();
|
||||||
EXPORT const bool* getEMFLLockStatus();
|
EXPORT const std::atomic<bool>* getEMFLLockStatus();
|
||||||
EXPORT const bool* getEMIndexLockStatus();
|
EXPORT const std::atomic<bool>* getEMIndexLockStatus();
|
||||||
size_t EMIndexShmemSize();
|
size_t EMIndexShmemSize();
|
||||||
size_t EMIndexShmemFree();
|
size_t EMIndexShmemFree();
|
||||||
|
|
||||||
@ -1087,7 +1087,9 @@ class ExtentMap : public Undoable
|
|||||||
time_t fCacheTime; // timestamp associated with config cache
|
time_t fCacheTime; // timestamp associated with config cache
|
||||||
|
|
||||||
int numUndoRecords;
|
int numUndoRecords;
|
||||||
bool flLocked, emLocked, emIndexLocked;
|
std::atomic<bool> flLocked{false};
|
||||||
|
std::atomic<bool> emLocked{false};
|
||||||
|
std::atomic<bool> emIndexLocked{false};
|
||||||
|
|
||||||
static boost::mutex mutex; // @bug5355 - made mutex static
|
static boost::mutex mutex; // @bug5355 - made mutex static
|
||||||
static boost::mutex emIndexMutex;
|
static boost::mutex emIndexMutex;
|
||||||
|
@ -35,7 +35,7 @@ using namespace logging;
|
|||||||
|
|
||||||
namespace BRM
|
namespace BRM
|
||||||
{
|
{
|
||||||
RWLockMonitor::RWLockMonitor(const bool* d, const bool* ls, const uint32_t k) : die(d), lockStatus(ls), key(k)
|
RWLockMonitor::RWLockMonitor(const std::atomic<bool>* d, const std::atomic<bool>* ls, const uint32_t k) : die(d), lockStatus(ls), key(k)
|
||||||
{
|
{
|
||||||
ts.tv_sec = 210; // 3:30 timer
|
ts.tv_sec = 210; // 3:30 timer
|
||||||
ts.tv_nsec = 0;
|
ts.tv_nsec = 0;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
#include "rwlock.h"
|
#include "rwlock.h"
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#define EXPORT
|
#define EXPORT
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ class RWLockMonitor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// d = die, ls = lock status, k = key
|
// d = die, ls = lock status, k = key
|
||||||
EXPORT RWLockMonitor(const bool* d, const bool* ls, const uint32_t k);
|
EXPORT RWLockMonitor(const std::atomic<bool>* d, const std::atomic<bool>* ls, const uint32_t k);
|
||||||
|
|
||||||
EXPORT virtual ~RWLockMonitor();
|
EXPORT virtual ~RWLockMonitor();
|
||||||
|
|
||||||
@ -49,8 +50,8 @@ class RWLockMonitor
|
|||||||
// RWLockMonitor& operator=(const RWLockMonitor&rhs);
|
// RWLockMonitor& operator=(const RWLockMonitor&rhs);
|
||||||
|
|
||||||
/* Some of these vars are only useful once we implement write_lock checking. */
|
/* Some of these vars are only useful once we implement write_lock checking. */
|
||||||
const bool* die;
|
const std::atomic<bool>* die;
|
||||||
const bool* lockStatus;
|
const std::atomic<bool>* lockStatus;
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
boost::shared_ptr<rwlock::RWLock> lock;
|
boost::shared_ptr<rwlock::RWLock> lock;
|
||||||
|
|
||||||
|
@ -1482,27 +1482,27 @@ int SlaveDBRMNode::dmlReleaseLBIDRanges(const vector<LBIDRange>& ranges)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* SlaveDBRMNode::getEMFLLockStatus()
|
const std::atomic<bool>* SlaveDBRMNode::getEMFLLockStatus()
|
||||||
{
|
{
|
||||||
return em.getEMFLLockStatus();
|
return em.getEMFLLockStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* SlaveDBRMNode::getEMLockStatus()
|
const std::atomic<bool>* SlaveDBRMNode::getEMLockStatus()
|
||||||
{
|
{
|
||||||
return em.getEMLockStatus();
|
return em.getEMLockStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* SlaveDBRMNode::getEMIndexLockStatus()
|
const std::atomic<bool> *SlaveDBRMNode::getEMIndexLockStatus()
|
||||||
{
|
{
|
||||||
return em.getEMIndexLockStatus();
|
return em.getEMIndexLockStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* SlaveDBRMNode::getVBBMLockStatus()
|
const std::atomic<bool>* SlaveDBRMNode::getVBBMLockStatus()
|
||||||
{
|
{
|
||||||
return &locked[0];
|
return &locked[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool* SlaveDBRMNode::getVSSLockStatus()
|
const std::atomic<bool>* SlaveDBRMNode::getVSSLockStatus()
|
||||||
{
|
{
|
||||||
return &locked[1];
|
return &locked[1];
|
||||||
}
|
}
|
||||||
|
@ -455,11 +455,11 @@ class SlaveDBRMNode
|
|||||||
EXPORT int loadState(std::string filename) throw();
|
EXPORT int loadState(std::string filename) throw();
|
||||||
EXPORT int saveState(std::string filename) throw();
|
EXPORT int saveState(std::string filename) throw();
|
||||||
|
|
||||||
EXPORT const bool* getEMFLLockStatus();
|
EXPORT const std::atomic<bool>* getEMFLLockStatus();
|
||||||
EXPORT const bool* getEMLockStatus();
|
EXPORT const std::atomic<bool>* getEMLockStatus();
|
||||||
EXPORT const bool* getEMIndexLockStatus();
|
EXPORT const std::atomic<bool>* getEMIndexLockStatus();
|
||||||
EXPORT const bool* getVBBMLockStatus();
|
EXPORT const std::atomic<bool>* getVBBMLockStatus();
|
||||||
EXPORT const bool* getVSSLockStatus();
|
EXPORT const std::atomic<bool>* getVSSLockStatus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit SlaveDBRMNode(const SlaveDBRMNode& brm);
|
explicit SlaveDBRMNode(const SlaveDBRMNode& brm);
|
||||||
@ -471,7 +471,7 @@ class SlaveDBRMNode
|
|||||||
VBBM vbbm;
|
VBBM vbbm;
|
||||||
VSS vss;
|
VSS vss;
|
||||||
CopyLocks copylocks;
|
CopyLocks copylocks;
|
||||||
bool locked[3]; // 0 = VBBM, 1 = VSS, 2 = CopyLocks
|
std::atomic<bool> locked[3] {false, false, false}; // 0 = VBBM, 1 = VSS, 2 = CopyLocks
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BRM
|
} // namespace BRM
|
||||||
|
@ -36,12 +36,13 @@
|
|||||||
#include "crashtrace.h"
|
#include "crashtrace.h"
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "jobstep.h"
|
#include "jobstep.h"
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
using namespace BRM;
|
using namespace BRM;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
std::unique_ptr<SlaveComm> comm;
|
std::unique_ptr<SlaveComm> comm;
|
||||||
bool die = false;
|
std::atomic<bool> die{false};
|
||||||
boost::thread_group monitorThreads;
|
boost::thread_group monitorThreads;
|
||||||
|
|
||||||
class Opt
|
class Opt
|
||||||
|
Reference in New Issue
Block a user