// ensure performance_schema is enabled // - if not will not return and will exit func ensurePerformanceSchemaEnabled(variables *global.Variables) { if variables == nil { log.Fatal("ensurePerformanceSchemaEnabled() variables is nil") } // check that performance_schema = ON if value := variables.Get("performance_schema"); value != "ON" { log.Fatal(fmt.Sprintf("ensurePerformanceSchemaEnabled(): performance_schema = '%s'. Please configure performance_schema = 1 in /etc/my.cnf (or equivalent) and restart mysqld to use %s.", value, lib.MyName())) } else { logger.Println("performance_schema = ON check succeeds") } }
// From the original name we want to generate a simpler name to use. // This simpler name may also merge several different filenames into one. func (row Row) simplifyName(globalVariables *global.Variables) string { path := row.name if cachedResult, err := cache.Get(path); err == nil { return cachedResult } // @0024 --> $ (should do this more generically) path = reDollar.ReplaceAllLiteralString(path, "$") // this should probably be ordered from most expected regexp to least if m1 := reTableFile.FindStringSubmatch(path); m1 != nil { // we may match temporary tables so check for them if m2 := reTempTable.FindStringSubmatch(m1[2]); m2 != nil { return cache.Put(path, "<temp_table>") } // we may match partitioned tables so check for them if m3 := rePartTable.FindStringSubmatch(m1[2]); m3 != nil { return cache.Put(path, lib.TableName(m1[1], m3[1])) // <schema>.<table> (less partition info) } return cache.Put(path, rc.Munge(lib.TableName(m1[1], m1[2]))) // <schema>.<table> } if reIbtmp.MatchString(path) { return cache.Put(path, "<ibtmp>") } if reIbdata.MatchString(path) { return cache.Put(path, "<ibdata>") } if reRedoLog.MatchString(path) { return cache.Put(path, "<redo_log>") } if reBinlog.MatchString(path) { return cache.Put(path, "<binlog>") } if reDbOpt.MatchString(path) { return cache.Put(path, "<db_opt>") } if reSlowlog.MatchString(path) { return cache.Put(path, "<slow_log>") } if reAutoCnf.MatchString(path) { return cache.Put(path, "<auto_cnf>") } // relay logs are a bit complicated. If a full path then easy to // identify, but if a relative path we may need to add $datadir, // but also if as I do we have a ../blah/somewhere/path then we // need to make it match too. if len(globalVariables.Get("relay_log")) > 0 { relayLog := globalVariables.Get("relay_log") if relayLog[0] != '/' { // relative path relayLog = cleanupPath(globalVariables.Get("datadir") + relayLog) // datadir always ends in / } reRelayLog := relayLog + `\.(\d{6}|index)$` if regexp.MustCompile(reRelayLog).MatchString(path) { return cache.Put(path, "<relay_log>") } } if rePidFile.MatchString(path) { return cache.Put(path, "<pid_file>") } if reErrorMsg.MatchString(path) { return cache.Put(path, "<errmsg>") } if reCharset.MatchString(path) { return cache.Put(path, "<charset>") } // clean up datadir to <datadir> if len(globalVariables.Get("datadir")) > 0 { reDatadir := regexp.MustCompile("^" + globalVariables.Get("datadir")) path = reDatadir.ReplaceAllLiteralString(path, "<datadir>/") } return cache.Put(path, path) }