X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=performance_schema%2Ffile_summary_by_instance%2Ffile_summary_by_instance_row.go;fp=performance_schema%2Ffile_summary_by_instance%2Ffile_summary_by_instance_row.go;h=3cf01a13f8fe9e4a656d6a283d39219ebcb1b053;hb=5fda25cdcba60bba4aa0736b715088ec93e07913;hp=6c10ef40362e53c7ba5d73c38a603efaa1c0fcd3;hpb=79dc9f00908f1bc9d46d5c5eeadada11a02b08d1;p=pstop.git diff --git a/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go b/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go index 6c10ef4..3cf01a1 100644 --- a/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go +++ b/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go @@ -11,6 +11,7 @@ import ( // "strconv" "time" + "github.com/sjmudd/pstop/key_value_cache" "github.com/sjmudd/pstop/lib" ) @@ -67,6 +68,8 @@ var ( re_pid_file *regexp.Regexp = regexp.MustCompile(`/[^/]+\.pid$`) re_error_msg *regexp.Regexp = regexp.MustCompile(`/share/[^/]+/errmsg\.sys$`) re_charset *regexp.Regexp = regexp.MustCompile(`/share/charsets/Index\.xml$`) + + cache key_value_cache.KeyValueCache ) type file_summary_by_instance_row struct { @@ -209,7 +212,7 @@ func (t file_summary_by_instance_row) simple_name(global_variables map[string]st path := t.FILE_NAME - if cached_result, err := get_from_cache(path); err == nil { + if cached_result, err := cache.Get(path); err == nil { return cached_result } @@ -226,33 +229,33 @@ func (t file_summary_by_instance_row) simple_name(global_variables map[string]st if m1 := re_table_file.FindStringSubmatch(path); m1 != nil { // we may match temporary tables so check for them if m2 := re_temp_table.FindStringSubmatch(m1[2]); m2 != nil { - return save_to_cache(path, "") + return cache.Put(path, "") } // we may match partitioned tables so check for them if m3 := re_part_table.FindStringSubmatch(m1[2]); m3 != nil { - return save_to_cache(path, m1[1]+"."+m3[1]) // . (less partition info) + return cache.Put(path, m1[1]+"."+m3[1]) // .
(less partition info) } - return save_to_cache(path, m1[1]+"."+m1[2]) // .
+ return cache.Put(path, m1[1]+"."+m1[2]) // .
} if re_ibdata.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_redo_log.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_binlog.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_db_opt.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_slowlog.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_auto_cnf.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } // 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, @@ -265,19 +268,19 @@ func (t file_summary_by_instance_row) simple_name(global_variables map[string]st } re_relay_log := relay_log + `\.(\d{6}|index)$` if regexp.MustCompile(re_relay_log).MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } } if re_pid_file.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_error_msg.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } if re_charset.MatchString(path) == true { - return save_to_cache(path, "") + return cache.Put(path, "") } - return save_to_cache(path, path) + return cache.Put(path, path) } // Convert the imported "table" to a merged one with merged data.