From 36d3f078a6c56eac8ef2008d4c9d4131d9e24f07 Mon Sep 17 00:00:00 2001 From: nuno-faria Date: Tue, 12 Sep 2023 13:05:03 +0100 Subject: [PATCH] Retry CloseAuctions procedure in AuctionMark on rollback --- .../auctionmark/AuctionMarkWorker.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkWorker.java b/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkWorker.java index 2ceb6a659..1dc1cfa27 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkWorker.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/auctionmark/AuctionMarkWorker.java @@ -447,8 +447,24 @@ protected boolean executeCloseAuctions(Connection conn, CloseAuctions proc) thro Timestamp startTime = profile.getLastCloseAuctionsTime(); Timestamp endTime = profile.updateAndGetLastCloseAuctionsTime(); - List results = proc.run(conn, benchmarkTimes, startTime, endTime); - + List results = null; + boolean done = false; + // Retry here the close auction procedure if it fails due to a transactional conflict, since + // the original submitted procedured has a different type. + while (!done) { + try { + results = proc.run(conn, benchmarkTimes, startTime, endTime); + done = true; + } + catch (SQLException e) { + if (e.getSQLState().startsWith("40")) { + conn.rollback(); + } + else { + throw e; + } + } + } for (Object[] row : results) { ItemId itemId = this.processItemRecord(row);