1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-13 16:01:32 +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

@ -28,170 +28,175 @@ using namespace std;
using namespace logging;
using namespace config;
class MessageLoggingTest : public CppUnit::TestFixture {
class MessageLoggingTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( MessageLoggingTest );
CPPUNIT_TEST_SUITE( MessageLoggingTest );
CPPUNIT_TEST( m1 );
CPPUNIT_TEST( m2 );
CPPUNIT_TEST( m3 );
CPPUNIT_TEST( m4 );
CPPUNIT_TEST( m5 );
CPPUNIT_TEST( m1 );
CPPUNIT_TEST( m2 );
CPPUNIT_TEST( m3 );
CPPUNIT_TEST( m4 );
CPPUNIT_TEST( m5 );
CPPUNIT_TEST_SUITE_END();
CPPUNIT_TEST_SUITE_END();
private:
LoggingID lid;
LoggingID lid;
public:
void setUp() {
setenv("CALPONT_CONFIG_FILE", "./Columnstore.xml", 1);
}
void setUp()
{
setenv("CALPONT_CONFIG_FILE", "./Columnstore.xml", 1);
}
void tearDown() {
}
void tearDown()
{
}
void m1()
{
Message::Args args;
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
Message m(100);
m.fMsg = "%1% %2% %3% %4%";
m.format(args);
//CPPUNIT_ASSERT(m.msg() == "hello world 123 1234.55");
m.reset();
m.fMsg = "%1% %2% %3% %4%";
args.reset();
m.format(args);
//CPPUNIT_ASSERT(m.msg() == " ");
LoggingID lid(7);
MessageLog ml(lid);
m.reset();
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
m.format(args);
ml.logDebugMessage(m);
void m1()
{
Message::Args args;
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
Message m(100);
m.fMsg = "%1% %2% %3% %4%";
m.format(args);
//CPPUNIT_ASSERT(m.msg() == "hello world 123 1234.55");
m.reset();
m.fMsg = "%1% %2% %3% %4%";
args.reset();
m.format(args);
//CPPUNIT_ASSERT(m.msg() == " ");
LoggingID lid(7);
MessageLog ml(lid);
m.reset();
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
m.format(args);
ml.logDebugMessage(m);
args.reset();
args.add("begin CEP generation");
m.reset();
m.format(args);
ml.logInfoMessage(m);
args.reset();
args.add("begin CEP generation");
m.reset();
m.format(args);
ml.logInfoMessage(m);
args.reset();
args.add("end CEP generation");
m.reset();
m.format(args);
ml.logInfoMessage(m);
args.reset();
args.add("end CEP generation");
m.reset();
m.format(args);
ml.logInfoMessage(m);
args.reset();
args.add("something took too long");
m.reset();
m.format(args);
ml.logWarningMessage(m);
args.reset();
args.add("something took too long");
m.reset();
m.format(args);
ml.logWarningMessage(m);
args.reset();
args.add("something seriously took too long");
m.reset();
m.format(args);
ml.logSeriousMessage(m);
ml.logErrorMessage(m);
args.reset();
args.add("something seriously took too long");
m.reset();
m.format(args);
ml.logSeriousMessage(m);
ml.logErrorMessage(m);
args.reset();
args.add("something critical took too long");
m.reset();
m.format(args);
ml.logCriticalMessage(m);
args.reset();
args.add("something critical took too long");
m.reset();
m.format(args);
ml.logCriticalMessage(m);
LoggingID lid1;
MessageLog ml1(lid1);
args.reset();
m.reset();
args.add("subsystem 0 = Calpont test");
m.format(args);
ml1.logDebugMessage(m);
LoggingID lid1;
MessageLog ml1(lid1);
args.reset();
m.reset();
args.add("subsystem 0 = Calpont test");
m.format(args);
ml1.logDebugMessage(m);
LoggingID lid2(1000);
MessageLog ml2(lid2);
args.reset();
m.reset();
args.add("subsystem above MAX = Calpont test");
m.format(args);
ml2.logDebugMessage(m);
LoggingID lid2(1000);
MessageLog ml2(lid2);
args.reset();
m.reset();
args.add("subsystem above MAX = Calpont test");
m.format(args);
ml2.logDebugMessage(m);
LoggingID lid3(7);
MessageLog ml3(lid3);
args.reset();
m.reset();
args.add("subsystem 7 = mcsadmin test");
m.format(args);
ml3.logDebugMessage(m);
LoggingID lid3(7);
MessageLog ml3(lid3);
args.reset();
m.reset();
args.add("subsystem 7 = mcsadmin test");
m.format(args);
ml3.logDebugMessage(m);
Config::deleteInstanceMap();
}
}
void m2()
{
Message m1(100);
CPPUNIT_ASSERT(m1.msgID() == 100);
Message m2(10);
CPPUNIT_ASSERT(m2.msgID() == 10);
m2 = m1;
CPPUNIT_ASSERT(m2.msgID() == 100);
Message m3(m2);
CPPUNIT_ASSERT(m3.msgID() == m2.msgID());
Message m4(99);
Message m5(199);
CPPUNIT_ASSERT(m4.msgID() == 99);
CPPUNIT_ASSERT(m5.msgID() == 199);
m4.swap(m5);
CPPUNIT_ASSERT(m5.msgID() == 99);
CPPUNIT_ASSERT(m4.msgID() == 199);
void m2()
{
Message m1(100);
CPPUNIT_ASSERT(m1.msgID() == 100);
Message m2(10);
CPPUNIT_ASSERT(m2.msgID() == 10);
m2 = m1;
CPPUNIT_ASSERT(m2.msgID() == 100);
Message m3(m2);
CPPUNIT_ASSERT(m3.msgID() == m2.msgID());
Message m4(99);
Message m5(199);
CPPUNIT_ASSERT(m4.msgID() == 99);
CPPUNIT_ASSERT(m5.msgID() == 199);
m4.swap(m5);
CPPUNIT_ASSERT(m5.msgID() == 99);
CPPUNIT_ASSERT(m4.msgID() == 199);
Config::deleteInstanceMap();
}
}
void m3()
{
LoggingID lid1(1, 2, 3, 4);
MessageLog ml1(lid1);
CPPUNIT_ASSERT(ml1.fLogData.fSubsysID == 1);
void m3()
{
LoggingID lid1(1, 2, 3, 4);
MessageLog ml1(lid1);
CPPUNIT_ASSERT(ml1.fLogData.fSubsysID == 1);
LoggingID lid2(10, 20, 30, 40);
MessageLog ml2(lid2);
CPPUNIT_ASSERT(ml2.fLogData.fSubsysID == 10);
LoggingID lid2(10, 20, 30, 40);
MessageLog ml2(lid2);
CPPUNIT_ASSERT(ml2.fLogData.fSubsysID == 10);
ml2 = ml1;
CPPUNIT_ASSERT(ml2.fLogData.fSubsysID == 1);
ml2 = ml1;
CPPUNIT_ASSERT(ml2.fLogData.fSubsysID == 1);
MessageLog ml3(ml2);
CPPUNIT_ASSERT(ml3.fLogData.fSubsysID == 1);
MessageLog ml3(ml2);
CPPUNIT_ASSERT(ml3.fLogData.fSubsysID == 1);
Config::deleteInstanceMap();
}
}
void m4()
{
LoggingID lid1(100, 200, 300, 400);
MessageLog ml1(lid1);
Message::Args args;
Message* m;
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
for (int i = 0; i < 4; i++)
{
m = new Message(i);
m->format(args);
ml1.logDebugMessage(*m);
delete m;
}
void m4()
{
LoggingID lid1(100, 200, 300, 400);
MessageLog ml1(lid1);
Message::Args args;
Message* m;
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
for (int i = 0; i < 4; i++)
{
m = new Message(i);
m->format(args);
ml1.logDebugMessage(*m);
delete m;
}
Config::deleteInstanceMap();
}
}
//------------------------------------------------------------------------------
// This method is intended to test the messages used to profile db performance.
@ -255,103 +260,104 @@ void m4()
// this way is that a derived class like MessageLogStatement "could" be
// implemented to log the StartStatement, and its desctructor could then
// log the EndStatement automatically, on behalf of the application.
//
//
//------------------------------------------------------------------------------
void m5()
{
void m5()
{
int subSystem = 5; // joblist subSystem
int session = 100;
int transaction = 1;
int thread = 0;
LoggingID lid1 ( subSystem, session, transaction, thread );
MessageLog msgLog ( lid1 );
int thread = 0;
Message::Args args;
LoggingID lid1 ( subSystem, session, transaction, thread );
MessageLog msgLog ( lid1 );
// Log the start time of a transaction
Message msgStartTrans ( M0026 );
msgStartTrans.format ( args );
msgLog.logDebugMessage ( msgStartTrans );
Message::Args args;
// Log the start of execution time for a SQL statement
Message msgStartStatement ( M0028 );
int statementId = 11;
int versionId = 22;
string sql ("SELECT column1, column2 FROM table1 WHERE column1 = 345");
args.reset ( );
args.add ( statementId );
args.add ( versionId );
args.add ( sql );
msgStartStatement.format ( args );
msgLog.logDebugMessage ( msgStartStatement );
// Log the start time of a transaction
Message msgStartTrans ( M0026 );
msgStartTrans.format ( args );
msgLog.logDebugMessage ( msgStartTrans );
const string stepNames[] = { "steponeA", "steptwoA" ,"stepthreeA",
"stepfourB","stepfiveB","stepsixB" };
// Log the start of execution time for a SQL statement
Message msgStartStatement ( M0028 );
int statementId = 11;
int versionId = 22;
string sql ("SELECT column1, column2 FROM table1 WHERE column1 = 345");
args.reset ( );
args.add ( statementId );
args.add ( versionId );
args.add ( sql );
msgStartStatement.format ( args );
msgLog.logDebugMessage ( msgStartStatement );
// To process this SQL statement, simulate executing 2 job steps,
// with each job step consisting of of 3 parallel primitive steps
for (int jobStep=0; jobStep<2; jobStep++)
{
int primStep1 = jobStep * 3;
const string stepNames[] = { "steponeA", "steptwoA", "stepthreeA",
"stepfourB", "stepfiveB", "stepsixB"
};
// Log 3 parallel steps starting to execute
for (int i=primStep1; i<(primStep1+3); i++)
{
Message msgStartStep ( M0030 ); // Start Step
int stepId = i+1;
string stepName = stepNames[i];
args.reset ( );
args.add ( statementId );
args.add ( stepId );
args.add ( stepName );
msgStartStep.format ( args );
msgLog.logDebugMessage ( msgStartStep );
}
// To process this SQL statement, simulate executing 2 job steps,
// with each job step consisting of of 3 parallel primitive steps
for (int jobStep = 0; jobStep < 2; jobStep++)
{
int primStep1 = jobStep * 3;
// Record I/O block count for 0 or more objects per step;
// for this example we just record I/O for 1 object per step.
// Then log the completion of each step.
for (int i=primStep1; i<(primStep1+3); i++)
{
Message msgBlockCount ( M0032 ); // I/O block count
int stepId = i+1;
int objectId = stepId * 20;
int phyCount = stepId * 30;
int logCount = phyCount + 5;
args.reset ( );
args.add ( statementId );
args.add ( stepId );
args.add ( objectId );
args.add ( phyCount );
args.add ( logCount );
msgBlockCount.format ( args );
msgLog.logDebugMessage ( msgBlockCount );
// Log 3 parallel steps starting to execute
for (int i = primStep1; i < (primStep1 + 3); i++)
{
Message msgStartStep ( M0030 ); // Start Step
int stepId = i + 1;
string stepName = stepNames[i];
args.reset ( );
args.add ( statementId );
args.add ( stepId );
args.add ( stepName );
msgStartStep.format ( args );
msgLog.logDebugMessage ( msgStartStep );
}
Message msgEndStep ( M0031 ); // End Step
args.reset ( );
args.add ( statementId );
args.add ( stepId );
msgEndStep.format ( args );
msgLog.logDebugMessage ( msgEndStep );
}
}
// Record I/O block count for 0 or more objects per step;
// for this example we just record I/O for 1 object per step.
// Then log the completion of each step.
for (int i = primStep1; i < (primStep1 + 3); i++)
{
Message msgBlockCount ( M0032 ); // I/O block count
int stepId = i + 1;
int objectId = stepId * 20;
int phyCount = stepId * 30;
int logCount = phyCount + 5;
args.reset ( );
args.add ( statementId );
args.add ( stepId );
args.add ( objectId );
args.add ( phyCount );
args.add ( logCount );
msgBlockCount.format ( args );
msgLog.logDebugMessage ( msgBlockCount );
// Log the completion time of the SQL statement
Message msgEndStatement ( M0029 );
args.reset ( );
args.add ( statementId );
msgEndStatement.format ( args );
msgLog.logDebugMessage ( msgEndStatement );
Message msgEndStep ( M0031 ); // End Step
args.reset ( );
args.add ( statementId );
args.add ( stepId );
msgEndStep.format ( args );
msgLog.logDebugMessage ( msgEndStep );
}
}
// Log the completion time of the transaction
Message msgEndTrans ( M0027 );
args.reset ( );
args.add ( string("COMMIT") );
msgEndTrans.format ( args );
msgLog.logDebugMessage ( msgEndTrans );
// Log the completion time of the SQL statement
Message msgEndStatement ( M0029 );
args.reset ( );
args.add ( statementId );
msgEndStatement.format ( args );
msgLog.logDebugMessage ( msgEndStatement );
// Log the completion time of the transaction
Message msgEndTrans ( M0027 );
args.reset ( );
args.add ( string("COMMIT") );
msgEndTrans.format ( args );
msgLog.logDebugMessage ( msgEndTrans );
Config::deleteInstanceMap();
}
}
}; // end of CppUnit::TestFixture class
@ -360,12 +366,12 @@ CPPUNIT_TEST_SUITE_REGISTRATION( MessageLoggingTest );
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
int main( int argc, char **argv)
int main( int argc, char** argv)
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasSuccessful = runner.run( "", false );
return (wasSuccessful ? 0 : 1);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasSuccessful = runner.run( "", false );
return (wasSuccessful ? 0 : 1);
}