1# $Id$
2#
3# Read through db_printlog output and list all the transactions encountered
4# and whether they committed or aborted.
5#
6# 1 = started
7# 2 = committed
8# 3 = explicitly aborted
9# 4 = other
10BEGIN {
11	cur_txn = 0
12}
13/^\[.*]\[/{
14	in_regop = 0
15	if (status[$5] == 0) {
16		status[$5] = 1;
17		txns[cur_txn] = $5;
18		cur_txn++;
19	}
20}
21/	child:/ {
22	txnid = substr($2, 3);
23	status[txnid] = 2;
24}
25/txn_regop/ {
26	txnid = $5
27	in_regop = 1
28}
29/opcode:/ {
30	if (in_regop == 1) {
31		if ($2 == 1)
32			status[txnid] = 2
33		else if ($2 == 3)
34			status[txnid] = 3
35		else
36			status[txnid] = 4
37	}
38}
39END {
40	for (i = 0; i < cur_txn; i++) {
41		if (status[txns[i]] == 1)
42			printf("%s\tABORT\n", txns[i]);
43		else if (status[txns[i]] == 2)
44			printf("%s\tCOMMIT\n", txns[i]);
45		else if (status[txns[i]] == 3)
46			printf("%s\tABORT\n", txns[i]);
47		else if (status[txns[i]] == 4)
48			printf("%s\tOTHER\n", txns[i]);
49	}
50}
51