Skip to content

Commit

Permalink
chore: port wescale changes to release-0.8 (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
earayu authored Mar 12, 2024
1 parent 7ce1d18 commit bfe806c
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 54 deletions.
2 changes: 1 addition & 1 deletion addons/apecloud-mysql/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: ApeCloud MySQL is a database that is compatible with MySQL syntax a

type: application

version: 0.8.0-beta.5
version: 0.8.0-beta.6

# This is the version number of the ApeCloud MySQL being deployed,
# rather than the version number of ApeCloud MySQL-Scale itself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,27 @@
//Path to ssl key for mysql server plugin SSL
mysql_server_ssl_key: string

//Path to the ssl ca for mysql server plugin SSL
mysql_server_ssl_ca: string

//Path to the ssl cert for mysql server plugin SSL
mysql_server_ssl_cert: string

//Reject insecure connections but only if mysql_server_ssl_cert and mysql_server_ssl_key are provided.(default "false")
mysql_server_require_secure_transport: bool

// Set default strategy for DDL statements. Override with @@ddl_strategy session variable
ddl_strategy: string & "direct" | "online" | "mysql"

// Enable or disable the feature of showing information about the vttablet node which executing the SQL. (default false)
enable_display_sql_execution_vttablets: bool

// Enable or disable the feature of read write splitting for read only txn (default false)
enable_read_write_split_for_read_only_txn: bool

// Enable or disable the feature of interception for DML without where clause (default true)
enable_interception_for_dml_without_where: bool

...
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ staticParameters:
- buffer_max_failover_duration
- buffer_min_time_between_failovers
- mysql_auth_server_impl
- mysql_server_require_secure_transport
- mysql_auth_server_static_file
- mysql_server_ssl_key
- mysql_server_ssl_cert
- enable_logs
- enable_query_log

dynamicParameters:
- read_write_splitting_policy
- read_write_splitting_ratio
- read_after_write_consistency
- read_after_write_timeout
- read_after_write_timeout
- ddl_strategy
- enable_display_sql_execution_vttablets
- enable_read_write_split_for_read_only_txn
- mysql_server_ssl_key
- mysql_server_ssl_cert
- mysql_server_ssl_ca
- mysql_server_require_secure_transport
- enable_interception_for_dml_without_where
24 changes: 20 additions & 4 deletions addons/apecloud-mysql/config/mysql-scale-vtgate-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ buffer_size=10000
buffer_window=30s
buffer_max_failover_duration=60s
buffer_min_time_between_failovers=60s
mysql_auth_server_impl=none
mysql_server_require_secure_transport=false
mysql_auth_server_impl=mysqlbased
mysql_auth_server_static_file=
mysql_server_ssl_key=
mysql_server_ssl_cert=
mysql_server_require_secure_transport=false
{{ block "logsBlock" . }}
{{- if hasKey $.component "enabledLogs" }}
enable_logs=true
Expand All @@ -27,3 +25,21 @@ enable_query_log=true
{{- end }}
{{- end }}
{{ end }}
ddl_strategy=direct
enable_display_sql_execution_vttablets=false
enable_read_write_split_for_read_only_txn=false
enable_interception_for_dml_without_where=true

{{- if $.component.tlsConfig }}
{{- $ca_file := getCAFile }}
{{- $cert_file := getCertFile }}
{{- $key_file := getKeyFile }}
mysql_server_ssl_ca={{ $ca_file }}
mysql_server_ssl_cert={{ $cert_file }}
mysql_server_ssl_key={{ $key_file }}
# tls
{{- else }}
mysql_server_ssl_ca=
mysql_server_ssl_cert=
mysql_server_ssl_key=
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@
// query server transaction cap is the maximum number of transactions allowed to happen at any given point of a time for a single vttablet. E.g. by setting transaction cap to 100, there are at most 100 transactions will be processed by a vttablet and the 101th transaction will be blocked (and fail if it cannot get connection within specified timeout)
queryserver_config_transaction_cap: int & >=0

// the size of database connection pool in non transaction dml
non_transactional_dml_database_pool_size: int & >=1

// the number of rows to be processed in one batch by default
non_transactional_dml_default_batch_size: int & >=1

// the interval of batch processing in milliseconds by default
non_transactional_dml_default_batch_interval: int & >=1

// the interval of table GC in hours
non_transactional_dml_table_gc_interval: int & >=1

// the interval of job scheduler running in seconds
non_transactional_dml_job_manager_running_interval: int & >=1

// the interval of throttle check in milliseconds
non_transactional_dml_throttle_check_interval: int & >=1

// the threshold of batch size
non_transactional_dml_batch_size_threshold: int & >=1 & <=1000000

// final threshold = ratio * non_transactional_dml_batch_size_threshold / table index numbers
non_transactional_dml_batch_size_threshold_ratio: float & >=0 & <=1

...
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ staticParameters:
dynamicParameters:
- queryserver_config_pool_size
- queryserver_config_stream_pool_size
- queryserver_config_transaction_cap
- queryserver_config_transaction_cap
- non_transactional_dml_database_pool_size
- non_transactional_dml_default_batch_size
- non_transactional_dml_default_batch_interval
- non_transactional_dml_table_gc_interval
- non_transactional_dml_job_manager_running_interval
- non_transactional_dml_throttle_check_interval
- non_transactional_dml_batch_size_threshold
- non_transactional_dml_batch_size_threshold_ratio
55 changes: 48 additions & 7 deletions addons/apecloud-mysql/config/mysql-scale-vttablet-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,60 @@ health_check_interval=1s
shard_sync_retry_delay=1s
remote_operation_timeout=1s
db_connect_timeout_ms=500
table_acl_config_mode=simple
table_acl_config_mode=mysqlbased
enable_logs=true
enable_query_log=true
table_acl_config=
queryserver_config_strict_table_acl=false
table_acl_config_reload_interval=30s
queryserver_config_strict_table_acl=true
table_acl_config_reload_interval=5s
enforce_tableacl_config=false

{{- $phy_memory := getContainerMemory ( index $.podSpec.containers 0 ) }}
{{- $thread_stack := 262144 }}
{{- $binlog_cache_size := 32768 }}
{{- $join_buffer_size := 262144 }}
{{- $sort_buffer_size := 262144 }}
{{- $read_buffer_size := 262144 }}
{{- $read_rnd_buffer_size := 524288 }}
{{- $single_thread_memory := add $thread_stack $binlog_cache_size $join_buffer_size $sort_buffer_size $read_buffer_size $read_rnd_buffer_size }}
{{- if gt $phy_memory 0 }}
# max_connections={{ div ( div $phy_memory 4 ) $single_thread_memory }}
{{- end}}

{{- $max_connections := div ( div $phy_memory 4 ) $single_thread_memory }}
# 10 percentage
{{- $pool_k := max 1 ( div (sub $max_connections 35) 10 ) }}

# TxPool
queryserver_config_transaction_cap={{ mul 5 $pool_k }}

# OltpReadPool
queryserver_config_pool_size=30
queryserver_config_pool_size={{ mul 4 $pool_k }}

# OlapReadPool
queryserver_config_stream_pool_size=30
queryserver_config_stream_pool_size={{ mul $pool_k }}

# TxPool
queryserver_config_transaction_cap=50

# the size of database connection pool in non transaction dml
non_transactional_dml_database_pool_size=3

# the number of rows to be processed in one batch by default
non_transactional_dml_default_batch_size=2000

# the interval of batch processing in milliseconds by default
non_transactional_dml_default_batch_interval=1

# the interval of table GC in hours
non_transactional_dml_table_gc_interval=24

# the interval of job scheduler running in seconds
non_transactional_dml_job_manager_running_interval=24

# the interval of throttle check in milliseconds
non_transactional_dml_throttle_check_interval=250

# the threshold of batch size
non_transactional_dml_batch_size_threshold=10000

# final threshold = ratio * non_transactional_dml_batch_size_threshold / table index numbers
non_transactional_dml_batch_size_threshold_ratio=0.5
2 changes: 1 addition & 1 deletion addons/apecloud-mysql/scripts/set_config_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function set_config_variables(){
config_content=$(sed -n '/\['$1'\]/,/\[/ { /\['$1'\]/d; /\[/q; p; }' $config_file)
while read line
do
if [[ $line =~ ^[a-zA-Z_][a-zA-Z0-9_]*=[a-zA-Z0-9_.]*$ ]]; then
if [[ $line =~ ^[a-zA-Z_][a-zA-Z0-9_]*=[a-zA-Z0-9_./-]*$ ]]; then
echo $line
eval "export $line"
elif ! [[ -z $line || $line =~ ^[[:space:]]*# ]]; then
Expand Down
22 changes: 1 addition & 21 deletions addons/apecloud-mysql/scripts/vtgate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ su vitess <<EOF
exec vtgate \
$TOPOLOGY_FLAGS \
--alsologtostderr \
--gateway_initial_tablet_timeout $gateway_initial_tablet_timeout \
--healthcheck_timeout $healthcheck_timeout \
--srv_topo_timeout $srv_topo_timeout \
--grpc_keepalive_time $grpc_keepalive_time \
--grpc_keepalive_timeout $grpc_keepalive_timeout \
$(if [ "$enable_logs" == "true" ]; then echo "--log_dir $VTDATAROOT"; fi) \
$(if [ "$enable_query_log" == "true" ]; then echo "--log_queries_to_file $VTDATAROOT/vtgate_querylog.txt"; fi) \
--port $web_port \
Expand All @@ -27,21 +22,6 @@ exec vtgate \
--cell $cell \
--cells_to_watch $cell \
--tablet_types_to_wait PRIMARY,REPLICA \
--tablet_refresh_interval $tablet_refresh_interval \
--service_map 'grpc-vtgateservice' \
--pid_file $VTDATAROOT/vtgate.pid \
--read_write_splitting_policy $read_write_splitting_policy \
--read_write_splitting_ratio $read_write_splitting_ratio \
--read_after_write_consistency $read_after_write_consistency \
--read_after_write_timeout $read_after_write_timeout \
--enable_buffer=$enable_buffer \
--buffer_size $buffer_size \
--buffer_window $buffer_window \
--buffer_max_failover_duration $buffer_max_failover_duration \
--buffer_min_time_between_failovers $buffer_min_time_between_failovers \
$(if [ "$mysql_server_require_secure_transport" == "true" ]; then echo "--mysql_server_require_secure_transport"; fi) \
$(if [ -n "$mysql_server_ssl_cert" ]; then echo "--mysql_server_ssl_cert $mysql_server_ssl_cert"; fi) \
$(if [ -n "$mysql_server_ssl_key" ]; then echo "--mysql_server_ssl_key $mysql_server_ssl_key"; fi) \
$(if [ -n "$mysql_auth_server_static_file" ]; then echo "--mysql_auth_server_static_file $mysql_auth_server_static_file"; fi) \
--mysql_auth_server_impl $mysql_auth_server_impl
--pid_file $VTDATAROOT/vtgate.pid
EOF
11 changes: 1 addition & 10 deletions addons/apecloud-mysql/scripts/vttablet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ $(if [ "$enable_query_log" == "true" ]; then echo "--log_queries_to_file $VTDATA
--tablet-path $alias \
--tablet_hostname "$tablet_hostname" \
--init_tablet_type $tablet_type \
--health_check_interval $health_check_interval \
--shard_sync_retry_delay $shard_sync_retry_delay \
--remote_operation_timeout $remote_operation_timeout \
--db_connect_timeout_ms $db_connect_timeout_ms \
--enable_replication_reporter \
--backup_storage_implementation file \
--file_backup_storage_root $VTDATAROOT/backups \
Expand All @@ -61,10 +57,5 @@ $(if [ "$enable_query_log" == "true" ]; then echo "--log_queries_to_file $VTDATA
--service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \
--pid_file $VTDATAROOT/vttablet.pid \
--vtctld_addr http://$vtctld_host:$vtctld_web_port/ \
--table-acl-config-mode=$table_acl_config_mode \
--disable_active_reparents \
$(if [ -n "$table_acl_config" ]; then echo "--table-acl-config $table_acl_config"; fi) \
$(if [ "$queryserver_config_strict_table_acl" == "true" ]; then echo "--queryserver-config-strict-table-acl"; fi) \
$(if [ "$enforce_tableacl_config" == "true" ]; then echo "--enforce-tableacl-config"; fi) \
--table-acl-config-reload-interval $table_acl_config_reload_interval
--disable_active_reparents
EOF
6 changes: 2 additions & 4 deletions addons/apecloud-mysql/templates/configconstraint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ metadata:
{{- include "apecloud-mysql.labels" . | nindent 4 }}
spec:
reloadOptions:
unixSignalTrigger:
autoTrigger:
processName: vttablet
signal: SIGHUP

cfgSchemaTopLevelName: VtTabletParameter

Expand Down Expand Up @@ -138,9 +137,8 @@ metadata:
{{- include "apecloud-mysql.labels" . | nindent 4 }}
spec:
reloadOptions:
unixSignalTrigger:
autoTrigger:
processName: vtgate
signal: SIGHUP

cfgSchemaTopLevelName: VtGateParameter

Expand Down
2 changes: 1 addition & 1 deletion addons/apecloud-mysql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ wesqlscale:
# if the value of wesqlscale.image.registry is not specified using `--set`, it will be set to the value of 'image.registry' by default
registry: ""
repository: apecloud/apecloud-mysql-scale
tag: "0.2.3"
tag: "0.2.6"
pullPolicy: IfNotPresent

## @param resourceNamePrefix Prefix for all resources name created by this chart, that can avoid name conflict
Expand Down

0 comments on commit bfe806c

Please sign in to comment.