FetchSchemas fetch schemas in schemas of CachedSchemaHandler
()
| 160 | |
| 161 | // FetchSchemas fetch schemas in schemas of CachedSchemaHandler |
| 162 | func (cf *CachedSchemaHandler) FetchSchemas() { |
| 163 | cf.RLock() |
| 164 | tables := make([]string, 0, len(cf.schemas)) |
| 165 | for tableName := range cf.schemas { |
| 166 | tables = append(tables, tableName) |
| 167 | } |
| 168 | cf.RUnlock() |
| 169 | |
| 170 | for _, tableName := range tables { |
| 171 | _, err := cf.FetchSchema(tableName) |
| 172 | if err != nil { |
| 173 | cf.logger.With("error", err.Error(), |
| 174 | "table", tableName).Errorf("Failed to fetch table schema") |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | return |
| 179 | } |
| 180 | |
| 181 | // FetchSchema fetchs the schema of given table name |
| 182 | func (cf *CachedSchemaHandler) FetchSchema(tableName string) (*TableSchema, error) { |