Skip to content

Commit

Permalink
feat: add bugs bypass of delete
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenglinli committed Aug 3, 2023
1 parent 777a0bf commit b4ad153
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/sqlancer/stonedb/StoneDBBugs.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public final class StoneDBBugs {
// INSERT IGNORE INTO t0(c0) VALUE (DEFAULT);
// SELECT t0.c0 FROM t0 WHERE 0.4; -- expect 1 but got 0
public static boolean bugNotReported1 = true;
// DELETE statements will result into crash, for example
// DELETE LOW_PRIORITY FROM t0;
// will result into crash
// DELETE QUICK IGNORE FROM t0 WHERE -1370759901;
public static boolean bugNotReported2 = true;

private StoneDBBugs() {
Expand Down
5 changes: 5 additions & 0 deletions src/sqlancer/stonedb/StoneDBProvider.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package sqlancer.stonedb;

import static sqlancer.stonedb.StoneDBBugs.bugNotReported2;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
Expand Down Expand Up @@ -76,6 +78,9 @@ private static int mapActions(StoneDBGlobalState globalState, Action a) {
case TABLE_CREATE:
return r.getInteger(0, 1);
case TABLE_DELETE:
if (bugNotReported2) {
return 0;
}
return r.getInteger(0, 10);
case TABLE_INSERT:
return r.getInteger(0, globalState.getOptions().getMaxNumberInserts());
Expand Down
4 changes: 1 addition & 3 deletions src/sqlancer/stonedb/gen/StoneDBTableDeleteGenerator.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package sqlancer.stonedb.gen;

import static sqlancer.stonedb.StoneDBBugs.bugNotReported2;

import java.util.stream.Collectors;

import sqlancer.Randomly;
Expand Down Expand Up @@ -31,7 +29,7 @@ public static SQLQueryAdapter generate(StoneDBGlobalState globalState) {
public SQLQueryAdapter getQuery() {
StoneDBTable randomTable = globalState.getSchema().getRandomTable();
sb.append("DELETE");
if (!bugNotReported2 && Randomly.getBoolean()) {
if (Randomly.getBoolean()) {
sb.append(" LOW_PRIORITY");
}
if (Randomly.getBoolean()) {
Expand Down

0 comments on commit b4ad153

Please sign in to comment.