Skip to content

Commit f35c189

Browse files
committed
Fix perfTableLockWaitsQuery parsing
1 parent 1fa697f commit f35c189

File tree

1 file changed

+55
-28
lines changed

1 file changed

+55
-28
lines changed

mysqld_exporter.go

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,29 @@ const (
137137
`
138138
perfTableLockWaitsQuery = `
139139
SELECT
140-
OBJECT_SCHEMA, OBJECT_NAME,
140+
OBJECT_SCHEMA,
141+
OBJECT_NAME,
141142
COUNT_READ_NORMAL,
142143
COUNT_READ_WITH_SHARED_LOCKS,
143144
COUNT_READ_HIGH_PRIORITY,
144145
COUNT_READ_NO_INSERT,
145-
COUNT_WRITE_NORMAL,
146+
COUNT_READ_EXTERNAL,
146147
COUNT_WRITE_ALLOW_WRITE,
147148
COUNT_WRITE_CONCURRENT_INSERT,
148149
COUNT_WRITE_DELAYED,
149150
COUNT_WRITE_LOW_PRIORITY,
150-
COUNT_READ_EXTERNAL,
151-
COUNT_WRITE_EXTERNAL
151+
COUNT_WRITE_NORMAL,
152+
COUNT_WRITE_EXTERNAL,
152153
SUM_TIMER_READ_NORMAL,
153154
SUM_TIMER_READ_WITH_SHARED_LOCKS,
154155
SUM_TIMER_READ_HIGH_PRIORITY,
155156
SUM_TIMER_READ_NO_INSERT,
156-
SUM_TIMER_WRITE_NORMAL,
157+
SUM_TIMER_READ_EXTERNAL,
157158
SUM_TIMER_WRITE_ALLOW_WRITE,
158159
SUM_TIMER_WRITE_CONCURRENT_INSERT,
159160
SUM_TIMER_WRITE_DELAYED,
160161
SUM_TIMER_WRITE_LOW_PRIORITY,
161-
SUM_TIMER_READ_EXTERNAL,
162+
SUM_TIMER_WRITE_NORMAL,
162163
SUM_TIMER_WRITE_EXTERNAL
163164
FROM performance_schema.table_lock_waits_summary_by_table
164165
WHERE OBJECT_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema')
@@ -981,32 +982,58 @@ func scrapePerfTableLockWaits(db *sql.DB, ch chan<- prometheus.Metric) error {
981982
defer perfSchemaTableLockWaitsRows.Close()
982983

983984
var (
984-
objectSchema, objectName string
985-
countReadNormal, countReadWithSharedLocks uint64
986-
countReadHighPriority, countReadNoInsert uint64
987-
countWriteNormal, countWriteAllowWrite uint64
988-
countWriteConcurrentInsert, countWriteDelayed uint64
989-
countWriteLowPriority uint64
990-
countReadExternal, countWriteExternal uint64
991-
timeReadNormal, timeReadWithSharedLocks uint64
992-
timeReadHighPriority, timeReadNoInsert uint64
993-
timeWriteNormal, timeWriteAllowWrite uint64
994-
timeWriteConcurrentInsert, timeWriteDelayed uint64
995-
timeWriteLowPriority uint64
996-
timeReadExternal, timeWriteExternal uint64
985+
objectSchema string
986+
objectName string
987+
countReadNormal uint64
988+
countReadWithSharedLocks uint64
989+
countReadHighPriority uint64
990+
countReadNoInsert uint64
991+
countReadExternal uint64
992+
countWriteAllowWrite uint64
993+
countWriteConcurrentInsert uint64
994+
countWriteDelayed uint64
995+
countWriteLowPriority uint64
996+
countWriteNormal uint64
997+
countWriteExternal uint64
998+
timeReadNormal uint64
999+
timeReadWithSharedLocks uint64
1000+
timeReadHighPriority uint64
1001+
timeReadNoInsert uint64
1002+
timeReadExternal uint64
1003+
timeWriteAllowWrite uint64
1004+
timeWriteConcurrentInsert uint64
1005+
timeWriteDelayed uint64
1006+
timeWriteLowPriority uint64
1007+
timeWriteNormal uint64
1008+
timeWriteExternal uint64
9971009
)
9981010

9991011
for perfSchemaTableLockWaitsRows.Next() {
10001012
if err := perfSchemaTableLockWaitsRows.Scan(
1001-
&objectSchema, &objectName,
1002-
&countReadNormal, &countReadWithSharedLocks,
1003-
&countReadHighPriority, &countReadNoInsert, &countWriteNormal,
1004-
&countWriteAllowWrite, &countWriteConcurrentInsert, &countWriteDelayed,
1005-
&countWriteLowPriority, &countReadExternal, &countWriteExternal,
1006-
&timeReadNormal, &timeReadWithSharedLocks,
1007-
&timeReadHighPriority, &timeReadNoInsert, &timeWriteNormal,
1008-
&timeWriteAllowWrite, &timeWriteConcurrentInsert, &timeWriteDelayed,
1009-
&timeWriteLowPriority, &timeReadExternal, &timeWriteExternal,
1013+
&objectSchema,
1014+
&objectName,
1015+
&countReadNormal,
1016+
&countReadWithSharedLocks,
1017+
&countReadHighPriority,
1018+
&countReadNoInsert,
1019+
&countReadExternal,
1020+
&countWriteAllowWrite,
1021+
&countWriteConcurrentInsert,
1022+
&countWriteDelayed,
1023+
&countWriteLowPriority,
1024+
&countWriteNormal,
1025+
&countWriteExternal,
1026+
&timeReadNormal,
1027+
&timeReadWithSharedLocks,
1028+
&timeReadHighPriority,
1029+
&timeReadNoInsert,
1030+
&timeReadExternal,
1031+
&timeWriteAllowWrite,
1032+
&timeWriteConcurrentInsert,
1033+
&timeWriteDelayed,
1034+
&timeWriteLowPriority,
1035+
&timeWriteNormal,
1036+
&timeWriteExternal,
10101037
); err != nil {
10111038
return err
10121039
}

0 commit comments

Comments
 (0)