Match $datadir and show as <datadir> for odd stuff
authorSimon J Mudd <sjmudd@pobox.com>
Thu, 4 Dec 2014 17:56:36 +0000 (18:56 +0100)
committerSimon J Mudd <sjmudd@pobox.com>
Thu, 4 Dec 2014 17:56:36 +0000 (18:56 +0100)
performance_schema/file_summary_by_instance/file_summary_by_instance_row.go

index 3e6b908..711b742 100644 (file)
@@ -274,6 +274,12 @@ func (t file_summary_by_instance_row) simple_name(global_variables map[string]st
        if re_charset.MatchString(path) == true {
                return cache.Put(path, "<charset>")
        }
+       // clean up datadir to <datadir>
+       if len(global_variables["datadir"]) > 0 {
+               re_datadir := regexp.MustCompile("^" + global_variables["datadir"])
+               path = re_datadir.ReplaceAllLiteralString(path, "<datadir>/")
+       }
+
        return cache.Put(path, path)
 }