Skip to content

Commit

Permalink
线程安全的获取meta (#1866)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanxinxu authored and agapple committed Jun 18, 2019
1 parent 95602f4 commit 75b4911
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public TableMeta load(String name) throws Exception {
}
}

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, "`.`");
Expand Down Expand Up @@ -159,7 +159,7 @@ public TableMeta getTableMeta(String schema, String table, EntryPosition positio
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);
Expand Down

0 comments on commit 75b4911

Please sign in to comment.