Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
mychange 1
Browse files Browse the repository at this point in the history
my change 2

optimize: optimize channel availability thread log output (apache#5563)

feature:docker image supports JVM parameter injection (apache#5529)

test: add unit test for transaction messages (apache#5637)

feature: support trace the transaction link according to the XID (apache#5600)

test: add unit test case for ExporterType/RegistryType (apache#5622)

optimize: possible conflict between asyncCommitting thread and retryCommitting thread (apache#5623)

optimize: possible conflict between asyncCommitting thread and retryCommitting thread (apache#5623)

optimize: support case-sensitive attributes for table and column metadata (apache#5553)
  • Loading branch information
sixlei authored and Pil0tXia committed Jun 14, 2023
1 parent c97f409 commit dd7431f
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 28 deletions.
6 changes: 3 additions & 3 deletions changes/en-us/2.0.0.md
Expand Up @@ -93,6 +93,8 @@ The version is updated as follows:
- [[#5419](https://github.com/seata/seata/pull/5419)] optimize images based on java 8/17 and support maven-3.9.0
- [[#5549](https://github.com/seata/seata/pull/5549)] update expire gpg key and publish workflow
- [[#5576](https://github.com/seata/seata/pull/5576)] The common fence clean task is only initiated when useTCCFence is set to true
- [[#5623](https://github.com/seata/seata/pull/5623)] optimize possible conflict between asyncCommitting thread and retryCommitting thread
- [[#5553](https://github.com/seata/seata/pull/5553)] support case-sensitive attributes for table and column metadata

### test:
- [[#5308](https://github.com/seata/seata/pull/5308)] add unit test [FileLoader, ObjectHolder, StringUtils]
Expand All @@ -103,10 +105,7 @@ The version is updated as follows:
- [[#5391](https://github.com/seata/seata/pull/5391)] add unit test for config module
- [[#5428](https://github.com/seata/seata/pull/5428)] fix FileTransactionStoreManagerTest failed
- [[#5622](https://github.com/seata/seata/pull/5622)] add unit test [ExporterType, RegistryType]
<<<<<<< HEAD
- [[#5637](https://github.com/seata/seata/pull/5637)] add unit test [BatchResultMessage, HeartbeatMessage, RegisterRMResponse, ResultCode, RegisterTMResponse, MergeResultMessage, MergedWarpMessage, Version]
=======
>>>>>>> 4de002f1 (test: add unit test case for ExporterType/RegistryType (#5622))


### Contributors:
Expand All @@ -132,6 +131,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [dmego](https://github.com/dmego)
- [zsp419](https://github.com/zsp419)
- [tuwenlin](https://github.com/tuwenlin)
- [sixlei](https://github.com/sixlei)


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
Expand Down
6 changes: 3 additions & 3 deletions changes/zh-cn/2.0.0.md
Expand Up @@ -93,6 +93,8 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5419](https://github.com/seata/seata/pull/5419)] 优化镜像发布流水线支持jdk8/17和支持maven 3.9.0
- [[#5549](https://github.com/seata/seata/pull/5549)] 优化 gpg key 和 发布流水线
- [[#5576](https://github.com/seata/seata/pull/5576)] 仅当 useTCCFence 设置为 true 时,才开启 Fence 表清理任务
- [[#5623](https://github.com/seata/seata/pull/5623)] 优化异步提交线程和重试线程之间可能存在的冲突
- [[#5553](https://github.com/seata/seata/pull/5553)] 支持表和列元数据大小写敏感设置

### security:
- [[#5172](https://github.com/seata/seata/pull/5172)] 修复一些安全漏洞的版本
Expand All @@ -106,10 +108,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5391](https://github.com/seata/seata/pull/5391)] 添加 config 模块的单元测试用例
- [[#5428](https://github.com/seata/seata/pull/5428)] 修复 FileTransactionStoreManagerTest 单测失败问题
- [[#5622](https://github.com/seata/seata/pull/5622)] 添加单元测试用例 [ExporterType, RegistryType]
<<<<<<< HEAD
- [[#5637](https://github.com/seata/seata/pull/5637)] 添加单元测试用例 [BatchResultMessage, HeartbeatMessage, RegisterRMResponse, ResultCode, RegisterTMResponse, MergeResultMessage, MergedWarpMessage, Version]
=======
>>>>>>> 4de002f1 (test: add unit test case for ExporterType/RegistryType (#5622))


### Contributors:
Expand All @@ -135,6 +134,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [dmego](https://github.com/dmego)
- [zsp419](https://github.com/zsp419)
- [tuwenlin](https://github.com/tuwenlin)
- [sixlei](https://github.com/sixlei)

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

Expand Down
24 changes: 24 additions & 0 deletions common/src/main/java/io/seata/common/util/StringUtils.java
Expand Up @@ -349,4 +349,28 @@ public static String hump2Line(String str) {
return sb.toString();
}

public static boolean hasLowerCase(String str) {
if (null == str) {
return false;
}
for (int i = 0; i < str.length(); i++) {
if (Character.isLowerCase(str.charAt(i))) {
return true;
}
}
return false;
}

public static boolean hasUpperCase(String str) {
if (null == str) {
return false;
}
for (int i = 0; i < str.length(); i++) {
if (Character.isUpperCase(str.charAt(i))) {
return true;
}
}
return false;
}

}
Expand Up @@ -43,6 +43,8 @@ public class ColumnMeta {
private String isAutoincrement;
private boolean isOnUpdate;

private boolean isCaseSensitive;

/**
* Instantiates a new Column meta.
*/
Expand All @@ -51,27 +53,29 @@ public ColumnMeta() {

@Override
public String toString() {
return "ColumnMeta{" +
"tableCat='" + tableCat + '\'' +
", tableSchemaName='" + tableSchemaName + '\'' +
", tableName='" + tableName + '\'' +
", columnName='" + columnName + '\'' +
", dataType=" + dataType +
", dataTypeName='" + dataTypeName + '\'' +
", columnSize=" + columnSize +
", decimalDigits=" + decimalDigits +
", numPrecRadix=" + numPrecRadix +
", nullAble=" + nullAble +
", remarks='" + remarks + '\'' +
", columnDef='" + columnDef + '\'' +
", sqlDataType=" + sqlDataType +
", sqlDatetimeSub=" + sqlDatetimeSub +
", charOctetLength=" + charOctetLength +
", ordinalPosition=" + ordinalPosition +
", isNullAble='" + isNullAble + '\'' +
", isAutoincrement='" + isAutoincrement + '\'' +
", isOnUpdate=" + isOnUpdate +
'}';
final StringBuilder sb = new StringBuilder("ColumnMeta{");
sb.append("tableCat='").append(tableCat).append('\'');
sb.append(", tableSchemaName='").append(tableSchemaName).append('\'');
sb.append(", tableName='").append(tableName).append('\'');
sb.append(", columnName='").append(columnName).append('\'');
sb.append(", dataType=").append(dataType);
sb.append(", dataTypeName='").append(dataTypeName).append('\'');
sb.append(", columnSize=").append(columnSize);
sb.append(", decimalDigits=").append(decimalDigits);
sb.append(", numPrecRadix=").append(numPrecRadix);
sb.append(", nullAble=").append(nullAble);
sb.append(", remarks='").append(remarks).append('\'');
sb.append(", columnDef='").append(columnDef).append('\'');
sb.append(", sqlDataType=").append(sqlDataType);
sb.append(", sqlDatetimeSub=").append(sqlDatetimeSub);
sb.append(", charOctetLength=").append(charOctetLength);
sb.append(", ordinalPosition=").append(ordinalPosition);
sb.append(", isNullAble='").append(isNullAble).append('\'');
sb.append(", isAutoincrement='").append(isAutoincrement).append('\'');
sb.append(", isOnUpdate=").append(isOnUpdate);
sb.append(", isCaseSensitive=").append(isCaseSensitive);
sb.append('}');
return sb.toString();
}

/**
Expand Down Expand Up @@ -415,6 +419,14 @@ public void setOnUpdate(boolean onUpdate) {
isOnUpdate = onUpdate;
}

public boolean isCaseSensitive() {
return isCaseSensitive;
}

public void setCaseSensitive(boolean caseSensitive) {
isCaseSensitive = caseSensitive;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down Expand Up @@ -481,6 +493,9 @@ public boolean equals(Object o) {
if (!Objects.equals(columnMeta.isOnUpdate, this.isOnUpdate)) {
return false;
}
if (!Objects.equals(columnMeta.isCaseSensitive, this.isCaseSensitive)) {
return false;
}
return true;
}

Expand All @@ -505,6 +520,7 @@ public int hashCode() {
hash += Objects.hashCode(isNullAble);
hash += Objects.hashCode(isAutoincrement);
hash += Objects.hashCode(isOnUpdate);
hash += Objects.hashCode(isCaseSensitive);
return hash;
}
}
Expand Up @@ -36,6 +36,8 @@
public class TableMeta {
private String tableName;

private boolean isCaseSensitive;

/**
* key: column name
*/
Expand Down Expand Up @@ -92,6 +94,24 @@ public Map<String, IndexMeta> getAllIndexes() {
return allIndexes;
}

/**
* Is case sensitive boolean.
*
* @return the boolean
*/
public boolean isCaseSensitive() {
return isCaseSensitive;
}

/**
* Sets case sensitive.
*
* @param caseSensitive the case sensitive
*/
public void setCaseSensitive(boolean caseSensitive) {
isCaseSensitive = caseSensitive;
}

/**
* Gets auto increase column.
*
Expand Down Expand Up @@ -214,6 +234,7 @@ public int hashCode() {
int hash = Objects.hashCode(tableName);
hash += Objects.hashCode(allColumns);
hash += Objects.hashCode(allIndexes);
hash += Objects.hashCode(isCaseSensitive);
return hash;
}
}
Expand Up @@ -106,6 +106,9 @@ private TableMeta resultSetMetaToSchema(ResultSetMetaData rsmd, DatabaseMetaData

TableMeta tm = new TableMeta();
tm.setTableName(tableName);
//always true and nothing to do with escape characters for mysql.
// May be not consistent with lower_case_table_names
tm.setCaseSensitive(true);

/*
* here has two different type to get the data
Expand Down Expand Up @@ -137,6 +140,7 @@ private TableMeta resultSetMetaToSchema(ResultSetMetaData rsmd, DatabaseMetaData
col.setOrdinalPosition(rsColumns.getInt("ORDINAL_POSITION"));
col.setIsNullAble(rsColumns.getString("IS_NULLABLE"));
col.setIsAutoincrement(rsColumns.getString("IS_AUTOINCREMENT"));
col.setCaseSensitive(rsmd.isCaseSensitive(col.getOrdinalPosition()));

if (tm.getAllColumns().containsKey(col.getColumnName())) {
throw new NotSupportYetException("Not support the table has the same column name with different case yet");
Expand Down
Expand Up @@ -91,6 +91,7 @@ private TableMeta resultSetMetaToSchema(DatabaseMetaData dbmd, String tableName)
} else {
tableName = tableName.toUpperCase();
}
tm.setCaseSensitive(StringUtils.hasLowerCase(tableName));

try (ResultSet rsColumns = dbmd.getColumns("", schemaName, tableName, "%");
ResultSet rsIndex = dbmd.getIndexInfo(null, schemaName, tableName, false, true);
Expand All @@ -114,6 +115,7 @@ private TableMeta resultSetMetaToSchema(DatabaseMetaData dbmd, String tableName)
col.setCharOctetLength(rsColumns.getInt("CHAR_OCTET_LENGTH"));
col.setOrdinalPosition(rsColumns.getInt("ORDINAL_POSITION"));
col.setIsNullAble(rsColumns.getString("IS_NULLABLE"));
col.setCaseSensitive(StringUtils.hasLowerCase(col.getColumnName()));

if (tm.getAllColumns().containsKey(col.getColumnName())) {
throw new NotSupportYetException("Not support the table has the same column name with different case yet");
Expand Down
Expand Up @@ -108,6 +108,7 @@ private TableMeta resultSetMetaToSchema(Connection connection, String tableName)
} else {
tableName = tableName.toLowerCase();
}
tm.setCaseSensitive(StringUtils.hasUpperCase(tableName));

try (ResultSet rsColumns = dbmd.getColumns(null, schemaName, tableName, "%");
ResultSet rsIndex = dbmd.getIndexInfo(null, schemaName, tableName, false, true);
Expand All @@ -132,6 +133,7 @@ private TableMeta resultSetMetaToSchema(Connection connection, String tableName)
col.setOrdinalPosition(rsColumns.getInt("ORDINAL_POSITION"));
col.setIsNullAble(rsColumns.getString("IS_NULLABLE"));
col.setIsAutoincrement(rsColumns.getString("IS_AUTOINCREMENT"));
col.setCaseSensitive(StringUtils.hasUpperCase(col.getColumnName()));

if (tm.getAllColumns().containsKey(col.getColumnName())) {
throw new NotSupportYetException("Not support the table has the same column name with different case yet");
Expand Down
Expand Up @@ -411,7 +411,9 @@ protected void handleRetryCommitting() {
SessionHelper.forEach(committingSessions, committingSession -> {
try {
// prevent repeated commit
if (GlobalStatus.Committing.equals(committingSession.getStatus()) && !committingSession.isDeadSession()) {
if ((GlobalStatus.Committing.equals(committingSession.getStatus())
|| GlobalStatus.Committed.equals(committingSession.getStatus()))
&& !committingSession.isDeadSession()) {
// The function of this 'return' is 'continue'.
return;
}
Expand Down

0 comments on commit dd7431f

Please sign in to comment.