You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/07/06 03:10:56 UTC

[GitHub] [flink] deadwind4 opened a new pull request, #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

deadwind4 opened a new pull request, #20174:
URL: https://github.com/apache/flink/pull/20174

   ## What is the purpose of the change
   
   Introduce the script to start/stop/stop-all SQL gateway.
   
   ## Brief change log
   
     - *Add a `sql-gateway.sh` to*
     - *Add sqlgateway option in `flink-daemon.sh`*
   
   ## Verifying this change
   
   The shell script no test.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes)
     - If yes, how is the feature documented? (not documented)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] deadwind4 commented on a diff in pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
deadwind4 commented on code in PR #20174:
URL: https://github.com/apache/flink/pull/20174#discussion_r934328425


##########
flink-table/flink-sql-gateway/bin/sql-gateway.sh:
##########
@@ -0,0 +1,94 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+function usage() {
+  echo "Usage: sql-gateway.sh [start|start-foreground|stop|stop-all] [args]"
+  echo "  commands:"
+  echo "    start               - Run a SQL Gateway as a daemon"
+  echo "    start-foreground    - Run a SQL Gateway as a console application"
+  echo "    stop                - Stop the SQL Gateway daemon"
+  echo "    stop-all            - Stop all the SQL Gateway daemons"
+  echo "    -h | --help         - Show this help message"
+}
+
+################################################################################
+# Adopted from "flink" bash script
+################################################################################
+
+target="$0"
+# For the case, the executable has been directly symlinked, figure out
+# the correct bin path by following its symlink up to an upper bound.
+# Note: we can't use the readlink utility here if we want to be POSIX
+# compatible.
+iteration=0
+while [ -L "$target" ]; do
+    if [ "$iteration" -gt 100 ]; then
+        echo "Cannot resolve path: You have a cyclic symlink in $target."
+        break
+    fi
+    ls=`ls -ld -- "$target"`
+    target=`expr "$ls" : '.* -> \(.*\)$'`
+    iteration=$((iteration + 1))
+done
+
+# Convert relative path to absolute path
+bin=`dirname "$target"`
+
+# get flink config
+. "$bin"/config.sh
+
+if [ "$FLINK_IDENT_STRING" = "" ]; then
+        FLINK_IDENT_STRING="$USER"
+fi
+
+################################################################################
+# SQL gateway specific logic
+################################################################################
+
+ENTRYPOINT=sql-gateway
+
+if [[ "$1" = *--help ]] || [[ "$1" = *-h ]]; then
+  usage
+  exit 0
+fi
+
+STARTSTOP=$1
+
+if [ -z "$STARTSTOP" ]; then
+  STARTSTOP="start"
+fi
+
+if [[ $STARTSTOP != "start" ]] && [[ $STARTSTOP != "start-foreground" ]] && [[ $STARTSTOP != "stop" ]] && [[ $STARTSTOP != "stop-all" ]]; then
+  usage
+  exit 1
+fi
+
+# ./sql-gateway.sh start --help, print the message to the console
+if [[ "$STARTSTOP" = start* ]] && ( [[ "$*" = *--help ]] || [[ "$*" = *-h ]] ); then

Review Comment:
   ```suggestion
   if [[ "$STARTSTOP" = start* ]] && ( [[ "$*" = *--help* ]] || [[ "$*" = *-h* ]] ); then
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] fsk119 commented on pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
fsk119 commented on PR #20174:
URL: https://github.com/apache/flink/pull/20174#issuecomment-1202033234

   @flinkbot run azure 
   
   Unrelated test fails. Rerun the test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] deadwind4 commented on a diff in pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
deadwind4 commented on code in PR #20174:
URL: https://github.com/apache/flink/pull/20174#discussion_r934163870


##########
flink-dist/src/main/flink-bin/bin/flink-daemon.sh:
##########
@@ -131,7 +136,7 @@ case $STARTSTOP in
         FLINK_ENV_JAVA_OPTS=$(eval echo ${FLINK_ENV_JAVA_OPTS})
 
         echo "Starting $DAEMON daemon on host $HOSTNAME."
-        "$JAVA_RUN" $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} "${log_setting[@]}" -classpath "`manglePathList "$FLINK_TM_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" ${CLASS_TO_RUN} "${ARGS[@]}" > "$out" 200<&- 2>&1 < /dev/null &
+        "$JAVA_RUN" $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} "${log_setting[@]}" -classpath "`manglePathList "$FLINK_TM_CLASSPATH:$SQL_GATEWAY_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" ${CLASS_TO_RUN} "${ARGS[@]}" > "$out" 200<&- 2>&1 < /dev/null &

Review Comment:
   Should we revert this line? @fsk119 



##########
flink-dist/src/main/flink-bin/bin/flink-console.sh:
##########
@@ -111,4 +116,4 @@ echo $$ >> "$pid" 2>/dev/null
 # Evaluate user options for local variable expansion
 FLINK_ENV_JAVA_OPTS=$(eval echo ${FLINK_ENV_JAVA_OPTS})
 
-exec "$JAVA_RUN" $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} "${log_setting[@]}" -classpath "`manglePathList "$FLINK_TM_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" ${CLASS_TO_RUN} "${ARGS[@]}"
+exec "$JAVA_RUN" $JVM_ARGS ${FLINK_ENV_JAVA_OPTS} "${log_setting[@]}" -classpath "`manglePathList "$FLINK_TM_CLASSPATH:$SQL_GATEWAY_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" ${CLASS_TO_RUN} "${ARGS[@]}"

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] fsk119 closed pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
fsk119 closed pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway
URL: https://github.com/apache/flink/pull/20174


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] deadwind4 commented on pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
deadwind4 commented on PR #20174:
URL: https://github.com/apache/flink/pull/20174#issuecomment-1203568148

   LGTM. 牛!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] deadwind4 commented on a diff in pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
deadwind4 commented on code in PR #20174:
URL: https://github.com/apache/flink/pull/20174#discussion_r936167354


##########
flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/flink/LocalStandaloneFlinkResource.java:
##########
@@ -183,12 +185,49 @@ public ClusterController startCluster(int numTaskManagers) throws IOException {
         throw new RuntimeException("Cluster did not start in expected time-frame.");
     }
 
+    @Override
+    public GatewayController startSqlGateway() throws IOException {

Review Comment:
   ```suggestion
       public GatewayController startSqlGatewayAndFlinkCluster() throws IOException {
   ```



##########
flink-end-to-end-tests/flink-sql-gateway-test/src/test/java/org/apache/flink/table/gateway/SqlGatewayE2ECase.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.gateway;
+
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.table.catalog.hive.HiveCatalog;
+import org.apache.flink.table.endpoint.hive.HiveServer2Endpoint;
+import org.apache.flink.table.gateway.containers.HiveContainer;
+import org.apache.flink.test.util.SQLJobSubmission;
+import org.apache.flink.tests.util.TestUtils;
+import org.apache.flink.tests.util.flink.FlinkResource;
+import org.apache.flink.tests.util.flink.FlinkResourceSetup;
+import org.apache.flink.tests.util.flink.GatewayController;
+import org.apache.flink.tests.util.flink.JarLocation;
+import org.apache.flink.tests.util.flink.LocalStandaloneFlinkResourceFactory;
+import org.apache.flink.util.FileUtils;
+import org.apache.flink.util.NetUtils;
+import org.apache.flink.util.TestLogger;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import static org.apache.flink.table.catalog.hive.HiveCatalog.isEmbeddedMetastore;
+import static org.apache.flink.table.endpoint.hive.HiveServer2EndpointConfigOptions.CATALOG_HIVE_CONF_DIR;
+import static org.apache.flink.table.endpoint.hive.HiveServer2EndpointConfigOptions.THRIFT_PORT;
+import static org.apache.flink.tests.util.TestUtils.readCsvResultFiles;
+import static org.junit.Assert.assertEquals;
+
+/** E2E Tests for {@code SqlGateway} with {@link HiveServer2Endpoint}. */
+public class SqlGatewayE2ECase extends TestLogger {
+
+    private static final Path HIVE_SQL_CONNECTOR_JAR =
+            TestUtils.getResource(".*dependencies/flink-sql-connector-hive-.*.jar");
+    private static final Path HADOOP_CLASS_PATH = TestUtils.getResource(".*hadoop.classpath");
+    private static final String GATEWAY_E2E_SQL = "gateway_e2e.sql";
+    private static final Configuration ENDPOINT_CONFIG = new Configuration();
+    private static final String RESULT_KEY = "$RESULT";
+
+    @ClassRule public static final TemporaryFolder FOLDER = new TemporaryFolder();
+    @ClassRule public static final HiveContainer HIVE_CONTAINER = new HiveContainer();
+    @Rule public final FlinkResource flinkResource = buildFlinkResource();
+
+    private static NetUtils.Port port;
+
+    @BeforeClass
+    public static void beforeClass() {
+        ENDPOINT_CONFIG.setString(
+                getPrefixedConfigOptionName(CATALOG_HIVE_CONF_DIR), createHiveConf().getParent());
+    }
+
+    @AfterClass
+    public static void afterClass() throws Exception {
+        port.close();
+    }
+
+    @Test
+    public void testExecuteStatement() throws Exception {
+        URL url = SqlGatewayE2ECase.class.getClassLoader().getResource(GATEWAY_E2E_SQL);
+        if (url == null) {
+            throw new FileNotFoundException(GATEWAY_E2E_SQL);
+        }
+        File result = FOLDER.newFolder("csv");
+        String sql =
+                Files.readAllLines(new File(url.getFile()).toPath()).stream()
+                        .filter(line -> !line.trim().startsWith("--"))
+                        .collect(Collectors.joining());
+        List<String> lines =
+                Arrays.stream(sql.split(";"))
+                        .map(line -> line.replace(RESULT_KEY, result.getAbsolutePath()))
+                        .collect(Collectors.toList());
+
+        try (GatewayController controller = flinkResource.startSqlGateway()) {

Review Comment:
   ```suggestion
           try (GatewayController controller = flinkResource.startSqlGatewayAndFlinkCluster()) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #20174:
URL: https://github.com/apache/flink/pull/20174#issuecomment-1175734086

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "a450a5c63564932368e9a2f7ab3efb4d2d6e9b48",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "a450a5c63564932368e9a2f7ab3efb4d2d6e9b48",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a450a5c63564932368e9a2f7ab3efb4d2d6e9b48 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] fsk119 commented on a diff in pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
fsk119 commented on code in PR #20174:
URL: https://github.com/apache/flink/pull/20174#discussion_r928814365


##########
flink-table/flink-sql-gateway/bin/sql-gateway.sh:
##########
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Start/stop a Flink SQL Gateway.
+USAGE="Usage: sql-gateway.sh (start|start-foreground|stop|stop-all)"
+
+STARTSTOP=$1
+
+if [[ $STARTSTOP != "start" ]] && [[ $STARTSTOP != "start-foreground" ]] && [[ $STARTSTOP != "stop" ]] && [[ $STARTSTOP != "stop-all" ]]; then
+  echo $USAGE
+  exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/config.sh
+
+ENTRYPOINT=sqlgateway
+
+if [[ $STARTSTOP == "start" ]] || [[ $STARTSTOP == "start-foreground" ]]; then
+    # Add SqlGateway-specific JVM options
+    export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_JM}"
+    parseJmArgsAndExportLogs "${ARGS[@]}"
+
+    args=("--configDir" "${FLINK_CONF_DIR}" "--executionMode" "cluster")
+fi
+
+if [[ $STARTSTOP == "start-foreground" ]]; then
+    exec "${FLINK_BIN_DIR}"/flink-console.sh $ENTRYPOINT "${args[@]}"

Review Comment:
   If so, we also need to modify `flink-console.sh` to support sql-gateway. I think we can delay the support of the command `start-foreground.` 



##########
flink-table/flink-sql-gateway/bin/sql-gateway.sh:
##########
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Start/stop a Flink SQL Gateway.
+USAGE="Usage: sql-gateway.sh (start|start-foreground|stop|stop-all)"
+
+STARTSTOP=$1
+
+if [[ $STARTSTOP != "start" ]] && [[ $STARTSTOP != "start-foreground" ]] && [[ $STARTSTOP != "stop" ]] && [[ $STARTSTOP != "stop-all" ]]; then
+  echo $USAGE
+  exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/config.sh
+
+ENTRYPOINT=sqlgateway
+
+if [[ $STARTSTOP == "start" ]] || [[ $STARTSTOP == "start-foreground" ]]; then
+    # Add SqlGateway-specific JVM options
+    export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_JM}"
+    parseJmArgsAndExportLogs "${ARGS[@]}"
+
+    args=("--configDir" "${FLINK_CONF_DIR}" "--executionMode" "cluster")
+fi
+
+if [[ $STARTSTOP == "start-foreground" ]]; then
+    exec "${FLINK_BIN_DIR}"/flink-console.sh $ENTRYPOINT "${args[@]}"
+else
+    "${FLINK_BIN_DIR}"/flink-daemon.sh $STARTSTOP $ENTRYPOINT "${args[@]}"

Review Comment:
   It seems we can't convey the parameter, e.g. "-Dkey=value" to the gateway.



##########
flink-table/flink-sql-gateway/bin/sql-gateway.sh:
##########
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Start/stop a Flink SQL Gateway.
+USAGE="Usage: sql-gateway.sh (start|start-foreground|stop|stop-all)"
+

Review Comment:
   Why don't copy these lines from sql-client.sh?
   
   ```
   ################################################################################
   # Adopted from "flink" bash script
   ################################################################################
   
   target="$0"
   # For the case, the executable has been directly symlinked, figure out
   # the correct bin path by following its symlink up to an upper bound.
   # Note: we can't use the readlink utility here if we want to be POSIX
   # compatible.
   iteration=0
   while [ -L "$target" ]; do
       if [ "$iteration" -gt 100 ]; then
           echo "Cannot resolve path: You have a cyclic symlink in $target."
           break
       fi
       ls=`ls -ld -- "$target"`
       target=`expr "$ls" : '.* -> \(.*\)$'`
       iteration=$((iteration + 1))
   done
   
   # Convert relative path to absolute path
   bin=`dirname "$target"`
   
   # get flink config
   . "$bin"/config.sh
   
   if [ "$FLINK_IDENT_STRING" = "" ]; then
           FLINK_IDENT_STRING="$USER"
   fi
   
   CC_CLASSPATH=`constructFlinkClassPath`
   ```



##########
flink-table/flink-sql-gateway/bin/sql-gateway.sh:
##########
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Start/stop a Flink SQL Gateway.
+USAGE="Usage: sql-gateway.sh (start|start-foreground|stop|stop-all)"
+
+STARTSTOP=$1
+
+if [[ $STARTSTOP != "start" ]] && [[ $STARTSTOP != "start-foreground" ]] && [[ $STARTSTOP != "stop" ]] && [[ $STARTSTOP != "stop-all" ]]; then
+  echo $USAGE
+  exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/config.sh
+
+ENTRYPOINT=sqlgateway
+
+if [[ $STARTSTOP == "start" ]] || [[ $STARTSTOP == "start-foreground" ]]; then
+    # Add SqlGateway-specific JVM options
+    export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_JM}"
+    parseJmArgsAndExportLogs "${ARGS[@]}"
+
+    args=("--configDir" "${FLINK_CONF_DIR}" "--executionMode" "cluster")

Review Comment:
   Do we need this? It parse jobmanager args. You can cc BashJavaUtils for more details. I think we can do as sql-client.sh and make it simple.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] fsk119 commented on pull request #20174: [FLINK-27770][sql-gateway] Introduce the script to start/stop/stop-all gateway

Posted by GitBox <gi...@apache.org>.
fsk119 commented on PR #20174:
URL: https://github.com/apache/flink/pull/20174#issuecomment-1202240887

   @flinkbot run azure
   
   The test doesn't run. Retrigger again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org