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

@ -22,7 +22,7 @@
/*
* A tool to print current transactions & roll them back if necessary.
*
*
* A tool to print current transactions & roll them back if necessary.
* The proper way to use it is:
* rollback -p (to get the transaction(s) that need to be rolled back)
@ -42,69 +42,83 @@ using namespace BRM;
void help(string name)
{
cout << "Usage: " << endl << name << " -r txnID" << endl;
cout << name << " -p" << endl << endl;
cout << "Options:" << endl;
cout << " -r -- rollback a transaction in the BRM data structures" << endl;
cout << " -p -- print current transactions according to the BRM" << endl;
cout << "Usage: " << endl << name << " -r txnID" << endl;
cout << name << " -p" << endl << endl;
cout << "Options:" << endl;
cout << " -r -- rollback a transaction in the BRM data structures" << endl;
cout << " -p -- print current transactions according to the BRM" << endl;
}
void printTxnIDs()
void printTxnIDs()
{
DBRM brm;
set<VER_t> txnList;
set<VER_t>::iterator it;
int err;
DBRM brm;
set<VER_t> txnList;
set<VER_t>::iterator it;
int err;
err = brm.getCurrentTxnIDs(txnList);
if (err != 0)
return;
for (it = txnList.begin(); it != txnList.end(); it++)
cout << *it << endl;
err = brm.getCurrentTxnIDs(txnList);
if (err != 0)
return;
for (it = txnList.begin(); it != txnList.end(); it++)
cout << *it << endl;
}
void rollbackTxn(VER_t txnID)
{
DBRM brm;
vector<LBID_t> lbidList;
int err;
DBRM brm;
vector<LBID_t> lbidList;
int err;
err = brm.getUncommittedLBIDs(txnID, lbidList);
if (err != 0)
return;
err = brm.vbRollback(txnID, lbidList);
if (err != 0)
return;
cout << "OK." << endl;
err = brm.getUncommittedLBIDs(txnID, lbidList);
if (err != 0)
return;
err = brm.vbRollback(txnID, lbidList);
if (err != 0)
return;
cout << "OK." << endl;
}
int main(int argc, char **argv) {
int main(int argc, char** argv)
{
int opt;
char options[] = "pr:";
VER_t txnID = -1;
string progname(argv[0]);
int opt;
char options[] = "pr:";
VER_t txnID = -1;
string progname(argv[0]);
while ((opt = getopt (argc, argv, options)) != -1) {
switch (opt) {
case 'r':
txnID = atoi (optarg);
if (txnID < 1) {
help(progname);
exit(0);
}
idbdatafile::IDBPolicy::configIDBPolicy();
rollbackTxn(txnID);
exit(0);
case 'p':
printTxnIDs();
exit(0);
}
}
help(progname);
exit(0);
while ((opt = getopt (argc, argv, options)) != -1)
{
switch (opt)
{
case 'r':
txnID = atoi (optarg);
if (txnID < 1)
{
help(progname);
exit(0);
}
idbdatafile::IDBPolicy::configIDBPolicy();
rollbackTxn(txnID);
exit(0);
case 'p':
printTxnIDs();
exit(0);
}
}
help(progname);
exit(0);
}