Skip to content

Commit

Permalink
fix: apecloud mysql creation failed with auditlog parameters being re…
Browse files Browse the repository at this point in the history
…ndered incorrectly. (#1237)
  • Loading branch information
xuriwuyun authored Nov 22, 2024
1 parent 38cbb65 commit 891629f
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 17 deletions.
1 change: 0 additions & 1 deletion addons-cluster/apecloud-mysql/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{ include "kblib.clusterLabels" . | nindent 4 }}
auditLogEnabled: "{{ .Values.auditLogEnabled }}"
{{- if and (eq .Values.mode "raftGroup") .Values.proxyEnabled }}
annotations:
kubeblocks.io/extra-env: '{"KB_PROXY_ENABLED":"on","ETCDCTL_API": "{{ .Values.etcd.etcdctlApi}}"}'
Expand Down
3 changes: 0 additions & 3 deletions addons-cluster/apecloud-mysql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ proxyEnabled: false
## if mode is raftGroup, localEtcdEnabled can be true
localEtcdEnabled: false

## @param auditLogEnabled if true, enable audit log in apecloud mysql
auditLogEnabled: false

proxy:
storageClassName: ""

Expand Down
65 changes: 64 additions & 1 deletion addons/apecloud-mysql/config/mysql8-config-constraint.cue
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,70 @@
wait_timeout?: int & >=1 & <=31536000

// For SQL window functions, determines whether to enable inversion optimization for moving window frames also for floating values.
windowing_use_high_precision: string & "0" | "1" | "OFF" | "ON" | *"1"
windowing_use_high_precision?: string & "OFF" | "ON" | *"ON"

loose_consensus_enabled?: string & "ON" | "OFF"
loose_consensus_io_thread_cnt?: int | *8
loose_consensus_worker_thread_cnt?: int | *8
loose_consensus_election_timeout?: int | *1000
loose_consensus_auto_leader_transfer?: string & "OFF" | "ON" | *"OFF"
loose_consensus_prefetch_window_size?: int | *100
loose_consensus_auto_reset_match_index?: string & "OFF" | "ON" | *"ON"
loose_cluster_mts_recover_use_index?: string & "ON" | "OFF"
loose_replicate_same_server_id?: string & "ON" | "OFF"
loose_consensus_large_trx?: string & "ON" | "OFF"
loose_consensuslog_revise?: string & "OFF" | "ON"

authentication_policy?: string
plugin_load_add?: string

loose_audit_log_handler?: string & "FILE" | "SYSLOG" | *"FILE"
loose_audit_log_file?: string | *"audit.log"
loose_audit_log_buffer_size?: string | *"1Mb"
loose_audit_log_policy?: string & "ALL" | "LOGINS" | "QUERIES" | "NONE" | *"ALL"
loose_audit_log_strategy?: string & "ASYNCHRONOUS" | "PERFORMANCE" | "SEMISYNCHRONOUS" | "SYNCHRONOUS" | *"ASYNCHRONOUS"
loose_audit_log_rotate_on_size?: int | *0
loose_audit_log_rotations?: int | *0
loose_audit_log_exclude_accounts?: string

loose_smartengine_datadir?: string
loose_smartengine_wal_dir?: string
loose_smartengine_flush_log_at_trx_commit?: int
loose_smartengine_enable_2pc?: int
loose_smartengine_batch_group_slot_array_size?: int
loose_smartengine_batch_group_max_group_size?: int
loose_smartengine_batch_group_max_leader_wait_time_us?: int
loose_smartengine_block_size?: int
loose_smartengine_disable_auto_compactions?: int
loose_smartengine_dump_memtable_limit_size?: int

loose_smartengine_min_write_buffer_number_to_merge?: int
loose_smartengine_level0_file_num_compaction_trigger?: int
loose_smartengine_level0_layer_num_compaction_trigger?: int
loose_smartengine_level1_extents_major_compaction_trigger?: int
loose_smartengine_level2_usage_percent?: int
loose_smartengine_flush_delete_percent?: int
loose_smartengine_compaction_delete_percent?: int
loose_smartengine_flush_delete_percent_trigger?: int
loose_smartengine_flush_delete_record_trigger?: int
loose_smartengine_scan_add_blocks_limit?: int

loose_smartengine_compression_per_level?: string
loose_smartengine_write_buffer_size?: int
loose_smartengine_db_write_buffer_size?: int
loose_smartengine_db_total_write_buffer_size?: int
loose_smartengine_block_cache_size?: int
loose_smartengine_row_cache_size?: int
loose_smartengine_max_total_wal_size?: int

loose_smartengine_max_background_flushes?: int
loose_smartengine_base_background_compactions?: int
loose_smartengine_max_background_compactions?: int

innodb_redo_log_capacity?: int
binlog_purge_size?: string
log_replica_updates?: int
mysqlx?: int
}

// SectionName is section name
Expand Down
10 changes: 4 additions & 6 deletions addons/apecloud-mysql/config/mysql8-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ connect_timeout=10
# character-sets-dir=/usr/share/mysql-8.0/charsets

port={{ $mysql_port }}
mysqlx-port=33060
mysqlx_port=33060
mysqlx=0

datadir={{ $data_root }}/data
Expand All @@ -105,9 +105,8 @@ slow_query_log_file=/data/mysql/log/mysqld-slowquery.log
general_log=OFF
general_log_file=/data/mysql/log/mysqld.log

{{- if eq $.cluster.metadata.labels.auditLogEnabled "true" }}
# audit log
plugin-load-add=audit_log=audit_log.so
plugin_load_add=audit_log=audit_log.so
loose_audit_log_handler=FILE # FILE, SYSLOG
loose_audit_log_file={{ $data_root }}/auditlog/audit.log
loose_audit_log_buffer_size=1Mb
Expand All @@ -127,7 +126,6 @@ loose_audit_log_rotations=5
## | localhost | root |
## +-----------+------------------+
loose_audit_log_exclude_accounts=root@%,root@localhost
{{ end }}

#innodb
innodb_doublewrite_batch_size=16
Expand Down Expand Up @@ -178,7 +176,7 @@ binlog_format=ROW
binlog_row_image=FULL
# Aliyun AWS binlog_order_commits=ON
binlog_order_commits=ON
log-bin={{ $data_root }}/binlog/mysql-bin
log_bin={{ $data_root }}/binlog/mysql-bin
log_bin_index={{ $data_root }}/binlog/mysql-bin.index
binlog_expire_logs_seconds=604800
binlog_purge_size=102400M
Expand All @@ -194,7 +192,7 @@ relay_log_recovery=ON
relay_log=relay-bin
relay_log_index=relay-bin.index

pid-file=/var/run/mysqld/mysqld.pid
pid_file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock

{{- if $.component.tlsConfig }}
Expand Down
4 changes: 4 additions & 0 deletions addons/mysql/config/mysql8-config-constraint.cue
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,10 @@

// For SQL window functions, determines whether to enable inversion optimization for moving window frames also for floating values.
windowing_use_high_precision: string & "OFF" | "ON" | *"ON"

// other parameters
// reference mysql parameters
...
}

// SectionName is section name
Expand Down
2 changes: 0 additions & 2 deletions examples/apecloud-mysql/cluster-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ kind: Cluster
metadata:
name: acmysql-cluster
namespace: default
labels:
auditLogEnabled: "false"
annotations:
kubeblocks.io/extra-env: '{"KB_PROXY_ENABLED":"on","ETCDCTL_API": "3"}'
spec:
Expand Down
2 changes: 0 additions & 2 deletions examples/apecloud-mysql/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ kind: Cluster
metadata:
name: acmysql-cluster
namespace: default
labels:
auditLogEnabled: "false" # use this label as switch to set variables 'audit_log_xxx'
spec:
# Specifies the behavior when a Cluster is deleted.
# Valid options are: [DoNotTerminate, Delete, WipeOut] (`Halt` is deprecated since KB 0.9)
Expand Down
2 changes: 0 additions & 2 deletions examples/apecloud-mysql/restore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ kind: Cluster
metadata:
name: acmysql-cluster-restore
namespace: default
labels:
auditLogEnabled: "false"
annotations:
kubeblocks.io/restore-from-backup: '{"mysql":{"encryptedSystemAccounts":"<ENCRYPTED-SYSTEM-ACCOUNTS>","name":"acmysql-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}'
spec:
Expand Down

0 comments on commit 891629f

Please sign in to comment.