vitess.io/vitess@v0.16.2/docker/vttestserver/run.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2021 The Vitess Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  # Setup the Vschema Folder
    18  /vt/setup_vschema_folder.sh "$KEYSPACES" "$NUM_SHARDS"
    19  
    20  # Set the maximum connections in the cnf file
    21  # use 1000 as the default if it is unspecified
    22  if [[ -z $MYSQL_MAX_CONNECTIONS ]]; then
    23    MYSQL_MAX_CONNECTIONS=1000
    24  fi
    25  echo "max_connections = $MYSQL_MAX_CONNECTIONS" >> /vt/config/mycnf/test-suite.cnf
    26  
    27  # Delete socket files before running mysqlctld if exists.
    28  # This is the primary reason for unhealthy state on restart.
    29  # https://github.com/vitessio/vitess/pull/5115/files
    30  rm -vf "$VTDATAROOT"/"$tablet_dir"/{mysql.sock,mysql.sock.lock}
    31  
    32  # Run the vttestserver binary
    33  /vt/bin/vttestserver \
    34  	--port "$PORT" \
    35  	--keyspaces "$KEYSPACES" \
    36  	--num_shards "$NUM_SHARDS" \
    37  	--mysql_bind_host "${MYSQL_BIND_HOST:-127.0.0.1}" \
    38  	--mysql_server_version "${MYSQL_SERVER_VERSION:-$1}" \
    39  	--charset "${CHARSET:-utf8mb4}" \
    40  	--foreign_key_mode "${FOREIGN_KEY_MODE:-allow}" \
    41  	--enable_online_ddl="${ENABLE_ONLINE_DDL:-true}" \
    42  	--enable_direct_ddl="${ENABLE_DIRECT_DDL:-true}" \
    43  	--planner-version="${PLANNER_VERSION:-gen4}" \
    44  	--vschema_ddl_authorized_users=% \
    45  	--tablet_refresh_interval "${TABLET_REFRESH_INTERVAL:-10s}" \
    46  	--schema_dir="/vt/schema/"
    47