Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Status

Current state: "Under Discussion"

...

Page properties


...

...

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-27344

...

Release


Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

With the efforts in FLIP-24 and FLIP-91, Flink SQL client supports submitting SQL jobs but lacks further support for their lifecycles afterward which is crucial for streaming use cases. That means Flink SQL client users have to turn to other clients (e.g. CLI) or APIs (e.g. REST API) to manage the jobs, like triggering savepoints or canceling queries, which makes the user experience of SQL client incomplete. 

...

Code Block
languagesql
titleSyntax: STOP JOB
STOP JOB '<job_id>' [WITH SAVEPOINT] | [WITH DRAIN]

The result would the savepoint path.

...

Code Block
languagesql
Flink SQL> INSERT INTO tbl_a SELECT * FROM tbl_b;
[INFO] Submitting SQL update statement to the cluster...
[INFO] SQL update statement has been successfully submitted to the cluster:
Job ID: 6b1af540c0c0bb3fcfcad50ac037c862

Flink SQL> SHOW QUERIESJOBS;
+----------------------------------+--------------------+---------+---------------------+---------------------+-------------+----------------------+
|           job_id                 |       job_name     | status  |    start_time       |      end_time       |   duration  |       web_url        |
+----------------------------------+--------------------+---------|---------------------|---------------------|-------------|----------------------|
| 6b1af540c0c0bb3fcfcad50ac037c862 | INSERT INTO tbl_a..| RUNNING | 2022-05-01 10:20:33 | 2022-05-01 10:20:53 |  0h 0m 20s  | http://127.0.0.1:8081|
+----------------------------------+--------------------+---------+---------------------+---------------------+-------------+----------------------+

Flink SQL > CREATE SAVEPOINT FOR JOB '6b1af540c0c0bb3fcfcad50ac037c862';
+------------------------------------------------------------------|
|                            savepoint_path                        |
+------------------------------------------------------------------|
| hdfs://mycluster/flink-savepoints/savepoint-cca7bc-bb1e257f0dab  |
+------------------------------------------------------------------|

Flink SQL > STOP JOB '6b1af540c0c0bb3fcfcad50ac037c862';
[INFO] The specified job is stopped.

Flink SQL > DROP SAVEPOINT 'hdfs://mycluster/flink-savepoints/savepoint-cca7bc-bb1e257f0dab';
[INFO] The specified savepoint is dropped.

...