-
Couldn't load subscription status.
- Fork 13.7k
[FLINK-38516][Table SQL/Gateway] Add config for read-only sql gateway #27118
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -250,6 +250,12 @@ $ ./sql-gateway -Dkey=value | |||||
| <td>Duration</td> | ||||||
| <td>Keepalive time for an idle worker thread. When the number of workers exceeds min workers, excessive threads are killed after this time interval.</td> | ||||||
| </tr> | ||||||
| <tr> | ||||||
| <td><h5>sql-gateway.read-only</h5></td> | ||||||
| <td style="word-wrap: break-word;">5 min</td> | ||||||
| <td>Duration</td> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <td>When enabled, the SQL Gateway operates in read-only mode and will reject all modify operations.</td> | ||||||
| </tr> | ||||||
| <tr> | ||||||
| <td><h5>sql-gateway.worker.threads.max</h5></td> | ||||||
| <td style="word-wrap: break-word;">500</td> | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,7 @@ | |
| import org.apache.flink.table.factories.PlannerFactoryUtil; | ||
| import org.apache.flink.table.functions.FunctionDefinition; | ||
| import org.apache.flink.table.functions.FunctionIdentifier; | ||
| import org.apache.flink.table.gateway.api.config.SqlGatewayServiceConfigOptions; | ||
| import org.apache.flink.table.gateway.api.operation.OperationHandle; | ||
| import org.apache.flink.table.gateway.api.results.FunctionInfo; | ||
| import org.apache.flink.table.gateway.api.results.TableInfo; | ||
|
|
@@ -681,6 +682,17 @@ private ResultFetcher callModifyOperations( | |
| TableEnvironmentInternal tableEnv, | ||
| OperationHandle handle, | ||
| List<ModifyOperation> modifyOperations) { | ||
| // Check if SQL Gateway is in read-only mode | ||
| Configuration configuration = sessionContext.getSessionConf().clone(); | ||
| configuration.addAll(executionConfig); | ||
| boolean isReadOnlyMode = | ||
| configuration.get(SqlGatewayServiceConfigOptions.SQL_GATEWAY_READ_ONLY_MODE); | ||
|
|
||
| if (isReadOnlyMode) { | ||
| throw new SqlExecutionException( | ||
| "SQL Gateway is in read-only mode. Modify operations are not allowed."); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel it's useful to show the |
||
| } | ||
|
|
||
| TableResultInternal result = tableEnv.executeInternal(modifyOperations); | ||
| // DeleteFromFilterOperation doesn't have a JobClient | ||
| if (modifyOperations.size() == 1 | ||
|
|
||
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.
You meant
falseas default value?