Skip to content

Commit 73a2b5d

Browse files
committed
Use async commit
1 parent 79aafd9 commit 73a2b5d

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tests/dtmbench.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ void exec(transaction_base& txn, char const* sql, ...)
101101
txn.exec(buf);
102102
}
103103

104+
void insert(pipeline& pipe, char const* sql, ...)
105+
{
106+
va_list args;
107+
va_start(args, sql);
108+
char buf[1024];
109+
vsprintf(buf, sql, args);
110+
va_end(args);
111+
pipe.insert(buf);
112+
}
113+
104114
xid_t execQuery( transaction_base& txn, char const* sql, ...)
105115
{
106116
va_list args;
@@ -194,15 +204,19 @@ void* writer(void* arg)
194204
continue;
195205
}
196206

197-
#if 1
198-
exec(srcTx, "prepare transaction '%u'", xid);
199-
exec(dstTx, "prepare transaction '%u'", xid);
200-
exec(srcTx, "commit prepared '%u'", xid);
201-
exec(dstTx, "commit prepared '%u'", xid);
202-
#else
203207
pipeline srcPipe(srcTx);
204208
pipeline dstPipe(dstTx);
205209

210+
#if 1
211+
insert(srcPipe, "prepare transaction '%u'", xid);
212+
insert(dstPipe, "prepare transaction '%u'", xid);
213+
srcPipe.complete();
214+
dstPipe.complete();
215+
insert(srcPipe, "commit prepared '%u'", xid);
216+
insert(dstPipe, "commit prepared '%u'", xid);
217+
srcPipe.complete();
218+
dstPipe.complete();
219+
#else
206220
srcPipe.insert("commit transaction");
207221
dstPipe.insert("commit transaction");
208222

0 commit comments

Comments
 (0)