Skip to content
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

bugfix: change some fields type of TableMetaCache to avoid integer overflow #5772

Merged
merged 5 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changes/en-us/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The version is updated as follows:
- [[#5715](https://github.com/seata/seata/pull/5715)] fix get configuration item contains underlined error
- [[#5748](https://github.com/seata/seata/pull/5748)] case of the pk col-name in the business sql is inconsistent with the case in the table metadata, resulting in a rollback failure
- [[#5745](https://github.com/seata/seata/pull/5745)] fix the problem that the parameter prefix requirement of the setAttachment method in sofa-rpc is not met
- [[#5772](https://github.com/seata/seata/pull/5762)] change some fields type of TableMetaCache to avoid integer overflow

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] optimize throwable getCause once more
Expand Down Expand Up @@ -150,6 +151,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [sixlei](https://github.com/sixlei)
- [yixia](https://github.com/wt-better)
- [capthua](https://github.com/capthua)
- [robynron](https://github.com/robynron)


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
Expand Down
2 changes: 2 additions & 0 deletions changes/zh-cn/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5715](https://github.com/seata/seata/pull/5715)] 修复取中划线配置项错误问题
- [[#5748](https://github.com/seata/seata/pull/5748)] 修复在某些情况下,业务sql中主键字段名大小写与表元数据中的不一致,导致回滚失败
- [[#5745](https://github.com/seata/seata/pull/5745)] 修复不满足 sofa-rpc 中 setAttachment 方法的参数前缀要求问题
- [[#5772](https://github.com/seata/seata/pull/5762)] 修复TableMetaCache的一些字段类型,避免溢出

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] 优化多次重复获取Throwable#getCause问题
Expand Down Expand Up @@ -150,6 +151,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [sixlei](https://github.com/sixlei)
- [yixia](https://github.com/wt-better)
- [capthua](https://github.com/capthua)
- [robynron](https://github.com/robynron)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private TableMeta resultSetMetaToSchema(ResultSetMetaData rsmd, DatabaseMetaData
index.setType(rsIndex.getShort("TYPE"));
index.setOrdinalPosition(rsIndex.getShort("ORDINAL_POSITION"));
index.setAscOrDesc(rsIndex.getString("ASC_OR_DESC"));
index.setCardinality(rsIndex.getInt("CARDINALITY"));
index.setCardinality(rsIndex.getLong("CARDINALITY"));
index.getValues().add(col);
if ("PRIMARY".equalsIgnoreCase(indexName)) {
index.setIndextype(IndexType.PRIMARY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private TableMeta resultSetMetaToSchema(DatabaseMetaData dbmd, String tableName)
index.setType(rsIndex.getShort("TYPE"));
index.setOrdinalPosition(rsIndex.getShort("ORDINAL_POSITION"));
index.setAscOrDesc(rsIndex.getString("ASC_OR_DESC"));
index.setCardinality(rsIndex.getInt("CARDINALITY"));
index.setCardinality(rsIndex.getLong("CARDINALITY"));
index.getValues().add(col);
if (!index.isNonUnique()) {
index.setIndextype(IndexType.UNIQUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private TableMeta resultSetMetaToSchema(Connection connection, String tableName)
index.setType(rsIndex.getShort("type"));
index.setOrdinalPosition(rsIndex.getShort("ordinal_position"));
index.setAscOrDesc(rsIndex.getString("asc_or_desc"));
index.setCardinality(rsIndex.getInt("cardinality"));
index.setCardinality(rsIndex.getLong("cardinality"));
index.getValues().add(col);
if (!index.isNonUnique()) {
index.setIndextype(IndexType.UNIQUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public class MysqlTableMetaCacheTest {

private static Object[][] indexMetas =
new Object[][] {
new Object[] {"PRIMARY", "id", false, "", 3, 0, "A", 34},
new Object[] {"name1", "name1", false, "", 3, 1, "A", 34},
new Object[] {"name2", "name2", true, "", 3, 2, "A", 34},
new Object[] {"PRIMARY", "id", false, "", 3, 0, "A", 34L},
new Object[] {"name1", "name1", false, "", 3, 1, "A", 34L},
new Object[] {"name2", "name2", true, "", 3, 2, "A", 34L},
};

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public class SqlServerTableMetaCacheTest {
};
private static Object[][] indexMetas =
new Object[][]{
new Object[]{"id", "id", false, "", 3, 0, "A", 34},
new Object[]{"name1", "name1", false, "", 3, 1, "A", 34},
new Object[]{"name2", "name2", true, "", 3, 2, "A", 34},
new Object[]{"id", "id", false, "", 3, 0, "A", 34L},
new Object[]{"name1", "name1", false, "", 3, 1, "A", 34L},
new Object[]{"name2", "name2", true, "", 3, 2, "A", 34L},
};

private static Object[][] pkMetas =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class IndexMeta {
private short type;
private IndexType indextype;
private String ascOrDesc;
private int cardinality;
private long cardinality;
private int ordinalPosition;

/**
Expand Down Expand Up @@ -157,7 +157,7 @@ public void setAscOrDesc(String ascOrDesc) {
*
* @return the cardinality
*/
public int getCardinality() {
public long getCardinality() {
return cardinality;
}

Expand All @@ -166,7 +166,7 @@ public int getCardinality() {
*
* @param cardinality the cardinality
*/
public void setCardinality(int cardinality) {
public void setCardinality(long cardinality) {
this.cardinality = cardinality;
}

Expand Down
Loading