You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-27 21:01:50 +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 $
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
@ -6036,17 +6036,17 @@ void ExtentMap::confirmChangesRBTree()
|
||||
undoRecordsRBTree.clear();
|
||||
}
|
||||
|
||||
const bool* ExtentMap::getEMFLLockStatus()
|
||||
const std::atomic<bool>* ExtentMap::getEMFLLockStatus()
|
||||
{
|
||||
return &flLocked;
|
||||
}
|
||||
|
||||
const bool* ExtentMap::getEMLockStatus()
|
||||
const std::atomic<bool>* ExtentMap::getEMLockStatus()
|
||||
{
|
||||
return &emLocked;
|
||||
}
|
||||
|
||||
const bool* ExtentMap::getEMIndexLockStatus()
|
||||
const std::atomic<bool>* ExtentMap::getEMIndexLockStatus()
|
||||
{
|
||||
return &emIndexLocked;
|
||||
}
|
||||
|
@ -1035,9 +1035,9 @@ class ExtentMap : public Undoable
|
||||
EXPORT std::vector<InlineLBIDRange> getFreeListEntries();
|
||||
|
||||
EXPORT void dumpTo(std::ostream& os);
|
||||
EXPORT const bool* getEMLockStatus();
|
||||
EXPORT const bool* getEMFLLockStatus();
|
||||
EXPORT const bool* getEMIndexLockStatus();
|
||||
EXPORT const std::atomic<bool>* getEMLockStatus();
|
||||
EXPORT const std::atomic<bool>* getEMFLLockStatus();
|
||||
EXPORT const std::atomic<bool>* getEMIndexLockStatus();
|
||||
size_t EMIndexShmemSize();
|
||||
size_t EMIndexShmemFree();
|
||||
|
||||
@ -1087,7 +1087,9 @@ class ExtentMap : public Undoable
|
||||
time_t fCacheTime; // timestamp associated with config cache
|
||||
|
||||
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 emIndexMutex;
|
||||
|
@ -35,7 +35,7 @@ using namespace logging;
|
||||
|
||||
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_nsec = 0;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include "rwlock.h"
|
||||
#include <atomic>
|
||||
|
||||
#define EXPORT
|
||||
|
||||
@ -37,7 +38,7 @@ class RWLockMonitor
|
||||
{
|
||||
public:
|
||||
// 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();
|
||||
|
||||
@ -49,8 +50,8 @@ class RWLockMonitor
|
||||
// RWLockMonitor& operator=(const RWLockMonitor&rhs);
|
||||
|
||||
/* Some of these vars are only useful once we implement write_lock checking. */
|
||||
const bool* die;
|
||||
const bool* lockStatus;
|
||||
const std::atomic<bool>* die;
|
||||
const std::atomic<bool>* lockStatus;
|
||||
uint32_t key;
|
||||
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();
|
||||
}
|
||||
|
||||
const bool* SlaveDBRMNode::getEMLockStatus()
|
||||
const std::atomic<bool>* SlaveDBRMNode::getEMLockStatus()
|
||||
{
|
||||
return em.getEMLockStatus();
|
||||
}
|
||||
|
||||
const bool* SlaveDBRMNode::getEMIndexLockStatus()
|
||||
const std::atomic<bool> *SlaveDBRMNode::getEMIndexLockStatus()
|
||||
{
|
||||
return em.getEMIndexLockStatus();
|
||||
}
|
||||
|
||||
const bool* SlaveDBRMNode::getVBBMLockStatus()
|
||||
const std::atomic<bool>* SlaveDBRMNode::getVBBMLockStatus()
|
||||
{
|
||||
return &locked[0];
|
||||
}
|
||||
|
||||
const bool* SlaveDBRMNode::getVSSLockStatus()
|
||||
const std::atomic<bool>* SlaveDBRMNode::getVSSLockStatus()
|
||||
{
|
||||
return &locked[1];
|
||||
}
|
||||
|
@ -455,11 +455,11 @@ class SlaveDBRMNode
|
||||
EXPORT int loadState(std::string filename) throw();
|
||||
EXPORT int saveState(std::string filename) throw();
|
||||
|
||||
EXPORT const bool* getEMFLLockStatus();
|
||||
EXPORT const bool* getEMLockStatus();
|
||||
EXPORT const bool* getEMIndexLockStatus();
|
||||
EXPORT const bool* getVBBMLockStatus();
|
||||
EXPORT const bool* getVSSLockStatus();
|
||||
EXPORT const std::atomic<bool>* getEMFLLockStatus();
|
||||
EXPORT const std::atomic<bool>* getEMLockStatus();
|
||||
EXPORT const std::atomic<bool>* getEMIndexLockStatus();
|
||||
EXPORT const std::atomic<bool>* getVBBMLockStatus();
|
||||
EXPORT const std::atomic<bool>* getVSSLockStatus();
|
||||
|
||||
private:
|
||||
explicit SlaveDBRMNode(const SlaveDBRMNode& brm);
|
||||
@ -471,7 +471,7 @@ class SlaveDBRMNode
|
||||
VBBM vbbm;
|
||||
VSS vss;
|
||||
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
|
||||
|
@ -36,12 +36,13 @@
|
||||
#include "crashtrace.h"
|
||||
#include "service.h"
|
||||
#include "jobstep.h"
|
||||
#include <atomic>
|
||||
|
||||
using namespace BRM;
|
||||
using namespace std;
|
||||
|
||||
std::unique_ptr<SlaveComm> comm;
|
||||
bool die = false;
|
||||
std::atomic<bool> die{false};
|
||||
boost::thread_group monitorThreads;
|
||||
|
||||
class Opt
|
||||
|
Reference in New Issue
Block a user