Skip to content

Commit

Permalink
Workload output enhancements
Browse files Browse the repository at this point in the history
- Remove verbose transaction logging and replace with a summary
- Remove unneeded defensive queue drain
  • Loading branch information
geoffxy committed Nov 14, 2023
1 parent f1977f6 commit 61aca40
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 0 additions & 2 deletions workloads/IMDB_extended/run_repeating_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ def noop(_signal, _frame):
os.fsync(file.fileno())
file.close()
database.close_sync()
# Make sure the queue is drained.
_ = stop_queue.get_nowait()


def simulation_runner(
Expand Down
9 changes: 9 additions & 0 deletions workloads/IMDB_extended/run_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ def noop_handler(_signal, _frame):
file=latency_file,
)

# Warn if the abort rate is high.
total_aborts = sum(aborts)
total_commits = sum(commits)
abort_rate = total_aborts / (total_aborts + total_commits)
if abort_rate > 0.15:
print(
f"[T {worker_idx}] Abort rate is higher than expected ({abort_rate:.4f})."
)

try:
_ = stop_queue.get_nowait()
break
Expand Down
9 changes: 6 additions & 3 deletions workloads/IMDB_extended/workload_utils/transaction_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def edit_movie_note(self, db: Database) -> bool:
return True

except: # pylint: disable=bare-except
logger.exception("Need to rollback.")
# This is too verbose when we have a lot of clients hitting the DB.
# logger.exception("Need to rollback.")
db.rollback_sync()
return False

Expand Down Expand Up @@ -150,7 +151,8 @@ def add_new_showing(self, db: Database) -> bool:
return True

except: # pylint: disable=bare-except
logger.exception("Need to rollback.")
# This is too verbose when we have a lot of clients hitting the DB.
# logger.exception("Need to rollback.")
db.rollback_sync()
return False

Expand Down Expand Up @@ -225,7 +227,8 @@ def purchase_tickets(self, db: Database, select_using_name: bool) -> bool:
return False

except: # pylint: disable=bare-except
logger.exception("Need to rollback.")
# This is too verbose when we have a lot of clients hitting the DB.
# logger.exception("Need to rollback.")
db.rollback_sync()
return False

Expand Down

0 comments on commit 61aca40

Please sign in to comment.