mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
线程安全的获取meta (#1866)
This commit is contained in:
@@ -81,7 +81,7 @@ public class TableMetaCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TableMeta getTableMetaByDB(String fullname) throws IOException {
|
private synchronized TableMeta getTableMetaByDB(String fullname) throws IOException {
|
||||||
try {
|
try {
|
||||||
ResultSetPacket packet = connection.query("show create table " + fullname);
|
ResultSetPacket packet = connection.query("show create table " + fullname);
|
||||||
String[] names = StringUtils.split(fullname, "`.`");
|
String[] names = StringUtils.split(fullname, "`.`");
|
||||||
@@ -159,7 +159,7 @@ public class TableMetaCache {
|
|||||||
return getTableMeta(schema, table, true, position);
|
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;
|
TableMeta tableMeta = null;
|
||||||
if (tableMetaTSDB != null) {
|
if (tableMetaTSDB != null) {
|
||||||
tableMeta = tableMetaTSDB.find(schema, table);
|
tableMeta = tableMetaTSDB.find(schema, table);
|
||||||
|
|||||||
Reference in New Issue
Block a user