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
2 changes: 1 addition & 1 deletion pkg/apis/planetscale/v2/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var DefaultImages = &VitessImages{
Mysql80Compatible: defaultMySQLImage,
},

MysqldExporter: "prom/mysqld-exporter:v0.14.0",
MysqldExporter: "prom/mysqld-exporter:v0.18.0",
}

var (
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/vttablet/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (

mysqldExporterContainerName = "mysqld-exporter"
mysqldExporterCommand = "/bin/mysqld_exporter"
mysqldExporterMySQLCnf = "client.cnf"
mysqldExporterUser = "vt_dba"
mysqldExporterPort = 9104
mysqldExporterPortName = "metrics"
Expand Down
4 changes: 2 additions & 2 deletions pkg/operator/vttablet/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package vttablet

import (
"fmt"
"path/filepath"

"vitess.io/vitess/go/vt/topo/topoproto"

Expand Down Expand Up @@ -97,9 +98,8 @@ func init() {

// Base mysqld_exporter flags.
mysqldExporterFlags.Add(func(s lazy.Spec) vitess.Flags {
spec := s.(*Spec)
return vitess.Flags{
"config.my-cnf": spec.myCnfFilePath(),
"config.my-cnf": filepath.Join(vtMycnfPath, mysqldExporterMySQLCnf),
// The default for `collect.info_schema.tables.databases` is `*`,
// which causes new time series to be created for each user table.
// This in turn causes scaling issues in Prometheus memory usage.
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/vttablet/mysqlctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ln -sf /dev/stderr /mnt/vt/config/stderr.symlink
echo "log-error = /vt/config/stderr.symlink" > /mnt/vt/config/mycnf/log-error.cnf
echo "binlog_format=row" > /mnt/vt/config/mycnf/rbr.cnf
echo "socket = ` + mysqlSocketPath + `" > /mnt/vt/config/mycnf/socket.cnf
echo -e "[client]\nuser=` + mysqldExporterUser + `\nsocket=` + mysqlSocketPath + `\n" > /mnt/vt/config/mycnf/` + mysqldExporterMySQLCnf + `
`

mysqlSocketInitScript = `set -ex
Expand Down
1 change: 1 addition & 0 deletions test/endtoend/backup_restore_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cd test/endtoend/operator || exit 1
get_started "operator-latest.yaml" "101_initial_cluster_backup.yaml"
verifyVtGateVersion "24.0.0"
checkSemiSyncSetup
checkMysqldExporterMetrics
takeBackup "commerce/-"
verifyListBackupsOutput
takedownShard
Expand Down
1 change: 1 addition & 0 deletions test/endtoend/backup_schedule_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cd test/endtoend/operator || exit 1
get_started "operator-latest.yaml" "101_initial_cluster_backup_schedule.yaml"
verifyVtGateVersion "24.0.0"
checkSemiSyncSetup
checkMysqldExporterMetrics
verifyListBackupsOutputWithSchedule

# Teardown
Expand Down
1 change: 1 addition & 0 deletions test/endtoend/hpa_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ cd test/endtoend/operator || exit 1
get_started "operator-latest.yaml" "101_initial_cluster_autoscale.yaml"
verifyVtGateVersion "24.0.0"
checkSemiSyncSetup
checkMysqldExporterMetrics

verifyHpaCount 0

Expand Down
2 changes: 2 additions & 0 deletions test/endtoend/operator/101_initial_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
vtbackup: vitess/lite:v23.0.0-mysql80
mysqld:
mysql80Compatible: vitess/lite:v23.0.0-mysql80
# This needs to stay at 0.14.0 until we're upgrading from v24 to v25.
# At which point it can use 0.18.0.
mysqldExporter: prom/mysqld-exporter:v0.14.0
cells:
- name: zone1
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/101_initial_cluster_autoscale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: mysql:8.0.40
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/101_initial_cluster_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
vtorc: vitess/lite:mysql80
mysqld:
mysql80Compatible: mysql:8.0.40
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
vtorc: vitess/lite:mysql80
mysqld:
mysql80Compatible: mysql:8.0.40
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/102_keyspace_teardown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: mysql:8.0.40
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/201_customer_tablets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/302_new_shards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/306_down_shard_0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/401_scheduled_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/cluster_autoscale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: mysql:8.0.40
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/cluster_upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
vtbackup: vitess/lite:mysql80
mysqld:
mysql80Compatible: vitess/lite:mysql80
mysqldExporter: prom/mysqld-exporter:v0.14.0
mysqldExporter: prom/mysqld-exporter:v0.18.0
cells:
- name: zone1
gateway:
Expand Down
2 changes: 1 addition & 1 deletion test/endtoend/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7834,4 +7834,4 @@ spec:
# It is inherited by the backup subcontroller and allows it to access
# the files created by Vitess on the shared persistent volume.
fsGroup: 999 # Default fsGroup of Vitess
serviceAccountName: vitess-operator
serviceAccountName: vitess-operator
2 changes: 2 additions & 0 deletions test/endtoend/upgrade_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,14 @@ cd test/endtoend/operator || exit 1
get_started "operator.yaml" "101_initial_cluster.yaml"
verifyVtGateVersion "23.0.0"
checkSemiSyncSetup
checkMysqldExporterMetrics
# Initially too durability policy should be specified
verifyDurabilityPolicy "commerce" "semi_sync"
upgradeToLatest
verifyVtGateVersion "24.0.0"
verifyResourceSpec
checkSemiSyncSetup
checkMysqldExporterMetrics
# After upgrading, we verify that the durability policy is still semi_sync
verifyDurabilityPolicy "commerce" "semi_sync"
move_tables
Expand Down
12 changes: 12 additions & 0 deletions test/endtoend/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,15 @@ function checkVitessBackupScheduleStatusWithTimeout() {
echo -e "ERROR: checkPodStatusWithTimeout timeout to find pod matching:\ngot:\n$out\nfor regex: $regex"
exit 1
}

function checkMysqldExporterMetrics() {
for vttablet in $(kubectl get pods -n example --no-headers -o custom-columns=":metadata.name" | grep "vttablet") ; do
echo "Confirming that the mysqld_exporter is working in ${vttablet}"
open_files=$(kubectl -n example exec -it "${vttablet}" -c vttablet -- curl --max-time 10 localhost:9104/metrics | grep -E "^mysql_global_status_open_files" | awk '{print $2}' | bc)
if [[ ${open_files} -lt 1 ]]; then
echo -e "ERROR: mysqld metrics do not appear to be successfully exported from the ${vttablet} pod (open_files result: ${open_files})"
exit 1
fi
echo "Confirmed working mysqld_exporter metrics: mysql_global_status_open_files = ${open_files}"
done
}