Skip to content

Commit 09b7558

Browse files
committed
Add an option to specify how often a statement kind should be retried
1 parent 16b038f commit 09b7558

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/sqlancer/MainOptions.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public class MainOptions {
2525
"--num_queries" }, description = "Specifies the number of queries to be issued to a database before creating a new database")
2626
private int nrQueries = 100000;
2727

28+
@Parameter(names = {
29+
"--num_statement_kind_retries" }, description = "Specifies the number of times a specific statement kind (e.g., INSERT) should be retried when the DBMS indicates that it failed")
30+
private int nrStatementRetryCount = 1000;
31+
2832
@Parameter(names = "--log-each-select", description = "Logs every statement issued", arity = 1)
2933
private boolean logEachSelect = true;
3034

@@ -55,6 +59,10 @@ public int getNrQueries() {
5559
public int getMaxNumberInserts() {
5660
return maxNumberInserts;
5761
}
62+
63+
public int getNrStatementRetryCount() {
64+
return nrStatementRetryCount;
65+
}
5866

5967
public static enum DBMS {
6068
MariaDB, SQLite3, MySQL, PostgreSQL, TDEngine, CockroachDB, TiDB

src/sqlancer/StatementExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void executeStatements() throws SQLException {
6969
globalState.getLogger().writeCurrent(query.getQueryString());
7070
}
7171
success = globalState.getManager().execute(query);
72-
} while (!success && nrTries++ < 1000);
72+
} while (!success && nrTries++ < globalState.getOptions().getNrStatementRetryCount());
7373
} catch (IgnoreMeException e) {
7474

7575
}

0 commit comments

Comments
 (0)