1
0
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:
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

@ -25,39 +25,40 @@ using namespace std;
using namespace oam;
#include "replaytxnlog.h"
namespace {
void usage(char *prog)
namespace
{
cout << endl;
cout << "Usage: " << prog << " [options]" << endl;
void usage(char* prog)
{
cout << endl;
cout << "This utility can be used after a backup is restored to report transactions that " << endl;
cout << "occurred after the backup. It begins with the first transaction that was committed " << endl;
cout << "after the backup and reports DDL and DML statements as well as imports." << endl;
cout << endl;
cout << endl;
cout << "Usage: " << prog << " [options]" << endl;
cout << "Options:" << endl;
/*
cout << "-u <user> Database user id." << endl << endl;
cout << endl;
cout << "This utility can be used after a backup is restored to report transactions that " << endl;
cout << "occurred after the backup. It begins with the first transaction that was committed " << endl;
cout << "after the backup and reports DDL and DML statements as well as imports." << endl;
cout << endl;
cout << "-p <password> Password." << endl << endl;
*/
cout << "-d <stop date> Stop date and time as mm/dd/yy@hh:mm:ss or 'Now'." << endl;
cout << " Only transactions committed before this date and time will be reported." << endl;
cout << " The current date and time will be used if 'Now'." << endl << endl;
cout << "Options:" << endl;
/*
cout << "-u <user> Database user id." << endl << endl;
/*
cout << "-i Ignore bulk load log entries." << endl;
cout << " The program will pause and prompt at bulk load entries by default." << endl << endl;
cout << "-p <password> Password." << endl << endl;
*/
cout << "-d <stop date> Stop date and time as mm/dd/yy@hh:mm:ss or 'Now'." << endl;
cout << " Only transactions committed before this date and time will be reported." << endl;
cout << " The current date and time will be used if 'Now'." << endl << endl;
cout << "-e Report mode. The sql statements will be displayed to the console only. No" << endl;
cout << " transactions will be processed. The user and password will be ignored." << endl << endl;
*/
/*
cout << "-i Ignore bulk load log entries." << endl;
cout << " The program will pause and prompt at bulk load entries by default." << endl << endl;
cout << "-h Display this help." << endl << endl;
cout << "-e Report mode. The sql statements will be displayed to the console only. No" << endl;
cout << " transactions will be processed. The user and password will be ignored." << endl << endl;
*/
cout << "-h Display this help." << endl << endl;
}
bool isRunningOnPm()
@ -68,81 +69,92 @@ bool isRunningOnPm()
int installType = -1;
char* csc_ident = getenv("CALPONT_CSC_IDENT");
if (csc_ident == 0 || *csc_ident == 0)
{
//get local module info valdiate running on a pm
try {
try
{
t = oam.getModuleInfo();
moduleType = boost::get<1>(t);
installType = boost::get<5>(t);
}
catch (exception& e) {
catch (exception& e)
{
moduleType = "pm";
}
}
else
moduleType = csc_ident;
if ( installType != oam::INSTALL_COMBINE_DM_UM_PM ) {
if ( moduleType != "pm" ) {
if ( installType != oam::INSTALL_COMBINE_DM_UM_PM )
{
if ( moduleType != "pm" )
{
cerr << "Exiting, ReplayTransactionLog can only be run on a performance module (pm)" << endl;
return false;
}
}
return true;
}
}
int main(int argc, char **argv)
int main(int argc, char** argv)
{
string user;
string password;
string stopDate;
bool ignoreBulk = false;
bool reportMode = false;
char c;
// Invokes member function `int operator ()(void);'
while ((c = getopt(argc, argv, "u:p:d:ihe")) != -1) {
switch (c) {
/*
case 'u':
user = optarg;
break;
case 'p':
password = optarg;
break;
*/
case 'd':
stopDate = optarg;
break;
/*
case 'i':
ignoreBulk = true;
break;
case 'e':
reportMode = true;
break;
*/
case 'h':
usage(argv[0]);
return 0;
break;
default:
usage(argv[0]);
return 1;
break;
}
}
string user;
string password;
string stopDate;
bool ignoreBulk = false;
bool reportMode = false;
char c;
if(!isRunningOnPm()) {
return 0;
}
// Invokes member function `int operator ()(void);'
while ((c = getopt(argc, argv, "u:p:d:ihe")) != -1)
{
switch (c)
{
/*
case 'u':
user = optarg;
break;
case 'p':
password = optarg;
break;
*/
case 'd':
stopDate = optarg;
break;
ReplayTxnLog replayTxnLog(user, password, stopDate, ignoreBulk, reportMode);
replayTxnLog.process();
/*
case 'i':
ignoreBulk = true;
break;
case 'e':
reportMode = true;
break;
*/
case 'h':
usage(argv[0]);
return 0;
break;
return 0;
default:
usage(argv[0]);
return 1;
break;
}
}
if (!isRunningOnPm())
{
return 0;
}
ReplayTxnLog replayTxnLog(user, password, stopDate, ignoreBulk, reportMode);
replayTxnLog.process();
return 0;
}