Skip to content

Commit 6e85452

Browse files
committed
Add a method to specify whether a db creation action should be retried
1 parent bca8dde commit 6e85452

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/sqlancer/AbstractAction.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,14 @@ public interface AbstractAction<G> {
66

77
Query getQuery(G globalState) throws SQLException;
88

9+
/**
10+
* Specifies whether it makes sense to request a {@link Query}, when the previous call to {@link #getQuery(Object)}
11+
* returned a query that failed executing.
12+
*
13+
* @return whether retrying getting queries makes sense, if the first query failed executing.
14+
*/
15+
default boolean canBeRetried() {
16+
return true;
17+
}
18+
919
}

src/sqlancer/StatementExecutor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public void executeStatements() throws SQLException {
6565
do {
6666
query = nextAction.getQuery(globalState);
6767
success = globalState.executeStatement(query);
68-
} while (!success && nrTries++ < globalState.getOptions().getNrStatementRetryCount());
68+
} while (nextAction.canBeRetried() && !success
69+
&& nrTries++ < globalState.getOptions().getNrStatementRetryCount());
6970
} catch (IgnoreMeException e) {
7071

7172
}

0 commit comments

Comments
 (0)