Skip to content

Commit f0a973a

Browse files
authored
fix(p4): default to 10 nfts for terrier bench (#558)
* fix(p4): default to 10 nfts for terrier bench Signed-off-by: Alex Chi <[email protected]> * fix: only check non-repeatable when txn succeed Signed-off-by: Alex Chi <[email protected]> --------- Signed-off-by: Alex Chi <[email protected]>
1 parent dadb42b commit f0a973a

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

tools/terrier_bench/terrier.cpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,10 @@ struct TerrierTotalMetrics {
6969

7070
fmt::print("<<< BEGIN\n");
7171

72-
if (verify_txn_per_sec > 3) {
73-
// ensure the verifying thread is not blocked
74-
fmt::print("update: {}\n", update_txn_per_sec);
75-
fmt::print("count: {}\n", count_txn_per_sec);
76-
fmt::print("verify: {}\n", verify_txn_per_sec);
77-
} else {
78-
fmt::print("update: {}\n", 0);
79-
fmt::print("count: {}\n", 0);
80-
fmt::print("verify: {}\n", verify_txn_per_sec);
81-
}
72+
// ensure the verifying thread is not blocked
73+
fmt::print("update: {}\n", update_txn_per_sec);
74+
fmt::print("count: {}\n", count_txn_per_sec);
75+
fmt::print("verify: {}\n", verify_txn_per_sec);
8276

8377
fmt::print(">>> END\n");
8478
}
@@ -141,7 +135,7 @@ auto main(int argc, char **argv) -> int {
141135
program.add_argument("--force-enable-update").help("use update statement in terrier bench");
142136
program.add_argument("--nft").help("number of NFTs in the bench");
143137

144-
size_t bustub_nft_num = 100;
138+
size_t bustub_nft_num = 10;
145139

146140
try {
147141
program.parse_args(argc, argv);
@@ -410,15 +404,15 @@ auto main(int argc, char **argv) -> int {
410404
if (all_nfts_integer.size() != bustub_nft_num) {
411405
fmt::print("unexpected result when verifying length. scan result: {}, total rows: {}.\n",
412406
all_nfts_integer.size(), bustub_nft_num);
413-
if (bustub_nft_num < 100) {
407+
if (bustub_nft_num <= 100) {
414408
fmt::print("This is everything in your database:\n{}", ss.str());
415409
}
416410
exit(1);
417411
}
418412
for (int i = 0; i < static_cast<int>(bustub_nft_num); i++) {
419413
if (all_nfts_integer[i] != i) {
420414
fmt::print("unexpected result when verifying \"{} == {}\",\n", i, all_nfts_integer[i]);
421-
if (bustub_nft_num < 100) {
415+
if (bustub_nft_num <= 100) {
422416
fmt::print("This is everything in your database:\n{}", ss.str());
423417
}
424418
exit(1);
@@ -435,16 +429,15 @@ auto main(int argc, char **argv) -> int {
435429
txn_success = false;
436430
}
437431

438-
if (ss.str() != prev_result) {
439-
fmt::print("ERROR: non repeatable read!\n");
440-
if (bustub_nft_num < 100) {
441-
fmt::print("This is everything in your database:\n--- previous query ---\n{}\n--- this query ---\n{}\n",
442-
prev_result, ss.str());
443-
}
444-
exit(1);
445-
}
446-
447432
if (txn_success) {
433+
if (ss.str() != prev_result) {
434+
fmt::print("ERROR: non repeatable read!\n");
435+
if (bustub_nft_num <= 100) {
436+
fmt::print("This is everything in your database:\n--- previous query ---\n{}\n--- this query ---\n{}\n",
437+
prev_result, ss.str());
438+
}
439+
exit(1);
440+
}
448441
bustub->txn_manager_->Commit(txn);
449442
metrics.TxnCommitted();
450443
} else {
@@ -500,5 +493,11 @@ auto main(int argc, char **argv) -> int {
500493

501494
total_metrics.Report();
502495

496+
if (total_metrics.committed_verify_txn_cnt_ <= 3 || total_metrics.committed_update_txn_cnt_ < 3 ||
497+
total_metrics.committed_count_txn_cnt_ < 3) {
498+
fmt::print("too many txn are aborted");
499+
exit(1);
500+
}
501+
503502
return 0;
504503
}

0 commit comments

Comments
 (0)