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

Fix typo #20949

Merged
merged 2 commits into from
Sep 13, 2022
Merged

Fix typo #20949

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
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
You can report a bug, submit a new feature enhancement recommendation, or commit codes by a pull request.

## Reporting Bugs
## Reporting Bug

- Before report a bug, please search from google to confirm you cannot find any hint on it.
- Look [issues List](https://github.com/apache/shardingsphere/issues) to confirm this issue is not a duplicated one.
- [Create](https://github.com/apache/shardingsphere/issues/new) a new issue.
- Define a clear and descriptive title for the issue.
- If bug reported, please provide information below:
- Details for reproduce bug step by step. Include SQL, configuration, expected results, actual results and tracing log.
- Sharding and Operation System version.
- Source code that reproduce the bug on github, can be linked here.
- ShardingSphere and your OS version.
- Source code that reproduce the bug on GitHub, can be linked here.
- Stack trace if exception thrown.
- Screenshot and animated gif to help bug reproduce if necessary.
- Screenshot for CPU, Memory, Network and IO stat if performance issue.
- If enhancement recommendation reported, please provide information below:
- Details for enhancement behaviour.
- Explain why this enhancement is general feature for most developers.
- List similar features which already available in other product if possible. Both open source and commercial software are available.
- Assign label after create issue. Label should be bug, enhancement, discussion and so on.
- Assign label after issue created. Label should be bug, enhancement, discussion and so on.
- Please pay attention on the issue and provide more information during discuss.
- Please close issue when it is resolved. If you don't close it, we will close it after 3 days。
- If this issue has new information, please reopen it again. Please note, issue can reopen which only closed by yourself. If the issue is closed by us, you have no permission to reopen any more.
- If this issue has new information, please reopen it again. Please note, issue can reopen which only closed by yourself.

## Commit pull request
## Commit Pull Request

- Please choose an interested issue, or create a new issue and then settle a correct label.
- Reply a deadline message to pickup this issue.
- Find a mentor in [Core developers list](https://shardingsphere.apache.org/community/en/team/), he will give you feedback for design and implements.
- Fork to your github repo and begin to work.
- Please follow Sharding's [Development conventions](https://shardingsphere.apache.org/community/en/involved/conduct/code/), and complete check before pull request submit.
- Fork to your GitHub repo and begin to work.
- Please follow [Development conventions](https://shardingsphere.apache.org/community/en/involved/conduct/code/), and complete check before pull request submit.
- Submit a pull request to master branch when finished.
- Mentor will do code review and discuss some details, include design, implement, performance and code style. Code will be merged until mentor accepted.
- Finally, congratulations that you have become the official contributor for Apache ShardingSphere.
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@ private String getDatabaseDiscoveryResources(final Collection<String> databaseDi

private String getDatabaseDiscoveryHeartbeat(final String discoveryHeartbeatName, final YamlRuleConfiguration ruleConfig) {
StringBuilder result = new StringBuilder();
Iterator<Entry<String, YamlDatabaseDiscoveryHeartBeatConfiguration>> discoveryHeartbeatsIter =
Iterator<Entry<String, YamlDatabaseDiscoveryHeartBeatConfiguration>> discoveryHeartbeatsConfigs =
((YamlDatabaseDiscoveryRuleConfiguration) ruleConfig).getDiscoveryHeartbeats().entrySet().iterator();
while (discoveryHeartbeatsIter.hasNext()) {
Entry<String, YamlDatabaseDiscoveryHeartBeatConfiguration> entry = discoveryHeartbeatsIter.next();
while (discoveryHeartbeatsConfigs.hasNext()) {
Entry<String, YamlDatabaseDiscoveryHeartBeatConfiguration> entry = discoveryHeartbeatsConfigs.next();
if (entry.getKey().equals(discoveryHeartbeatName)) {
getDatabaseDiscoveryProperties(entry.getValue().getProps(), result);
}
Expand All @@ -461,9 +461,9 @@ private String getDatabaseDiscoveryHeartbeat(final String discoveryHeartbeatName
private String getDatabaseDiscoveryType(final String discoveryTypeName, final YamlRuleConfiguration ruleConfig) {
StringBuilder result = new StringBuilder();
StringBuilder properties = new StringBuilder();
Iterator<Entry<String, YamlAlgorithmConfiguration>> discoveryTypesIter = ((YamlDatabaseDiscoveryRuleConfiguration) ruleConfig).getDiscoveryTypes().entrySet().iterator();
while (discoveryTypesIter.hasNext()) {
Entry<String, YamlAlgorithmConfiguration> entry = discoveryTypesIter.next();
Iterator<Entry<String, YamlAlgorithmConfiguration>> discoveryTypes = ((YamlDatabaseDiscoveryRuleConfiguration) ruleConfig).getDiscoveryTypes().entrySet().iterator();
while (discoveryTypes.hasNext()) {
Entry<String, YamlAlgorithmConfiguration> entry = discoveryTypes.next();
if (entry.getKey().equals(discoveryTypeName)) {
getDatabaseDiscoveryProperties(entry.getValue().getProps(), properties);
String typeName = entry.getValue().getType();
Expand All @@ -475,9 +475,9 @@ private String getDatabaseDiscoveryType(final String discoveryTypeName, final Ya
}

private void getDatabaseDiscoveryProperties(final Properties heartbeatProperties, final StringBuilder result) {
Iterator<Entry<Object, Object>> iterator = heartbeatProperties.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Object, Object> entry = iterator.next();
Iterator<Entry<Object, Object>> props = heartbeatProperties.entrySet().iterator();
while (props.hasNext()) {
Entry<Object, Object> entry = props.next();
result.append(String.format(DistSQLScriptConstants.DB_DISCOVERY_PROPERTY, entry.getKey(), entry.getValue()));
}
}
Expand All @@ -488,14 +488,14 @@ private void appendEncryptRules(final Collection<YamlRuleConfiguration> ruleConf
}
result.append(DistSQLScriptConstants.CREATE_ENCRYPT);
for (YamlRuleConfiguration ruleConfig : ruleConfigs) {
Iterator<Entry<String, YamlEncryptTableRuleConfiguration>> encryptTablesIter = ((YamlEncryptRuleConfiguration) ruleConfig).getTables().entrySet().iterator();
while (encryptTablesIter.hasNext()) {
Entry<String, YamlEncryptTableRuleConfiguration> entry = encryptTablesIter.next();
Iterator<Entry<String, YamlEncryptTableRuleConfiguration>> encryptTables = ((YamlEncryptRuleConfiguration) ruleConfig).getTables().entrySet().iterator();
while (encryptTables.hasNext()) {
Entry<String, YamlEncryptTableRuleConfiguration> entry = encryptTables.next();
String tableName = entry.getKey();
String columns = getEncryptColumns(entry.getValue().getColumns(), ruleConfig);
String queryWithCipher = getQueryWithCipher(entry.getValue().getQueryWithCipherColumn(), ruleConfig);
result.append(String.format(DistSQLScriptConstants.ENCRYPT, tableName, columns, queryWithCipher));
if (encryptTablesIter.hasNext()) {
if (encryptTables.hasNext()) {
result.append(DistSQLScriptConstants.COMMA).append(System.lineSeparator());
}
}
Expand Down Expand Up @@ -537,9 +537,9 @@ private String getColumnPlainAndCipher(final YamlEncryptColumnRuleConfiguration

private String getColumnType(final String encryptorName, final YamlRuleConfiguration ruleConfig) {
StringBuilder result = new StringBuilder();
Iterator<Entry<String, YamlAlgorithmConfiguration>> encryptorIter = ((YamlEncryptRuleConfiguration) ruleConfig).getEncryptors().entrySet().iterator();
while (encryptorIter.hasNext()) {
Entry<String, YamlAlgorithmConfiguration> entry = encryptorIter.next();
Iterator<Entry<String, YamlAlgorithmConfiguration>> encryptorConfigs = ((YamlEncryptRuleConfiguration) ruleConfig).getEncryptors().entrySet().iterator();
while (encryptorConfigs.hasNext()) {
Entry<String, YamlAlgorithmConfiguration> entry = encryptorConfigs.next();
if (entry.getKey().equals(encryptorName)) {
String typeName = entry.getValue().getType();
if (!entry.getValue().getProps().isEmpty()) {
Expand All @@ -555,24 +555,18 @@ private String getColumnType(final String encryptorName, final YamlRuleConfigura

private String getColumnTypeProperties(final Properties properties) {
StringBuilder result = new StringBuilder();
Iterator<Entry<Object, Object>> propertiesIter = properties.entrySet().iterator();
while (propertiesIter.hasNext()) {
Entry<Object, Object> entry = propertiesIter.next();
Iterator<Entry<Object, Object>> props = properties.entrySet().iterator();
while (props.hasNext()) {
Entry<Object, Object> entry = props.next();
result.append(String.format(DistSQLScriptConstants.ENCRYPT_TYPE_PROPERTIES, entry.getKey(), entry.getValue()));
if (propertiesIter.hasNext()) {
if (props.hasNext()) {
result.append(DistSQLScriptConstants.COMMA);
}
}
return result.toString();
}

private String getQueryWithCipher(final Boolean queryWithCipherColumn, final YamlRuleConfiguration ruleConfig) {
StringBuilder result = new StringBuilder();
if (null != queryWithCipherColumn) {
result.append(queryWithCipherColumn.toString().toLowerCase());
} else {
result.append(((YamlEncryptRuleConfiguration) ruleConfig).isQueryWithCipherColumn());
}
return result.toString();
return String.valueOf(null == queryWithCipherColumn ? ((YamlEncryptRuleConfiguration) ruleConfig).isQueryWithCipherColumn() : queryWithCipherColumn.toString().toLowerCase());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public String getType() {
return "MySQL";
}

// TODO to be confirmed, QueryHeaderBuilder should not has default value, just throw unsupport exception if database type missing
// TODO to be confirmed, QueryHeaderBuilder should not has default value, just throw unsupported exception if database type missing
@Override
public boolean isDefault() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowProcessListStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowProfileStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowProfilesStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowRelaylogEventsStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowRelayLogEventsStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowReplicaStatusStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowReplicasStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowSlaveHostsStatement;
Expand Down Expand Up @@ -741,7 +741,7 @@ public ASTNode visitShowCreateTrigger(final ShowCreateTriggerContext ctx) {

@Override
public ASTNode visitShowRelaylogEvent(final ShowRelaylogEventContext ctx) {
MySQLShowRelaylogEventsStatement result = new MySQLShowRelaylogEventsStatement();
MySQLShowRelayLogEventsStatement result = new MySQLShowRelayLogEventsStatement();
if (null != ctx.logName()) {
result.setLogName(((StringLiteralValue) visit(ctx.logName().stringLiterals().string_())).getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Getter
@Setter
@ToString(callSuper = true)
public final class MySQLShowRelaylogEventsStatement extends AbstractSQLStatement implements DALStatement, MySQLStatement {
public final class MySQLShowRelayLogEventsStatement extends AbstractSQLStatement implements DALStatement, MySQLStatement {

private String logName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<column name="read_only" />
<column name="other_attributes" />
</metadata>
<row values="write_ds_0| MySQL| mysql.empty_rules.host| 3306| write_ds_0| 30000| 60000| 1800000| 2| 2| false| &#123;&quot;oataSourceProperties&quot;&#58;&#123;&quot;cacheServerConfiguration&quot;&#58;&quot;true&quot;&#44;&quot;elideSetAutoCommits&quot;&#58;&quot;true&quot;&#44;&quot;useServerPrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;cachePrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;rewriteBatchedStatements&quot;&#58;&quot;true&quot;&#44;&quot;cacheResultSetMetadata&quot;&#58;&quot;false&quot;&#44;&quot;useLocalSessionState&quot;&#58;&quot;true&quot;&#44;&quot;maintainTimeStats&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSize&quot;&#58;&quot;8192&quot;&#44;&quot;tinyInt1isBit&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSqlLimit&quot;&#58;&quot;2048&quot;&#44;&quot;netTimeoutForStreamingResults&quot;&#58;&quot;0&quot;&#44;&quot;zeroDateTimeBehavior&quot;&#58;&quot;round&quot;&#125;&#44;&quot;healthCheckProperties&quot;&#58;&#123;&#125;&#44;&quot;initializationFailTimeout&quot;&#58;1&#44;&quot;validationTimeout&quot;&#58;5000&#44;&quot;leakDetectionThreshold&quot;&#58;0&#44;&quot;registerMbeans&quot;&#58;false&#44;&quot;allowPoolSuspension&quot;&#58;false&#44;&quot;autoCommit&quot;&#58;true&#44;&quot;isolateInternalQueries&quot;&#58;false&#125;" />
<row values="write_ds_0| MySQL| mysql.empty_rules.host| 3306| write_ds_0| 30000| 60000| 1800000| 2| 2| false| &#123;&quot;dataSourceProperties&quot;&#58;&#123;&quot;cacheServerConfiguration&quot;&#58;&quot;true&quot;&#44;&quot;elideSetAutoCommits&quot;&#58;&quot;true&quot;&#44;&quot;useServerPrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;cachePrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;rewriteBatchedStatements&quot;&#58;&quot;true&quot;&#44;&quot;cacheResultSetMetadata&quot;&#58;&quot;false&quot;&#44;&quot;useLocalSessionState&quot;&#58;&quot;true&quot;&#44;&quot;maintainTimeStats&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSize&quot;&#58;&quot;8192&quot;&#44;&quot;tinyInt1isBit&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSqlLimit&quot;&#58;&quot;2048&quot;&#44;&quot;netTimeoutForStreamingResults&quot;&#58;&quot;0&quot;&#44;&quot;zeroDateTimeBehavior&quot;&#58;&quot;round&quot;&#125;&#44;&quot;healthCheckProperties&quot;&#58;&#123;&#125;&#44;&quot;initializationFailTimeout&quot;&#58;1&#44;&quot;validationTimeout&quot;&#58;5000&#44;&quot;leakDetectionThreshold&quot;&#58;0&#44;&quot;registerMbeans&quot;&#58;false&#44;&quot;allowPoolSuspension&quot;&#58;false&#44;&quot;autoCommit&quot;&#58;true&#44;&quot;isolateInternalQueries&quot;&#58;false&#125;" />
<row values="write_ds_1| MySQL| mysql.empty_rules.host| 3306| write_ds_1| 30000| 60000| 1800000| 2| 2| false| &#123;&quot;dataSourceProperties&quot;&#58;&#123;&quot;cacheServerConfiguration&quot;&#58;&quot;true&quot;&#44;&quot;elideSetAutoCommits&quot;&#58;&quot;true&quot;&#44;&quot;useServerPrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;cachePrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;rewriteBatchedStatements&quot;&#58;&quot;true&quot;&#44;&quot;cacheResultSetMetadata&quot;&#58;&quot;false&quot;&#44;&quot;useLocalSessionState&quot;&#58;&quot;true&quot;&#44;&quot;maintainTimeStats&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSize&quot;&#58;&quot;8192&quot;&#44;&quot;tinyInt1isBit&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSqlLimit&quot;&#58;&quot;2048&quot;&#44;&quot;netTimeoutForStreamingResults&quot;&#58;&quot;0&quot;&#44;&quot;zeroDateTimeBehavior&quot;&#58;&quot;round&quot;&#125;&#44;&quot;healthCheckProperties&quot;&#58;&#123;&#125;&#44;&quot;initializationFailTimeout&quot;&#58;1&#44;&quot;validationTimeout&quot;&#58;5000&#44;&quot;leakDetectionThreshold&quot;&#58;0&#44;&quot;registerMbeans&quot;&#58;false&#44;&quot;allowPoolSuspension&quot;&#58;false&#44;&quot;autoCommit&quot;&#58;true&#44;&quot;isolateInternalQueries&quot;&#58;false&#125;" />
<row values="write_ds_2| MySQL| mysql.empty_rules.host| 3306| write_ds_2| 30000| 60000| 1800000| 2| 2| false| &#123;&quot;dataSourceProperties&quot;&#58;&#123;&quot;cacheServerConfiguration&quot;&#58;&quot;true&quot;&#44;&quot;elideSetAutoCommits&quot;&#58;&quot;true&quot;&#44;&quot;useServerPrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;cachePrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;rewriteBatchedStatements&quot;&#58;&quot;true&quot;&#44;&quot;cacheResultSetMetadata&quot;&#58;&quot;false&quot;&#44;&quot;useLocalSessionState&quot;&#58;&quot;true&quot;&#44;&quot;maintainTimeStats&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSize&quot;&#58;&quot;8192&quot;&#44;&quot;tinyInt1isBit&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSqlLimit&quot;&#58;&quot;2048&quot;&#44;&quot;netTimeoutForStreamingResults&quot;&#58;&quot;0&quot;&#44;&quot;zeroDateTimeBehavior&quot;&#58;&quot;round&quot;&#125;&#44;&quot;healthCheckProperties&quot;&#58;&#123;&#125;&#44;&quot;initializationFailTimeout&quot;&#58;1&#44;&quot;validationTimeout&quot;&#58;5000&#44;&quot;leakDetectionThreshold&quot;&#58;0&#44;&quot;registerMbeans&quot;&#58;false&#44;&quot;allowPoolSuspension&quot;&#58;false&#44;&quot;autoCommit&quot;&#58;true&#44;&quot;isolateInternalQueries&quot;&#58;false&#125;" />
<row values="write_ds_3| MySQL| mysql.empty_rules.host| 3306| write_ds_3| 30000| 60000| 1800000| 2| 2| false| &#123;&quot;dataSourceProperties&quot;&#58;&#123;&quot;cacheServerConfiguration&quot;&#58;&quot;true&quot;&#44;&quot;elideSetAutoCommits&quot;&#58;&quot;true&quot;&#44;&quot;useServerPrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;cachePrepStmts&quot;&#58;&quot;true&quot;&#44;&quot;rewriteBatchedStatements&quot;&#58;&quot;true&quot;&#44;&quot;cacheResultSetMetadata&quot;&#58;&quot;false&quot;&#44;&quot;useLocalSessionState&quot;&#58;&quot;true&quot;&#44;&quot;maintainTimeStats&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSize&quot;&#58;&quot;8192&quot;&#44;&quot;tinyInt1isBit&quot;&#58;&quot;false&quot;&#44;&quot;prepStmtCacheSqlLimit&quot;&#58;&quot;2048&quot;&#44;&quot;netTimeoutForStreamingResults&quot;&#58;&quot;0&quot;&#44;&quot;zeroDateTimeBehavior&quot;&#58;&quot;round&quot;&#125;&#44;&quot;healthCheckProperties&quot;&#58;&#123;&#125;&#44;&quot;initializationFailTimeout&quot;&#58;1&#44;&quot;validationTimeout&quot;&#58;5000&#44;&quot;leakDetectionThreshold&quot;&#58;0&#44;&quot;registerMbeans&quot;&#58;false&#44;&quot;allowPoolSuspension&quot;&#58;false&#44;&quot;autoCommit&quot;&#58;true&#44;&quot;isolateInternalQueries&quot;&#58;false&#125;" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ CREATE DATABASE expected_dataset;

CREATE TABLE expected_dataset.t_user (user_id INT NOT NULL, address_id INT NOT NULL, pwd VARCHAR(45) NULL, status VARCHAR(45) NULL, PRIMARY KEY (user_id));
CREATE TABLE expected_dataset.t_user_item (item_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
CREATE TABLE expected_dataset.t_single_table (single_id INT NOT NULL, id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (single_id));emarks VARCHAR(45) NULL, PRIMARY KEY (item_id));
CREATE TABLE expected_dataset.t_single_table (single_id INT NOT NULL, id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (single_id));

CREATE INDEX user_index_t_user ON expected_dataset.t_user (user_id);
Loading