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
Reformat all code to coding standard
This commit is contained in:
@ -33,18 +33,18 @@
|
||||
// ClearTableLockThread constructor
|
||||
//------------------------------------------------------------------------------
|
||||
ClearTableLockThread::ClearTableLockThread(
|
||||
BRM::DBRM* brm,
|
||||
messageqcpp::MessageQueueClient* clt,
|
||||
const BRM::TableLockInfo& tInfo,
|
||||
const std::string& tblName,
|
||||
CLRTBLLOCK_MSGTYPE msgType,
|
||||
ClearTableLockStatus* pStatus) :
|
||||
fTableLockInfo(tInfo),
|
||||
fBrm(brm),
|
||||
fClt(clt),
|
||||
fTblName(tblName),
|
||||
fMsgType(msgType),
|
||||
fStatus(pStatus)
|
||||
BRM::DBRM* brm,
|
||||
messageqcpp::MessageQueueClient* clt,
|
||||
const BRM::TableLockInfo& tInfo,
|
||||
const std::string& tblName,
|
||||
CLRTBLLOCK_MSGTYPE msgType,
|
||||
ClearTableLockStatus* pStatus) :
|
||||
fTableLockInfo(tInfo),
|
||||
fBrm(brm),
|
||||
fClt(clt),
|
||||
fTblName(tblName),
|
||||
fMsgType(msgType),
|
||||
fStatus(pStatus)
|
||||
{
|
||||
}
|
||||
|
||||
@ -54,21 +54,22 @@ ClearTableLockThread::ClearTableLockThread(
|
||||
//------------------------------------------------------------------------------
|
||||
void ClearTableLockThread::operator() ()
|
||||
{
|
||||
try {
|
||||
if (fMsgType == CLRTBLLOCK_MSGTYPE_ROLLBACK)
|
||||
executeRollback( );
|
||||
else if (fMsgType == CLRTBLLOCK_MSGTYPE_CLEANUP)
|
||||
executeFileCleanup( );
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
setStatus( 101, ex.what() );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::string errMsg("Unknown exception.");
|
||||
setStatus( 102, errMsg );
|
||||
}
|
||||
try
|
||||
{
|
||||
if (fMsgType == CLRTBLLOCK_MSGTYPE_ROLLBACK)
|
||||
executeRollback( );
|
||||
else if (fMsgType == CLRTBLLOCK_MSGTYPE_CLEANUP)
|
||||
executeFileCleanup( );
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
setStatus( 101, ex.what() );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::string errMsg("Unknown exception.");
|
||||
setStatus( 102, errMsg );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -76,72 +77,75 @@ void ClearTableLockThread::operator() ()
|
||||
//------------------------------------------------------------------------------
|
||||
void ClearTableLockThread::executeRollback( )
|
||||
{
|
||||
boost::shared_ptr<messageqcpp::ByteStream> bsIn;
|
||||
messageqcpp::ByteStream bsOut;
|
||||
boost::shared_ptr<messageqcpp::ByteStream> bsIn;
|
||||
messageqcpp::ByteStream bsOut;
|
||||
|
||||
const std::string APPLNAME("cleartablelock command");
|
||||
const std::string APPLNAME("cleartablelock command");
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Send rollback msg to the writeengine server connected to fClt.
|
||||
//--------------------------------------------------------------------------
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "Sending rollback request to PM" <<
|
||||
fStatus->moduleID() << "..." << std::endl;
|
||||
//--------------------------------------------------------------------------
|
||||
// Send rollback msg to the writeengine server connected to fClt.
|
||||
//--------------------------------------------------------------------------
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "Sending rollback request to PM" <<
|
||||
fStatus->moduleID() << "..." << std::endl;
|
||||
// std::cout << "cleartablelock rollback: tableLock-" <<fTableLockInfo.id<<
|
||||
// ": oid-" << fTableLockInfo.tableOID <<
|
||||
// "; name-" << fTblName <<
|
||||
// "; app-" << APPLNAME << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
bsOut << (messageqcpp::ByteStream::byte)
|
||||
WriteEngine::WE_CLT_SRV_CLEAR_TABLE_LOCK;
|
||||
bsOut << fTableLockInfo.id;
|
||||
bsOut << fTableLockInfo.tableOID;
|
||||
bsOut << fTblName;
|
||||
bsOut << APPLNAME;
|
||||
fClt->write(bsOut);
|
||||
bsOut << (messageqcpp::ByteStream::byte)
|
||||
WriteEngine::WE_CLT_SRV_CLEAR_TABLE_LOCK;
|
||||
bsOut << fTableLockInfo.id;
|
||||
bsOut << fTableLockInfo.tableOID;
|
||||
bsOut << fTblName;
|
||||
bsOut << APPLNAME;
|
||||
fClt->write(bsOut);
|
||||
|
||||
// Wait for the response, and check for any errors
|
||||
std::string rollbackErrMsg;
|
||||
bsIn.reset(new messageqcpp::ByteStream());
|
||||
bsIn = fClt->read();
|
||||
if (bsIn->length() == 0)
|
||||
{
|
||||
std::string errMsg("Network error, PM rollback");
|
||||
setStatus( 103, errMsg );
|
||||
// Wait for the response, and check for any errors
|
||||
std::string rollbackErrMsg;
|
||||
bsIn.reset(new messageqcpp::ByteStream());
|
||||
bsIn = fClt->read();
|
||||
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "No response from PM" << fStatus->moduleID() << std::endl;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageqcpp::ByteStream::byte rc;
|
||||
*bsIn >> rc;
|
||||
*bsIn >> rollbackErrMsg;
|
||||
if (bsIn->length() == 0)
|
||||
{
|
||||
std::string errMsg("Network error, PM rollback");
|
||||
setStatus( 103, errMsg );
|
||||
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "No response from PM" << fStatus->moduleID() << std::endl;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageqcpp::ByteStream::byte rc;
|
||||
*bsIn >> rc;
|
||||
*bsIn >> rollbackErrMsg;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
|
||||
if (rc == 0)
|
||||
std::cout << "Successful rollback response from PM" <<
|
||||
fStatus->moduleID() << std::endl;
|
||||
else
|
||||
std::cout << "Unsuccessful rollback response from PM" <<
|
||||
fStatus->moduleID() << "; " << rollbackErrMsg << std::endl;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
if (rc == 0)
|
||||
std::cout << "Successful rollback response from PM" <<
|
||||
fStatus->moduleID() << std::endl;
|
||||
else
|
||||
std::cout << "Unsuccessful rollback response from PM" <<
|
||||
fStatus->moduleID() << "; " << rollbackErrMsg << std::endl;
|
||||
// std::cout << "cleartablelock rollback response; rc-" << (int)rc <<
|
||||
// "; retMsg: <" << rollbackErrMsg << '>' << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
std::string errMsg("PM rollback error: ");
|
||||
errMsg += rollbackErrMsg;
|
||||
setStatus( 104, errMsg );
|
||||
return;
|
||||
}
|
||||
if (rc != 0)
|
||||
{
|
||||
std::string errMsg("PM rollback error: ");
|
||||
errMsg += rollbackErrMsg;
|
||||
setStatus( 104, errMsg );
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -149,62 +153,65 @@ void ClearTableLockThread::executeRollback( )
|
||||
//------------------------------------------------------------------------------
|
||||
void ClearTableLockThread::executeFileCleanup( )
|
||||
{
|
||||
boost::shared_ptr<messageqcpp::ByteStream> bsIn;
|
||||
messageqcpp::ByteStream bsOut;
|
||||
boost::shared_ptr<messageqcpp::ByteStream> bsIn;
|
||||
messageqcpp::ByteStream bsOut;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Send cleanup msg (to delete rb files) to the we server connected to fClt.
|
||||
//--------------------------------------------------------------------------
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "Sending cleanup request to PM" <<
|
||||
fStatus->moduleID() << "..." << std::endl;
|
||||
//--------------------------------------------------------------------------
|
||||
// Send cleanup msg (to delete rb files) to the we server connected to fClt.
|
||||
//--------------------------------------------------------------------------
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "Sending cleanup request to PM" <<
|
||||
fStatus->moduleID() << "..." << std::endl;
|
||||
// std::cout << "cleartablelock cleanup: " <<
|
||||
// "oid-" << fTableLockInfo.tableOID << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
bsOut << (messageqcpp::ByteStream::byte)
|
||||
WriteEngine::WE_CLT_SRV_CLEAR_TABLE_LOCK_CLEANUP;
|
||||
bsOut << fTableLockInfo.tableOID;
|
||||
fClt->write(bsOut);
|
||||
bsOut << (messageqcpp::ByteStream::byte)
|
||||
WriteEngine::WE_CLT_SRV_CLEAR_TABLE_LOCK_CLEANUP;
|
||||
bsOut << fTableLockInfo.tableOID;
|
||||
fClt->write(bsOut);
|
||||
|
||||
// Wait for the response, and check for any errors
|
||||
std::string fileDeleteErrMsg;
|
||||
bsIn.reset(new messageqcpp::ByteStream());
|
||||
bsIn = fClt->read();
|
||||
if (bsIn->length() == 0)
|
||||
{
|
||||
std::string errMsg("Network error; PM rollback cleanup");
|
||||
setStatus( 105, errMsg );
|
||||
// Wait for the response, and check for any errors
|
||||
std::string fileDeleteErrMsg;
|
||||
bsIn.reset(new messageqcpp::ByteStream());
|
||||
bsIn = fClt->read();
|
||||
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "No response from PM" << fStatus->moduleID() << std::endl;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageqcpp::ByteStream::byte rc;
|
||||
*bsIn >> rc;
|
||||
*bsIn >> fileDeleteErrMsg;
|
||||
if (bsIn->length() == 0)
|
||||
{
|
||||
std::string errMsg("Network error; PM rollback cleanup");
|
||||
setStatus( 105, errMsg );
|
||||
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
std::cout << "No response from PM" << fStatus->moduleID() << std::endl;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageqcpp::ByteStream::byte rc;
|
||||
*bsIn >> rc;
|
||||
*bsIn >> fileDeleteErrMsg;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
|
||||
if (rc == 0)
|
||||
std::cout << "Successful cleanup response from PM" <<
|
||||
fStatus->moduleID() << std::endl;
|
||||
else
|
||||
std::cout << "Unsuccessful cleanup response from PM" <<
|
||||
fStatus->moduleID() << "; " << fileDeleteErrMsg << std::endl;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fStdOutLock);
|
||||
if (rc == 0)
|
||||
std::cout << "Successful cleanup response from PM" <<
|
||||
fStatus->moduleID() << std::endl;
|
||||
else
|
||||
std::cout << "Unsuccessful cleanup response from PM" <<
|
||||
fStatus->moduleID() << "; " << fileDeleteErrMsg <<std::endl;
|
||||
// std::cout << "cleartablelock cleanup response; rc-" << (int)rc <<
|
||||
// "; retMsg: <" << fileDeleteErrMsg << '>' << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
std::string errMsg("PM rollback cleanup error: ");
|
||||
errMsg += fileDeleteErrMsg;
|
||||
setStatus( 106, errMsg );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (rc != 0)
|
||||
{
|
||||
std::string errMsg("PM rollback cleanup error: ");
|
||||
errMsg += fileDeleteErrMsg;
|
||||
setStatus( 106, errMsg );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user