mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
获取TableMeta信息时,增加一次retry操作
This commit is contained in:
@@ -166,9 +166,16 @@ public class TableMetaCache {
|
|||||||
if (tableMeta == null) {
|
if (tableMeta == null) {
|
||||||
// 因为条件变化,可能第一次的tableMeta没取到,需要从db获取一次,并记录到snapshot中
|
// 因为条件变化,可能第一次的tableMeta没取到,需要从db获取一次,并记录到snapshot中
|
||||||
String fullName = getFullName(schema, table);
|
String fullName = getFullName(schema, table);
|
||||||
|
ResultSetPacket packet = null;
|
||||||
|
String createDDL = null;
|
||||||
try {
|
try {
|
||||||
ResultSetPacket packet = connection.query("show create table " + fullName);
|
try {
|
||||||
String createDDL = null;
|
packet = connection.query("show create table " + fullName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 尝试做一次retry操作
|
||||||
|
connection.reconnect();
|
||||||
|
packet = connection.query("show create table " + fullName);
|
||||||
|
}
|
||||||
if (packet.getFieldValues().size() > 0) {
|
if (packet.getFieldValues().size() > 0) {
|
||||||
createDDL = packet.getFieldValues().get(1);
|
createDDL = packet.getFieldValues().get(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user