1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -14,111 +14,116 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/*******************************************************************************
* $Id$
*
*******************************************************************************/
/*
* we_tablelockgrabber.cpp
*
* Created on: Dec 19, 2011
* Author: bpaul
*/
#include "brm.h"
#include "brmtypes.h"
using namespace BRM;
#include <iostream>
using namespace std;
#include "we_sdhandler.h"
#include "we_tablelockgrabber.h"
namespace WriteEngine
{
uint64_t WETableLockGrabber::grabTableLock(std::vector<unsigned int> &PmList,
uint32_t tableOID)
{
uint64_t aLockId;
std::string aProcName = "cpimport";
uint32_t aProcId = getpid();
int32_t aSessId = -1;
int32_t aTxnId = -1;
try
{
aLockId = fRef.fDbrm.getTableLock(PmList, tableOID, &aProcName,
&aProcId, &aSessId, &aTxnId, BRM::LOADING);
}
catch (std::exception &e)
{
cout << "ERROR: Failed to get Table Lock " << e.what() << endl;
throw runtime_error(e.what());
}
if (aLockId == 0)
{
ostringstream oss;
oss << " Table currently locked by process-" <<
aProcName << "; pid-" << aProcId <<
"; session-" << aSessId <<
"; txn-" << aTxnId;
throw runtime_error(oss.str());
}
//cout << "lock ID = " << aLockId << endl;
//if (aLockId == 0)
// cout << " existing owner name = " << aProcName << " pid = " <<
// aProcId << " session = " << aSessId << endl;
return aLockId;
}
bool WETableLockGrabber::releaseTableLock(uint64_t LockId)
{
bool aRet;
//cout << "releasing lock " << LockId << endl;
try
{
aRet = fRef.fDbrm.releaseTableLock(LockId);
}
catch (std::exception &e)
{
cout << "caught an exception: " << e.what() << endl;
throw runtime_error(e.what());
}
return aRet;
}
bool WETableLockGrabber::changeTableLockState(uint64_t LockId)
{
bool aRet;
//cout << "changing state of lock " << LockId << endl;
try
{
aRet = fRef.fDbrm.changeState(LockId, BRM::CLEANUP);
}
catch (std::exception &e)
{
cout << "caught an exception: " << e.what() << endl;
throw runtime_error(e.what());
}
return aRet;
}
} /* namespace WriteEngine */
/*******************************************************************************
* $Id$
*
*******************************************************************************/
/*
* we_tablelockgrabber.cpp
*
* Created on: Dec 19, 2011
* Author: bpaul
*/
#include "brm.h"
#include "brmtypes.h"
using namespace BRM;
#include <iostream>
using namespace std;
#include "we_sdhandler.h"
#include "we_tablelockgrabber.h"
namespace WriteEngine
{
uint64_t WETableLockGrabber::grabTableLock(std::vector<unsigned int>& PmList,
uint32_t tableOID)
{
uint64_t aLockId;
std::string aProcName = "cpimport";
uint32_t aProcId = getpid();
int32_t aSessId = -1;
int32_t aTxnId = -1;
try
{
aLockId = fRef.fDbrm.getTableLock(PmList, tableOID, &aProcName,
&aProcId, &aSessId, &aTxnId, BRM::LOADING);
}
catch (std::exception& e)
{
cout << "ERROR: Failed to get Table Lock " << e.what() << endl;
throw runtime_error(e.what());
}
if (aLockId == 0)
{
ostringstream oss;
oss << " Table currently locked by process-" <<
aProcName << "; pid-" << aProcId <<
"; session-" << aSessId <<
"; txn-" << aTxnId;
throw runtime_error(oss.str());
}
//cout << "lock ID = " << aLockId << endl;
//if (aLockId == 0)
// cout << " existing owner name = " << aProcName << " pid = " <<
// aProcId << " session = " << aSessId << endl;
return aLockId;
}
bool WETableLockGrabber::releaseTableLock(uint64_t LockId)
{
bool aRet;
//cout << "releasing lock " << LockId << endl;
try
{
aRet = fRef.fDbrm.releaseTableLock(LockId);
}
catch (std::exception& e)
{
cout << "caught an exception: " << e.what() << endl;
throw runtime_error(e.what());
}
return aRet;
}
bool WETableLockGrabber::changeTableLockState(uint64_t LockId)
{
bool aRet;
//cout << "changing state of lock " << LockId << endl;
try
{
aRet = fRef.fDbrm.changeState(LockId, BRM::CLEANUP);
}
catch (std::exception& e)
{
cout << "caught an exception: " << e.what() << endl;
throw runtime_error(e.what());
}
return aRet;
}
} /* namespace WriteEngine */