-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add expected errors in MariaDB #834
base: main
Are you sure you want to change the base?
Conversation
It seems SQLancer triggers another issue in MariaDB? |
I reproduced the queries on Ubuntu 22.04 and found the following: The statements I run are: DROP DATABASE IF EXISTS database11;
CREATE DATABASE database11;
USE database11;
CREATE OR REPLACE TABLE t0(c0 MEDIUMINT UNIQUE, c1 VARCHAR(100) , c2 REAL UNIQUE PRIMARY KEY);
CREATE OR REPLACE TABLE t1(c0 VARCHAR(100) NOT NULL) engine=Aria;
CREATE OR REPLACE TABLE t2 LIKE t1;
SET SESSION autocommit = 1;
TRUNCATE t0 NOWAIT;
OPTIMIZE TABLE t0 NOWAIT; Question 1: It seams that table |
1: I think it can be solved by checking whether the table uses the InnoDB storage engine. If it is difficult, we can simply ignore it as it is not a significant issue. |
--java.lang.AssertionError: INSERT INTO t0 VALUES (-1497191741);
-- at sqlancer.common.query.SQLQueryAdapter.checkException(SQLQueryAdapter.java:111)
-- at sqlancer.common.query.SQLQueryAdapter.execute(SQLQueryAdapter.java:93)
-- at sqlancer.Main$QueryManager.execute(Main.java:265)
-- at sqlancer.GlobalState.executeStatement(GlobalState.java:108)
-- at sqlancer.mariadb.MariaDBProvider.generateDatabase(MariaDBProvider.java:151)
-- at sqlancer.mariadb.MariaDBProvider.generateDatabase(MariaDBProvider.java:1)
-- at sqlancer.ProviderAdapter.generateAndTestDatabase(ProviderAdapter.java:52)
-- at sqlancer.Main$DBMSExecutor.run(Main.java:364)
-- at sqlancer.Main$2.run(Main.java:559)
-- at sqlancer.Main$2.runThread(Main.java:541)
-- at sqlancer.Main$2.run(Main.java:532)
-- at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
-- at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
-- at java.base/java.lang.Thread.run(Thread.java:829)
--Caused by: java.sql.SQLSyntaxErrorException: (conn=570) Table 'database11.t0' doesn't exist
-- at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:282)
-- at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:370)
-- at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:134)
-- at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:855)
-- at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:794)
-- at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:713)
-- at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:637)
-- at org.mariadb.jdbc.Statement.executeInternal(Statement.java:941)
-- at org.mariadb.jdbc.Statement.execute(Statement.java:1067)
-- at org.mariadb.jdbc.Statement.execute(Statement.java:458)
-- at sqlancer.common.query.SQLQueryAdapter.execute(SQLQueryAdapter.java:87)
-- ... 12 more
---- Time: 2023/06/21 12:30:12
-- Database: database11
-- Database version: 10.3.38-MariaDB-0ubuntu0.20.04.1
-- seed value: 11
DROP DATABASE IF EXISTS database11;
CREATE DATABASE database11;
USE database11;
CREATE OR REPLACE TABLE t0(c0 BOOLEAN UNIQUE);
SET SESSION myisam_stats_method = nulls_unequal;
SET SESSION join_cache_level = 5;
INSERT INTO t0 VALUES (299405238);
CHECKSUM TABLE t0;
INSERT INTO t0 VALUES (-486923179);
INSERT INTO t0 VALUES (-471262417);
SET SESSION optimizer_search_depth = 4;
INSERT INTO t0 VALUES (618607252);
INSERT INTO t0 VALUES (-433413318);
INSERT INTO t0 VALUES (266645617);
SET SESSION max_length_for_sort_data = 3932438;
SET SESSION sql_auto_is_null = ON;
INSERT INTO t0 VALUES (916765166);
SET SESSION sql_log_off = ON;
SET SESSION max_sort_length = 6112935;
INSERT INTO t0 VALUES (550488471);
SET SESSION optimizer_prune_level = 0;
INSERT INTO t0 VALUES (499498418);
INSERT INTO t0 VALUES (1540761514);
SET SESSION autocommit = 1;
SET SESSION unique_checks = ON;
SET SESSION join_cache_level = 5;
INSERT INTO t0 VALUES (1476203969);
INSERT INTO t0 VALUES (-2079398998);
SET SESSION join_cache_level = 1;
INSERT INTO t0 VALUES (-839316519);
TRUNCATE t0 WAIT 1;
SET SESSION sql_buffer_result = OFF;
INSERT INTO t0 VALUES (1712230220);
SET SESSION sql_quote_show_create = OFF;
INSERT INTO t0 VALUES (1984650463);
INSERT INTO t0 VALUES (NULL);
|
1 I guess only innodb engines can not use optimization, so perhaps you can use storage engine to identify it. |
It seams that the error message in CI is different from before (after force push), now the only CI error message is: How will we deal with it? Still add to expected errors? |
Seems it is a flaky issue that cannot be reproduced stably. |
@bajinsheng could you return this workflow accroding to https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs. I can not see the re-run bottom. |
Done. |
I can not reproduce the error besides GitHub Action. Acutally I found there are too many errors in the SQL queries we excuted. For example, we intern a I think the optimize operation is the cause but can not determine the root cause. How about adding one |
I think we are making a deliberate tradeoff here. Checking for all these different things is quite tedious, and by inserting invalid values, we can also test the DBMSs. Also see https://github.com/sqlancer/sqlancer/blob/main/CONTRIBUTING.md#expected-errors regarding data types. |
Did you use the same MariaDB version we use in the CI? I assume you also copied the statements for running the tests? |
Yes, the same version. Yes, copied the logs from CI. I tested again and found the reason for these two seccuss #834 (comment) here is that, SQLancer on my local mechine ran 0 queries and 0 was succesful, resulting the build success. So, the conclusion is that, the problem still exists. It can be reproduced in CI, although it can not be reproduced on my local ubuntu. I will try to reproduce it on my local ubuntu again. |
It seems like some kind of deadlock is triggered? |
I tested again in GitHub's Codespace (Ubuntu 22.04) and got 0 queries executed again. I am wondering if there are any errors with my commands. Could anyone help take a look? The commands I run are, (same as they in ci file): sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server
sudo service mysql start
sudo mysql -uroot -proot -e "CREATE USER 'sqlancer'@'localhost' IDENTIFIED BY 'sqlancer'; GRANT ALL PRIVILEGES ON * . * TO 'sqlancer'@'localhost';"
git clone https://github.com/sqlancer/sqlancer.git
cd sqlancer
MARIADB_AVAILABLE=true mvn -Dtest=TestMariaDB test |
Not sure what's the reason. Could you help take a look at the commands I ran above? |
It looks like a deadlock bug. If so, it is hard to bypass this bug in the CI. |
According to
|
You mean the 0 query bug? I solved it by running setting
Oh, yes, setting But the problem is that I still cannot reproduce the I analyzed the CI log and found all assertion errors were triggered by the optimize table statement, but all optimize table statements on my Ubuntu work fine. |
In this case, what about disabling |
So in this case, we need to report this issue to the MariaDB team and refer to their issue page? |
If you can produce a minimal test case to reproduce the issue, say executing several SQL statements triggers this deadlock, you can report it to MySQL. |
This would be ideal, as suggested by @bajinsheng, but we could also just refer to this PR for now (or create a separate issue in the repo so someone can investigate it in the future). |
Do not know why it is still reporting errors after we using https://github.com/sqlancer/sqlancer/blob/main/CONTRIBUTING.md#unfixed-bugs |
This error happens in the |
|
||
if (MariaDBBugs.bug835) { | ||
errors.add("Specified key was too long; max key length is 2300 bytes"); | ||
errors.add("Lock wait timeout exceeded; try restarting transaction"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought rather than setting the deadlock as expected, we could just skip generating the statement(s) causing it. Also, the ("Specified key was too long; max key length is 2300 bytes"
statement doesn't seem to be part of the bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- avoiding the generation of such statements also make sense. will try to do this
Specified key was too long; max key length is 2300 bytes
is a bug here: https://github.com/sqlancer/sqlancer/actions/runs/5357089828/jobs/9717469891
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks like a new limitation? In this case, we shouldn't consider it as a bug, but just add it as an expected error.
You disabled the |
Does this statement result in a deadlock? If so, we might want to avoid generating the statement, since otherwise, SQLancer cannot generate any additional tests. If not, adding an expected error might be better. |
@@ -126,6 +129,9 @@ public void generateDatabase(MariaDBGlobalState globalState) throws Exception { | |||
query = MariaDBInsertGenerator.insert(globalState.getSchema(), globalState.getRandomly()); | |||
break; | |||
case OPTIMIZE: | |||
if (MariaDBBugs.bug834) { | |||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here looks and below quite complex. Can we just set nrPerformed
to 0
?
After analsis, I think such a |
From the CI, it turned out that, presently, we got:
I think we also need add this errors into exected errors? |
Some of these seem like potential bugs that we should look into and potentially report. I guess this might take a while, so not sure if you might want to focus on StoneDB first? |
I asked @ZhengLin-Li to fix this ERROR in CI so that I can also merge his PR. Since this bug is hard to fix and you can help to merge pr, I think we can lower its priority now. |
ok, I will just add it to the todo list. |
fix: add expected errors in MariaDB