Skip to content
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

[Bug] Fix Beeline SQL querying cannot be stopped immediately by pressing Ctrl-C. #6869

Open
3 of 4 tasks
Whojohn opened this issue Dec 26, 2024 · 5 comments · May be fixed by #6879
Open
3 of 4 tasks

[Bug] Fix Beeline SQL querying cannot be stopped immediately by pressing Ctrl-C. #6869

Whojohn opened this issue Dec 26, 2024 · 5 comments · May be fixed by #6879
Labels
kind:bug This is a clearly a bug priority:major

Comments

@Whojohn
Copy link

Whojohn commented Dec 26, 2024

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Describe the bug

Which case i try

Problem in beeline sitiation

./bin/beeline  --incremental=true --verbose=true --incrementalBufferRows=1 --outputformat=table -u 'jdbc:hive2://dev:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=kyuubi;#kyuubi.engine.type=FLINK_SQL'

select sum(a),count(b) from sou
+--------------+---------+------------+
|    EXPR$0    | EXPR$1  | op_inside  |
+--------------+---------+------------+
| -1861035379  | 1       | +I         |
| -1861035379  | 1       | -U         |
| -317406356  | 2       | +U         |
| -317406356  | 2       | -U         |
| -684766290  | 3       | +U         |
| -684766290  | 3       | -U         |
| -15267534  | 4       | +U         |
| -15267534  | 4       | -U         |
| 2073227048  | 5       | +U         |
| 2073227048  | 5       | -U         |
| -734011806  | 6       | +U         |
| -734011806  | 6       | -U         |
| 786777747  | 7       | +U         |
| 786777747  | 7       | -U         |
| -707027945  | 8       | +U         |
Interrupting... Please be patient this may take some time.
Interrupting... Please be patient this may take some time.
Interrupting... Please be patient this may take some time.
Interrupting... Please be patient this may take some time.
Interrupting... Please be patient this may take some time.
Interrupting... Please be patient this may take some time.
Interrupting... Please be patient this may take some time.
| -707027945  | 8       | -U         |
| -681694912  | 9       | +U         |
| -681694912  | 9       | -U         |
| 950626509  | 10      | +U         |
| 950626509  | 10      | -U         |
| -1337848862  | 11      | +U         |
| -1337848862  | 11      | -U         |
| 2077867031  | 12      | +U         |
| 2077867031  | 12      | -U         |
| 1993739972  | 13      | +U         |
| 1993739972  | 13      | -U         |
| 1204146208  | 14      | +U         |
| 1204146208  | 14      | -U         |

------------- no matter how many ctrl-c send , it will stop  until kyuubi.session.engine.flink.max.rows is reach.
--

problem in KyuubiHiveDriver jdbc

  • my code as follwing using
connection = DriverManager.getConnection("jdbc:hive2://localhost:10009/#kyuubi.engine.type=FLINK_SQL", null,
                null);
        statement = connection.createStatement();
        statement.setFetchSize(1);
        statement.execute("create  table sou(a int,b string) with ('connector' = 'datagen','rows-per-second' = '20')");
        resultSet = statement.executeQuery("select sum(a),count(a) from sou");
        int a = 0;
        while (resultSet.next()) {
            a += 1;
            if (a > 100) {
                // !!! notice   statement.cancel() will not stop flink job ;
                statement.cancel();
                break;
            }
        }
        // do more querying ;
  • flink sql cluster way(no matter how may cancel, it will still running util another query is send.)
Flink SQL> show jobs; 
+----------------------------------+----------+----------+-------------------------+
|                           job id | job name |   status |              start time |
+----------------------------------+----------+----------+-------------------------+
| a91f330664aa725067ff641cd3fd6651 |  collect | CANCELED | 2024-12-26T06:00:33.033 |
| f7a5538b8e510ccafa47830f982ed724 |  collect | CANCELED | 2024-12-26T03:39:15.653 |
| 85dca8c9ab2068f1d48f63add195882c |  collect |  RUNNING | 2024-12-26T06:01:18.028 |
+----------------------------------+----------+----------+-------------------------+
3 rows in set

Souce code readed

  1. I found any server/engine/flink log i can not see any log about cacnel receive .(debug log)
  2. Debug in beeline or jdbc , client send KyuubiStatement#cancle is ok ,but remote bug in AbstractBackendService#cancelOperation not receive and singal. (debug in engine)

both beeline and jdbc call KyuubiStatement#cancel to cancel.( guuest from code)

ps : if anybody help me how to debug in thrift cancel calling rpc , sumbit a pr is my pleasure; Forgive my poor English.

Affects Version(s)

1.9.3

Kyuubi Server Log Output

No response

Kyuubi Engine Log Output

No response

Kyuubi Server Configurations

export FLINK_HOME=/data/flink-1.17.2
export FLINK_HADOOP_CLASSPATH=/data/flink-1.17.2/lib/flink-shaded-hadoop-2-uber-2.10.2-10.0.jar
export JAVA_HOME="/data/jdk-11.0.25+9"

Kyuubi Engine Configurations

kyuubi.server.thrift.resultset.default.fetch.size    1
kyuubi.engine.jdbc.fetch.size                        1
hive.server2.thrift.resultset.default.fetch.size     1
kyuubi.operation.interrupt.on.cancel                 true

Additional context

No response

Are you willing to submit PR?

  • Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
  • No. I cannot submit a PR at this time.
@Whojohn Whojohn added kind:bug This is a clearly a bug priority:major labels Dec 26, 2024
Copy link

Hello @Whojohn,
Thanks for finding the time to report the issue!
We really appreciate the community's efforts to improve Apache Kyuubi.

@Whojohn
Copy link
Author

Whojohn commented Dec 26, 2024

Regardless of the rpc bug, fix this bug by follow way .(!!!danger way !!!)

hope anybody help me fix this in right way.

image image image image

@pan3793
Copy link
Member

pan3793 commented Dec 27, 2024

@Whojohn would you like to send a PR to fix it?

@Whojohn
Copy link
Author

Whojohn commented Dec 29, 2024

@Whojohn would you like to send a PR to fix it?

@pan3793 why not ? My pleasure. I will push a pr and fix this as a option config.

@Whojohn Whojohn changed the title [Bug] jdbc or beeline statement cancel is useless in flink [Bug] Fix Beeline SQL querying cannot be stopped immediately by pressing Ctrl-C. Jan 6, 2025
@Whojohn
Copy link
Author

Whojohn commented Jan 6, 2025

Problem Summary:

There are two situations where a Beeline query cannot be stopped:

  1. The current logic of the BufferedRows class causes it (data keeps coming in).
  2. The current implementation logic of Flink SQL and JDBC causes the query to not stop in streaming mode when there is no new data and the end has been reached (temporarily resolved by [FEATURE] Incremental result fetching for Flink engine #4806).

This PR only fixes the first situation.

PS:

Attempted to fix the issue without using the #4806 timeout, as the current overall process requires non-empty data to be sent. It needs to be modified to allow sending empty data, but the changes are too extensive (involving JDBC statement, flinksqlengine#IncrementalResultFetchIterator, etc.). Will the community consider such a disruptive fix for situation 2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug This is a clearly a bug priority:major
Projects
None yet
2 participants