-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.report/customerCustomers have encountered this bug.Customers have encountered this bug.severity/majorsig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
drop table if exists t1;
CREATE TABLE `t1` (`c1` varchar(100));
insert into t1 (c1)values("201801");
insert into t1 (c1)values("201801");
insert into t1 (c1)values("xxxxx");
insert into t1 (select * from t1);
-- run the last insert multiple times until you have 786432 rows in t1
set global tidb_mem_quota_query =10000000;
change tidb config to set tmp-storage-quota = 16500000
import java.sql.*;
public class MySQLCursorFetch {
public static void main(String[] args) {
String url = "jdbc:mysql://127.0.0.1:41501/test?useCursorFetch=true&defaultFetchSize=100";
String user = "root";
String password = "";
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection(url, user, password);
String query = "SELECT * FROM test.t1";
PreparedStatement pstmt = conn.prepareStatement(query);
pstmt.setFetchSize(100);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
String columnData = rs.getString("c1");
System.out.println("Processing row: " + columnData);
}
rs.close();
pstmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
java -cp .:/home/guojiangtao/tar_gz/jdbc/mysql-connector-j-9.2.0/mysql-connector-j-9.2.0.jar ./jdbc.java
(note: you need set up you java env and download mysql-connector-java first)
2. What did you expect to see? (Required)
return error like the following and the spilling files have been deleted.
java -cp .:/home/guojiangtao/tar_gz/jdbc/mysql-connector-j-9.2.0/mysql-connector-j-9.2.0.jar ./jdbc.java
java.sql.SQLException: Out Of Quota For Local Temporary Space!
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:114)
at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:612)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:320)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1058)
at MySQLCursorFetch.main(jdbc.java:22)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:484)
at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:208)
at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:135)
3. What did you see instead (Required)
spilling file didn't clean
4. What is your TiDB version? (Required)
v6.5.7
Metadata
Metadata
Assignees
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.report/customerCustomers have encountered this bug.Customers have encountered this bug.severity/majorsig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.