Skip to content

Commit

Permalink
PMM-11180 fix MySQL explain json test for MariaDB 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk committed Oct 17, 2024
1 parent c90bb97 commit 5d84a90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 0 additions & 8 deletions agent/runner/actions/mysql_explain_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"bytes"
"context"
"database/sql"
"encoding/base64"
"encoding/json"
"fmt"
"strings"
Expand Down Expand Up @@ -220,13 +219,6 @@ func (a *mysqlExplainAction) explainJSON(ctx context.Context, tx *sql.Tx) ([]byt
return nil, err
}

// Check if explain_result is base64 encoded and decode it
if explainResult, ok := m["explain_result"].(string); ok {
if decoded, err := base64.StdEncoding.DecodeString(explainResult); err == nil {
m["explain_result"] = string(decoded)
}
}

// https://dev.mysql.com/doc/refman/8.0/en/explain-extended.html
rows, err := tx.QueryContext(ctx, "SHOW /* pmm-agent */ WARNINGS")
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion agent/runner/actions/mysql_explain_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ func TestMySQLExplain(t *testing.T) {

var table map[string]interface{}
if mySQLVendor == version.MariaDBVendor {
table = m.Get("query_block.read_sorted_file.filesort.table").MSI()
if mySQLVersion.Float() >= 11 {
table = m.Get("query_block.nested_loop[0].read_sorted_file.filesort.table").MSI()
} else {
table = m.Get("query_block.read_sorted_file.filesort.table").MSI()
}
} else {
table = m.Get("query_block.ordering_operation.table").MSI()
}
Expand Down

0 comments on commit 5d84a90

Please sign in to comment.