线程安全的获取meta (#1866)

This commit is contained in:
lanxinxu
2019-06-18 14:59:30 +08:00
committed by agapple
parent 95602f4784
commit 75b4911caf

View File

@@ -81,7 +81,7 @@ public class TableMetaCache {
}
}
private TableMeta getTableMetaByDB(String fullname) throws IOException {
private synchronized TableMeta getTableMetaByDB(String fullname) throws IOException {
try {
ResultSetPacket packet = connection.query("show create table " + fullname);
String[] names = StringUtils.split(fullname, "`.`");
@@ -159,7 +159,7 @@ public class TableMetaCache {
return getTableMeta(schema, table, true, position);
}
public TableMeta getTableMeta(String schema, String table, boolean useCache, EntryPosition position) {
public synchronized TableMeta getTableMeta(String schema, String table, boolean useCache, EntryPosition position) {
TableMeta tableMeta = null;
if (tableMetaTSDB != null) {
tableMeta = tableMetaTSDB.find(schema, table);