Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ report
# mise files
.mise.toml
/errors/
go/flags/endtoend/count_flags.sh
40 changes: 20 additions & 20 deletions config/tablet/default.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
tabletID: zone-1234

init:
dbName: # init_db_name_override
keyspace: # init_keyspace
shard: # init_shard
tabletType: # init_tablet_type
dbName: # init-db-name-override
keyspace: # init-keyspace
shard: # init-shard
tabletType: # init-tablet-type
timeoutSeconds: 60 # init_timeout

db:
socket: # db_socket
host: # db_host
port: 0 # db_port
charSet: # db_charset
flags: 0 # db_flags
flavor: # db_flavor
sslCa: # db_ssl_ca
sslCaPath: # db_ssl_ca_path
sslCert: # db_ssl_cert
sslKey: # db_ssl_key
serverName: # db_server_name
connectTimeoutMilliseconds: 0 # db_connect_timeout_ms
socket: # db-socket
host: # db-host
port: 0 # db-port
charSet: # db-charset
flags: 0 # db-flags
flavor: # db-flavor
sslCa: # db-ssl-ca
sslCaPath: # db-ssl-ca-path
sslCert: # db-ssl-cert
sslKey: # db-ssl-key
serverName: # db-server-name
connectTimeoutMilliseconds: 0 # db-connect-timeout-ms
app:
user: vt_app # db_app_user
password: # db_app_password
useSsl: true # db_app_use_ssl
preferTcp: false
dba:
user: vt_dba # db_dba_user
password: # db_dba_password
useSsl: true # db_dba_use_ssl
user: vt_dba # db-dba-user
password: # db-dba-password
useSsl: true # db-dba-use-ssl
preferTcp: false
filtered:
user: vt_filtered # db_filtered_user
Expand Down Expand Up @@ -87,7 +87,7 @@ gracePeriods:

replicationTracker:
mode: disable # enable_replication_reporter
heartbeatIntervalMilliseconds: 0 # heartbeat_enable, heartbeat_interval
heartbeatIntervalMilliseconds: 0 # heartbeat-enable, heartbeat-interval

hotRowProtection:
mode: disable|dryRun|enable # enable_hot_row_protection, enable_hot_row_protection_dry_run
Expand Down
4 changes: 2 additions & 2 deletions doc/design-docs/TopoLocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The implementations of `LockShard` and `CheckShardLocked` differ slightly for al

### Etcd

In Etcd implementation, we use `KeepAlive` API to keep renewing the context that we have for acquiring the shard lock every 10 seconds. The duration of the lease is controlled by the `--topo_etcd_lease_ttl` flag which defaults to 10 seconds. Once we acquire the shard lock, the context for acquiring the shard lock expires and that stops the KeepAlives too.
In Etcd implementation, we use `KeepAlive` API to keep renewing the context that we have for acquiring the shard lock every 10 seconds. The duration of the lease is controlled by the `--topo-etcd-lease-ttl` flag which defaults to 10 seconds. Once we acquire the shard lock, the context for acquiring the shard lock expires and that stops the KeepAlives too.

The shard lock is released either when the unlock function is called, or if the lease ttl expires. This guards against servers crashing while holding the shard lock.

Expand All @@ -30,6 +30,6 @@ The Check function doesn't do anything in ZooKeeper. The implementation just ret

### Consul

In Consul, the timeout for the lock is controlled by the `--topo_consul_lock_session_ttl` flag.
In Consul, the timeout for the lock is controlled by the `--topo-consul-lock-session-ttl` flag.

The Check function works properly and checks if the lock still exists.
1 change: 1 addition & 0 deletions docker/mini/vtctld-mini-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ grpc_port=15999

echo "- Starting vtctld..."
# shellcheck disable=SC2086
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
vtctld \
$TOPOLOGY_FLAGS \
--disable_active_reparents \
Expand Down
1 change: 1 addition & 0 deletions docker/mini/vttablet-mini-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ echo "> Starting vttablet for server $mysql_host:$mysql_port"
echo " - Tablet alias is $alias"
echo " - Tablet listens on http://$hostname:$port"
# shellcheck disable=SC2086
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
vttablet \
$TOPOLOGY_FLAGS \
-log_dir $VTDATAROOT/tmp \
Expand Down
2 changes: 1 addition & 1 deletion docker/vttestserver/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rm -vf "$VTDATAROOT"/"$tablet_dir"/{mysql.sock,mysql.sock.lock}
--num_shards "$NUM_SHARDS" \
--mysql_bind_host "${MYSQL_BIND_HOST:-127.0.0.1}" \
--vtcombo-bind-host "${VTCOMBO_BIND_HOST:-127.0.0.1}" \
--mysql_server_version "${MYSQL_SERVER_VERSION:-$1}" \
--mysql-server-version "${MYSQL_SERVER_VERSION:-$1}" \
--charset "${CHARSET:-utf8mb4}" \
--foreign_key_mode "${FOREIGN_KEY_MODE:-allow}" \
--enable_online_ddl="${ENABLE_ONLINE_DDL:-true}" \
Expand Down
3 changes: 3 additions & 0 deletions examples/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ if [ "${TOPO}" = "zk2" ]; then
# Set topology environment parameters.
ZK_SERVER="localhost:21811,localhost:21812,localhost:21813"
# shellcheck disable=SC2034
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
TOPOLOGY_FLAGS="--topo_implementation zk2 --topo_global_server_address ${ZK_SERVER} --topo_global_root /vitess/global"

mkdir -p "${VTDATAROOT}/tmp"
Expand All @@ -61,10 +62,12 @@ elif [ "${TOPO}" = "consul" ]; then
CONSUL_SERVER=127.0.0.1
CONSUL_HTTP_PORT=8500
CONSUL_SERVER_PORT=8300
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
TOPOLOGY_FLAGS="--topo_implementation consul --topo_global_server_address ${CONSUL_SERVER}:${CONSUL_HTTP_PORT} --topo_global_root vitess/global/"
mkdir -p "${VTDATAROOT}/consul"
else
ETCD_SERVER="localhost:2379"
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
TOPOLOGY_FLAGS="--topo_implementation etcd2 --topo_global_server_address $ETCD_SERVER --topo_global_root /vitess/global"

mkdir -p "${VTDATAROOT}/etcd"
Expand Down
1 change: 1 addition & 0 deletions examples/common/scripts/mysqlctl-down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ uid=$TABLET_UID
printf -v alias '%s-%010d' $cell $uid
echo "Shutting down MySQL for tablet $alias..."

#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
mysqlctl --tablet_uid $uid shutdown

1 change: 1 addition & 0 deletions examples/common/scripts/mysqlctl-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if [ -d $VTDATAROOT/$tablet_dir ]; then
action='start'
fi

#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
mysqlctl \
--log_dir $VTDATAROOT/tmp \
--tablet_uid $uid \
Expand Down
1 change: 1 addition & 0 deletions examples/common/scripts/vtctld-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ grpc_port=15999

echo "Starting vtctld..."
# shellcheck disable=SC2086
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
vtctld \
$TOPOLOGY_FLAGS \
--cell $cell \
Expand Down
3 changes: 2 additions & 1 deletion examples/common/scripts/vtgate-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mysql_server_socket_path="/tmp/mysql.sock"

echo "Starting vtgate..."
# shellcheck disable=SC2086
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
vtgate \
$TOPOLOGY_FLAGS \
--log_dir $VTDATAROOT/tmp \
Expand All @@ -36,7 +37,7 @@ vtgate \
--mysql_server_socket_path $mysql_server_socket_path \
--cell $cell \
--cells_to_watch $cell \
--tablet_types_to_wait PRIMARY,REPLICA \
--tablet-types-to-wait PRIMARY,REPLICA \
--service_map 'grpc-vtgateservice' \
--pid_file $VTDATAROOT/tmp/vtgate.pid \
--enable_buffer \
Expand Down
2 changes: 1 addition & 1 deletion examples/compose/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 --topo_global_root vitess/global
TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500 --topo-global-root vitess/global
GRPC_PORT=15999
WEB_PORT=8080
MYSQL_PORT=15306
Expand Down
18 changes: 10 additions & 8 deletions examples/compose/docker-compose.beginners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ services:
- "15000:$WEB_PORT"
- "$GRPC_PORT"
command: ["sh", "-c", " /vt/bin/vtctld \
# TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
$TOPOLOGY_FLAGS \
--cell $CELL \
--service_map 'grpc-vtctl,grpc-vtctld' \
--backup_storage_implementation file \
--service-map 'grpc-vtctl,grpc-vtctld' \
--backup-storage-implementation file \
--file_backup_storage_root /vt/vtdataroot/backups \
--logtostderr=true \
--port $WEB_PORT \
--grpc_port $GRPC_PORT
--grpc-port $GRPC_PORT
"]
depends_on:
consul1:
Expand All @@ -89,16 +90,17 @@ services:
- "$GRPC_PORT"
- "15306:$MYSQL_PORT"
command: ["sh", "-c", "/vt/bin/vtgate \
# TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
$TOPOLOGY_FLAGS \
--logtostderr=true \
--port $WEB_PORT \
--grpc_port $GRPC_PORT \
--mysql_server_port $MYSQL_PORT \
--mysql_auth_server_impl none \
--grpc-port $GRPC_PORT \
--mysql-server-port $MYSQL_PORT \
--mysql-auth-server-impl none \
--cell $CELL \
--cells_to_watch $CELL \
--tablet_types_to_wait PRIMARY,REPLICA \
--service_map 'grpc-vtgateservice' \
--tablet-types-to-wait PRIMARY,REPLICA \
--service-map 'grpc-vtgateservice' \
--enable_system_settings=true \
"]
volumes:
Expand Down
56 changes: 28 additions & 28 deletions examples/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ services:
vttablet301:
condition: service_healthy
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand All @@ -89,8 +89,8 @@ services:
vttablet201:
condition: service_healthy
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down Expand Up @@ -126,8 +126,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- EXTERNAL_DB=0
image: vitess/lite:${VITESS_TAG:-latest}
volumes:
Expand All @@ -136,10 +136,10 @@ services:
command:
- sh
- -c
- ' /vt/bin/vtctld --topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global --cell test
--service_map ''grpc-vtctl,grpc-vtctld'' --backup_storage_implementation file --file_backup_storage_root
/vt/vtdataroot/backups --logtostderr=true --port 8080 --grpc_port 15999 '
- ' /vt/bin/vtctld --topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global --cell test
--service-map ''grpc-vtctl,grpc-vtctld'' --backup-storage-implementation file --file_backup_storage_root
/vt/vtdataroot/backups --logtostderr=true --port 8080 --grpc-port 15999 '
depends_on:
external_db_host:
condition: service_healthy
Expand All @@ -153,10 +153,10 @@ services:
command:
- sh
- -c
- '/script/run-forever.sh /vt/bin/vtgate --topo_implementation consul --topo_global_server_address
consul1:8500 --topo_global_root vitess/global --logtostderr=true --port 8080 --grpc_port
15999 --mysql_server_port 15306 --mysql_auth_server_impl none --cell test --cells_to_watch
test --tablet_types_to_wait PRIMARY,REPLICA,RDONLY --service_map ''grpc-vtgateservice''
- '/script/run-forever.sh /vt/bin/vtgate --topo-implementation consul --topo-global-server-address
consul1:8500 --topo-global-root vitess/global --logtostderr=true --port 8080 --grpc-port
15999 --mysql-server-port 15306 --mysql-auth-server-impl none --cell test --cells_to_watch
test --tablet-types-to-wait PRIMARY,REPLICA,RDONLY --service-map ''grpc-vtgateservice''
--normalize_queries=true '
depends_on:
- vtctld
Expand All @@ -176,8 +176,8 @@ services:
- vtctld
- set_keyspace_durability_policy
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- EXTERNAL_DB=0
- DB_USER=
Expand All @@ -195,8 +195,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down Expand Up @@ -232,8 +232,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down Expand Up @@ -269,8 +269,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down Expand Up @@ -306,8 +306,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down Expand Up @@ -343,8 +343,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down Expand Up @@ -380,8 +380,8 @@ services:
depends_on:
- vtctld
environment:
- TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500
--topo_global_root vitess/global
- TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global
- WEB_PORT=8080
- GRPC_PORT=15999
- CELL=test
Expand Down
2 changes: 1 addition & 1 deletion examples/compose/template.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 --topo_global_root vitess/global
TOPOLOGY_FLAGS=--topo-implementation consul --topo-global-server-address consul1:8500 --topo-global-root vitess/global
GRPC_PORT=15999
WEB_PORT=8080
MYSQL_PORT=15306
Expand Down
Loading
Loading