@@ -20,9 +20,9 @@ int main (int argc, char* argv[])
20
20
set<string> prepared_xacts;
21
21
set<string> committed_xacts;
22
22
bool verbose = false ;
23
- for (int i = 1 ; i < argc; i++) {
24
- if (argv[i][0 ] == ' -' ) {
25
- switch (argv[i][1 ]) {
23
+ for (int i = 1 ; i < argc; i++) {
24
+ if (argv[i][0 ] == ' -' ) {
25
+ switch (argv[i][1 ]) {
26
26
case ' C' :
27
27
case ' c' :
28
28
connections.push_back (string (argv[++i]));
@@ -39,12 +39,12 @@ int main (int argc, char* argv[])
39
39
" \t -v\t verbose mode: print extra information while processing\n " );
40
40
return 1 ;
41
41
}
42
- if (verbose) {
42
+ if (verbose) {
43
43
cout << " Collecting information about prepared transactions...\n " ;
44
44
}
45
45
for (vector<string>::iterator ic = connections.begin (); ic != connections.end (); ++ic)
46
46
{
47
- if (verbose) {
47
+ if (verbose) {
48
48
cout << " Connecting to " << *ic << " ...\n " ;
49
49
}
50
50
connection con (*ic);
@@ -57,17 +57,17 @@ int main (int argc, char* argv[])
57
57
}
58
58
txn.commit ();
59
59
}
60
- if (verbose) {
60
+ if (verbose) {
61
61
cout << " Prepared transactions: " ;
62
62
for (set<string>::iterator it = prepared_xacts.begin (); it != prepared_xacts.end (); ++it)
63
63
{
64
64
cout << *it << " , " ;
65
65
}
66
66
cout << " \n Checking which of them are committed...\n " ;
67
- }
67
+ }
68
68
for (vector<string>::iterator ic = connections.begin (); ic != connections.end (); ++ic)
69
69
{
70
- if (verbose) {
70
+ if (verbose) {
71
71
cout << " Connecting to " << *ic << " ...\n " ;
72
72
}
73
73
connection con (*ic);
@@ -83,17 +83,17 @@ int main (int argc, char* argv[])
83
83
}
84
84
txn.commit ();
85
85
}
86
- if (verbose) {
86
+ if (verbose) {
87
87
cout << " Committed transactions: " ;
88
88
for (set<string>::iterator it = committed_xacts.begin (); it != committed_xacts.end (); ++it)
89
89
{
90
90
cout << *it << " , " ;
91
91
}
92
92
cout << " \n Committing them at all nodes...\n " ;
93
- }
93
+ }
94
94
for (vector<string>::iterator ic = connections.begin (); ic != connections.end (); ++ic)
95
95
{
96
- if (verbose) {
96
+ if (verbose) {
97
97
cout << " Connecting to " << *ic << " ...\n " ;
98
98
}
99
99
connection con (*ic);
@@ -108,12 +108,12 @@ int main (int argc, char* argv[])
108
108
result rc = txn.prepared (" commit-check" )(gid).exec ();
109
109
if (rc.empty ()) {
110
110
if (committed_xacts.find (gid) != committed_xacts.end ()) {
111
- if (verbose) {
111
+ if (verbose) {
112
112
cout << " Commit transaction " << gid << " \n " ;
113
113
}
114
114
txn.prepared (" commit-prepared" )(gid);
115
- } else {
116
- if (verbose) {
115
+ } else {
116
+ if (verbose) {
117
117
cout << " Rollback transaction " << gid << " \n " ;
118
118
}
119
119
txn.prepared (" rollback-prepared" )(gid);
@@ -122,8 +122,8 @@ int main (int argc, char* argv[])
122
122
}
123
123
txn.commit ();
124
124
}
125
- if (verbose) {
125
+ if (verbose) {
126
126
cout << " Recovery completed\n " ;
127
127
}
128
128
return 0 ;
129
- }
129
+ }
0 commit comments