-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
分库分表同步报找不到表 #283
Comments
根据您所列的表和 异常信息中展示的表名
是不是哪儿有出入?猜测,是不是您的库里面只有部分表进行了分表 而像 |
有这个表,我没有全部列出来发自我的手机-------- 原始邮件 --------发件人: 百岁 ***@***.***>日期: 2023年11月6日周一 18:20收件人: datavane/tis ***@***.***>抄送: charnet1019 ***@***.***>, Author ***@***.***>主 题: Re: [datavane/tis] 分库分表同步报找不到表 (Issue #283)
delivery_order_0 ... 60
delivery_order_item_0 ... 60
order_0 ... 30
order_addr_0 ... 30
order_invoice_0 ... 30
根据您所列的表和 异常信息中展示的表名purchase_order_item_lang_0 并不在 这些表中
mall4cloud_order_x,tableName='purchase_order_item_lang_0
是不是哪儿有出入?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
我怀疑 |
稍等 ,我本地试试,我微信:16660356 |
找到原因了 mysql8 驱动取表元数据信息 getTables 方法的第二个参数必须要用户传dbname tis/tis-plugin/src/main/java/com/qlangtech/tis/plugin/ds/DataSourceFactory.java Lines 191 to 196 in da8a60a
try (ResultSet tables = metaData1.getTables(null, getDbSchema(), table.getTableName(), null)) {
} 而 MySQLV8DataSourceFactory 实现中使用了固定的逻辑库名 先改成这样 @Override
public String getDBSchema() {
if (this.splitTableStrategy.isSplittable()) {
// 如果使用了分表策略就不能返回默认的dbName了,不然会出错
try {
String[] dbNames = new String[1];
this.getDbConfig().vistDbName((config, jdbcUrl, ip, dbName) -> {
dbNames[0] = dbName;
return true;
});
return Objects.requireNonNull(dbNames[0], "dbName can not be null");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
// return null;
return this.dbName;
} |
库名如下:
表名如下:
delivery_order_0 ... 60
delivery_order_item_0 ... 60
order_0 ... 30
order_addr_0 ... 30
order_invoice_0 ... 30
点击设置后报错:
通过Notebook可以查看到表:
日志:
The text was updated successfully, but these errors were encountered: