-
Notifications
You must be signed in to change notification settings - Fork 11
/
bench_tpcc.cpp
44 lines (34 loc) · 1.37 KB
/
bench_tpcc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "benchmark/tpcc/Database.h"
#include "core/Coordinator.h"
#include "core/Macros.h"
DEFINE_bool(operation_replication, false, "use operation replication");
DEFINE_string(query, "neworder", "tpcc query, mixed, neworder, payment");
DEFINE_int32(neworder_dist, 10, "new order distributed.");
DEFINE_int32(payment_dist, 15, "payment distributed.");
// ./main --logtostderr=1 --id=1 --servers="127.0.0.1:10010;127.0.0.1:10011"
// cmake -DCMAKE_BUILD_TYPE=Release
int main(int argc, char *argv[]) {
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
google::ParseCommandLineFlags(&argc, &argv, true);
star::tpcc::Context context;
SETUP_CONTEXT(context);
context.operation_replication = FLAGS_operation_replication;
if (FLAGS_query == "mixed") {
context.workloadType = star::tpcc::TPCCWorkloadType::MIXED;
} else if (FLAGS_query == "neworder") {
context.workloadType = star::tpcc::TPCCWorkloadType::NEW_ORDER_ONLY;
} else if (FLAGS_query == "payment") {
context.workloadType = star::tpcc::TPCCWorkloadType::PAYMENT_ONLY;
} else {
CHECK(false);
}
context.newOrderCrossPartitionProbability = FLAGS_neworder_dist;
context.paymentCrossPartitionProbability = FLAGS_payment_dist;
star::tpcc::Database db;
db.initialize(context);
star::Coordinator c(FLAGS_id, db, context);
c.connectToPeers();
c.start();
return 0;
}