You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/05/07 02:20:03 UTC
[GitHub] [shardingsphere] azexcy opened a new pull request, #17403: Add MySQL unsigned int type at Scaling IT test
azexcy opened a new pull request, #17403:
URL: https://github.com/apache/shardingsphere/pull/17403
Changes proposed in this pull request:
- Split increment task
- Add MySQL unsigned int type at IT test
- Simple sql statement extracted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #17403: Add MySQL unsigned int type at Scaling IT test
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #17403:
URL: https://github.com/apache/shardingsphere/pull/17403#issuecomment-1120211787
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/17403?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#17403](https://codecov.io/gh/apache/shardingsphere/pull/17403?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b47e1b3) into [master](https://codecov.io/gh/apache/shardingsphere/commit/963049f25b1fd9c3bb42015f4162ac9a3262d712?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (963049f) will **decrease** coverage by `0.08%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #17403 +/- ##
============================================
- Coverage 59.12% 59.04% -0.09%
+ Complexity 2108 2107 -1
============================================
Files 3543 3549 +6
Lines 52948 53044 +96
Branches 9049 9058 +9
============================================
+ Hits 31308 31322 +14
- Misses 18997 19078 +81
- Partials 2643 2644 +1
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/17403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...apache/shardingsphere/spi/type/typed/TypedSPI.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcGkvdHlwZS90eXBlZC9UeXBlZFNQSS5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...obal/general/ShardingSphereGeneralLockManager.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtY2x1c3Rlci1tb2RlL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItbW9kZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL21hbmFnZXIvY2x1c3Rlci9jb29yZGluYXRvci9sb2NrL2dsb2JhbC9nZW5lcmFsL1NoYXJkaW5nU3BoZXJlR2VuZXJhbExvY2tNYW5hZ2VyLmphdmE=) | `44.00% <0.00%> (-18.86%)` | :arrow_down: |
| [...manager/standalone/lock/StandaloneLockContext.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL21hbmFnZXIvc3RhbmRhbG9uZS9sb2NrL1N0YW5kYWxvbmVMb2NrQ29udGV4dC5qYXZh) | `5.71% <0.00%> (-3.38%)` | :arrow_down: |
| [...hardingsphere/spi/type/typed/TypedSPIRegistry.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcGkvdHlwZS90eXBlZC9UeXBlZFNQSVJlZ2lzdHJ5LmphdmE=) | `89.28% <0.00%> (-3.31%)` | :arrow_down: |
| [...ock/global/ShardingSphereDistributeGlobalLock.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtY2x1c3Rlci1tb2RlL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItbW9kZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL21hbmFnZXIvY2x1c3Rlci9jb29yZGluYXRvci9sb2NrL2dsb2JhbC9TaGFyZGluZ1NwaGVyZURpc3RyaWJ1dGVHbG9iYWxMb2NrLmphdmE=) | `3.75% <0.00%> (-0.54%)` | :arrow_down: |
| [...rovider/schema/builder/SchemaPrivilegeBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUta2VybmVsL3NoYXJkaW5nc3BoZXJlLWF1dGhvcml0eS9zaGFyZGluZ3NwaGVyZS1hdXRob3JpdHktY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYXV0aG9yaXR5L3Byb3ZpZGVyL3NjaGVtYS9idWlsZGVyL1NjaGVtYVByaXZpbGVnZUJ1aWxkZXIuamF2YQ==) | `90.62% <0.00%> (-0.29%)` | :arrow_down: |
| [...l/parser/core/database/visitor/SQLVisitorRule.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9jb3JlL2RhdGFiYXNlL3Zpc2l0b3IvU1FMVmlzaXRvclJ1bGUuamF2YQ==) | `100.00% <0.00%> (ø)` | |
| [...schema/loader/spi/DialectSchemaMetaDataLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvbG9hZGVyL3NwaS9EaWFsZWN0U2NoZW1hTWV0YURhdGFMb2FkZXIuamF2YQ==) | `87.50% <0.00%> (ø)` | |
| [...eline/spi/ingest/position/PositionInitializer.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUta2VybmVsL3NoYXJkaW5nc3BoZXJlLWRhdGEtcGlwZWxpbmUvc2hhcmRpbmdzcGhlcmUtZGF0YS1waXBlbGluZS1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RhdGEvcGlwZWxpbmUvc3BpL2luZ2VzdC9wb3NpdGlvbi9Qb3NpdGlvbkluaXRpYWxpemVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...re/mode/manager/memory/lock/MemoryLockContext.java](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtbWVtb3J5LW1vZGUvc2hhcmRpbmdzcGhlcmUtbWVtb3J5LW1vZGUtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvbW9kZS9tYW5hZ2VyL21lbW9yeS9sb2NrL01lbW9yeUxvY2tDb250ZXh0LmphdmE=) | `0.00% <0.00%> (ø)` | |
| ... and [17 more](https://codecov.io/gh/apache/shardingsphere/pull/17403/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/17403?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/17403?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [963049f...b47e1b3](https://codecov.io/gh/apache/shardingsphere/pull/17403?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] sandynz merged pull request #17403: Add MySQL unsigned int type at Scaling IT test
Posted by GitBox <gi...@apache.org>.
sandynz merged PR #17403:
URL: https://github.com/apache/shardingsphere/pull/17403
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] sandynz commented on a diff in pull request #17403: Add MySQL unsigned int type at Scaling IT test
Posted by GitBox <gi...@apache.org>.
sandynz commented on code in PR #17403:
URL: https://github.com/apache/shardingsphere/pull/17403#discussion_r867340121
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/mysql/MySQLIncrementTaskRunnable.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.integration.data.pipeline.cases.mysql;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.shardingsphere.integration.data.pipeline.cases.command.CommonSQLCommand;
+import org.apache.shardingsphere.integration.data.pipeline.util.TableCrudUtil;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.sql.SQLException;
+import java.util.LinkedList;
+import java.util.List;
+
+@Slf4j
+@AllArgsConstructor
+public final class MySQLIncrementTaskRunnable implements Runnable {
+
+ private static final String INSERT_ORDER = "INSERT INTO t_order (id,order_id,user_id) VALUES (?, ?, ?)";
+
+ private static final String INSERT_ORDER_ITEM = "INSERT INTO t_order_item(item_id,order_id,user_id,status) VALUES(?,?,?,?)";
+
+ private static final String UPDATE_ORDER_BY_ID = "UPDATE t_order SET t_varchar = 'update',t_unsigned_int = %s WHERE id = %s";
+
+ private static final String UPDATE_ORDER_ITEM_BY_ID = "UPDATE t_order_item SET status = 'changed' WHERE item_id = %s";
+
+ private final JdbcTemplate jdbcTemplate;
+
+ private final CommonSQLCommand commonSQLCommand;
+
+ @Override
+ public void run() {
+ int executeCount = 0;
+ List<Long> newPrimaryKeys = new LinkedList<>();
+ try {
+ while (!Thread.currentThread().isInterrupted() && executeCount < 20) {
+ newPrimaryKeys.add(insertOrderAndOrderItem());
+ if (newPrimaryKeys.size() % 2 == 0) {
Review Comment:
Constant could be put at first.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLIncrementTaskRunnable.java:
##########
@@ -30,7 +30,15 @@
@Slf4j
@AllArgsConstructor
-public final class IncrementTaskRunnable implements Runnable {
+public final class PostgreSQLIncrementTaskRunnable implements Runnable {
+
+ private static final String UPDATE_ORDER_BY_ID = "UPDATE t_order SET t_varchar = 'update' WHERE id = %s";
+
+ private static final String UPDATE_ORDER_ITEM_BY_ID = "UPDATE t_order_item SET status = 'changed' WHERE item_id = %s";
+
+ private static final String INSERT_ORDER = "INSERT INTO t_order ( id, order_id, user_id) VALUES (?, ?, ?)";
+
+ private static final String INSERT_ORDER_ITEM = "INSERT INTO t_order_item (item_id, order_id, user_id, status) VALUES(?,?,?,?)";
Review Comment:
1, It's better to extract DAO for better code reuse.
2, It's better to update column to dynamic value, e.g. text + now().
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/mysql/MySQLIncrementTaskRunnable.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.integration.data.pipeline.cases.mysql;
+
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.shardingsphere.integration.data.pipeline.cases.command.CommonSQLCommand;
+import org.apache.shardingsphere.integration.data.pipeline.util.TableCrudUtil;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.sql.SQLException;
+import java.util.LinkedList;
+import java.util.List;
+
+@Slf4j
+@AllArgsConstructor
+public final class MySQLIncrementTaskRunnable implements Runnable {
+
+ private static final String INSERT_ORDER = "INSERT INTO t_order (id,order_id,user_id) VALUES (?, ?, ?)";
+
+ private static final String INSERT_ORDER_ITEM = "INSERT INTO t_order_item(item_id,order_id,user_id,status) VALUES(?,?,?,?)";
+
+ private static final String UPDATE_ORDER_BY_ID = "UPDATE t_order SET t_varchar = 'update',t_unsigned_int = %s WHERE id = %s";
+
+ private static final String UPDATE_ORDER_ITEM_BY_ID = "UPDATE t_order_item SET status = 'changed' WHERE item_id = %s";
+
+ private final JdbcTemplate jdbcTemplate;
+
+ private final CommonSQLCommand commonSQLCommand;
+
+ @Override
+ public void run() {
+ int executeCount = 0;
+ List<Long> newPrimaryKeys = new LinkedList<>();
+ try {
+ while (!Thread.currentThread().isInterrupted() && executeCount < 20) {
+ newPrimaryKeys.add(insertOrderAndOrderItem());
+ if (newPrimaryKeys.size() % 2 == 0) {
+ deleteOrderAndOrderItem(newPrimaryKeys.get(newPrimaryKeys.size() - 1));
+ } else {
+ updateOrderAndOrderItem(newPrimaryKeys.get(newPrimaryKeys.size() - 1));
+ }
+ executeCount++;
+ log.info("Increment task runnable execute successfully.");
+ }
+ } catch (final SQLException ex) {
+ log.error("IncrementTaskThread error", ex);
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private long insertOrderAndOrderItem() throws SQLException {
+ Pair<Object[], Object[]> dataPair = TableCrudUtil.generateSimpleInsertData();
+ jdbcTemplate.update(INSERT_ORDER, dataPair.getLeft());
+ jdbcTemplate.update(INSERT_ORDER_ITEM, dataPair.getRight());
+ return Long.parseLong(dataPair.getLeft()[0].toString());
+ }
+
+ private void updateOrderAndOrderItem(final long primaryKey) throws SQLException {
+ jdbcTemplate.execute(String.format(UPDATE_ORDER_BY_ID, "null", primaryKey));
+ jdbcTemplate.execute(String.format(UPDATE_ORDER_BY_ID, "100", primaryKey));
Review Comment:
It's better use parepared statement later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] sandynz commented on a diff in pull request #17403: Add MySQL unsigned int type at Scaling IT test
Posted by GitBox <gi...@apache.org>.
sandynz commented on code in PR #17403:
URL: https://github.com/apache/shardingsphere/pull/17403#discussion_r867340667
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/postgresql/PostgreSQLIncrementTaskRunnable.java:
##########
@@ -30,7 +30,15 @@
@Slf4j
@AllArgsConstructor
-public final class IncrementTaskRunnable implements Runnable {
+public final class PostgreSQLIncrementTaskRunnable implements Runnable {
+
+ private static final String UPDATE_ORDER_BY_ID = "UPDATE t_order SET t_varchar = 'update' WHERE id = %s";
+
+ private static final String UPDATE_ORDER_ITEM_BY_ID = "UPDATE t_order_item SET status = 'changed' WHERE item_id = %s";
+
+ private static final String INSERT_ORDER = "INSERT INTO t_order ( id, order_id, user_id) VALUES (?, ?, ?)";
+
+ private static final String INSERT_ORDER_ITEM = "INSERT INTO t_order_item (item_id, order_id, user_id, status) VALUES(?,?,?,?)";
Review Comment:
It's better to update column to dynamic value, e.g. text + now().
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org