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 2020/04/26 06:37:50 UTC

[GitHub] [shardingsphere] tristaZero opened a new pull request #5318: Create MODULO sharding algorithm

tristaZero opened a new pull request #5318:
URL: https://github.com/apache/shardingsphere/pull/5318


   Ref #5283 
   
   Modulo Sharding Algorithm is online.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls edited a comment on pull request #5318: Create MODULO sharding algorithm

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #5318:
URL: https://github.com/apache/shardingsphere/pull/5318#issuecomment-619497614


   ## Pull Request Test Coverage Report for [Build 11247](https://coveralls.io/builds/30345751)
   
   * **21** of **25**   **(84.0%)**  changed or added relevant lines in **1** file are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.03%**) to **57.249%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/algorithm/sharding/inline/ModuloShardingAlgorithm.java](https://coveralls.io/builds/30345751/source?filename=sharding-core%2Fsharding-core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Fstrategy%2Falgorithm%2Fsharding%2Finline%2FModuloShardingAlgorithm.java#L48) | 21 | 25 | 84.0%
   <!-- | **Total:** | **21** | **25** | **84.0%** | -->
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/30345751/badge)](https://coveralls.io/builds/30345751) |
   | :-- | --: |
   | Change from base [Build 11245](https://coveralls.io/builds/30344117): |  0.03% |
   | Covered Lines: | 11918 |
   | Relevant Lines: | 20818 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls commented on pull request #5318: Create MODULO sharding algorithm

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #5318:
URL: https://github.com/apache/shardingsphere/pull/5318#issuecomment-619497614


   ## Pull Request Test Coverage Report for [Build 11246](https://coveralls.io/builds/30345504)
   
   * **21** of **25**   **(84.0%)**  changed or added relevant lines in **1** file are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.03%**) to **57.249%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/algorithm/sharding/inline/ModuloShardingAlgorithm.java](https://coveralls.io/builds/30345504/source?filename=sharding-core%2Fsharding-core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Fstrategy%2Falgorithm%2Fsharding%2Finline%2FModuloShardingAlgorithm.java#L48) | 21 | 25 | 84.0%
   <!-- | **Total:** | **21** | **25** | **84.0%** | -->
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/30345504/badge)](https://coveralls.io/builds/30345504) |
   | :-- | --: |
   | Change from base [Build 11245](https://coveralls.io/builds/30344117): |  0.03% |
   | Covered Lines: | 11918 |
   | Relevant Lines: | 20818 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #5318: Create MODULO sharding algorithm

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #5318:
URL: https://github.com/apache/shardingsphere/pull/5318#discussion_r415235895



##########
File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/algorithm/sharding/inline/ModuloShardingAlgorithm.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.core.strategy.algorithm.sharding.inline;
+
+import com.google.common.base.Preconditions;
+import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;
+import org.apache.shardingsphere.api.sharding.standard.StandardShardingAlgorithm;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Properties;
+
+/**
+ * Modulo sharding algorithm.
+ * 
+ * <p>Shard with `y = MOD(x)` algorithm.</p>
+ */
+public final class ModuloShardingAlgorithm implements StandardShardingAlgorithm<Long> {
+    
+    private static final String MODULO_VALUE = "modulo.value";

Review comment:
       "mod.value" is better

##########
File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/algorithm/sharding/inline/ModuloShardingAlgorithm.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.core.strategy.algorithm.sharding.inline;
+
+import com.google.common.base.Preconditions;
+import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;
+import org.apache.shardingsphere.api.sharding.standard.StandardShardingAlgorithm;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Properties;
+
+/**
+ * Modulo sharding algorithm.
+ * 
+ * <p>Shard with `y = MOD(x)` algorithm.</p>
+ */
+public final class ModuloShardingAlgorithm implements StandardShardingAlgorithm<Long> {
+    
+    private static final String MODULO_VALUE = "modulo.value";
+    
+    private Properties properties = new Properties();

Review comment:
       Please use lombok

##########
File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/algorithm/sharding/inline/ModuloShardingAlgorithm.java
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.core.strategy.algorithm.sharding.inline;
+
+import com.google.common.base.Preconditions;
+import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;
+import org.apache.shardingsphere.api.sharding.standard.StandardShardingAlgorithm;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Properties;
+
+/**
+ * Modulo sharding algorithm.
+ * 
+ * <p>Shard with `y = MOD(x)` algorithm.</p>
+ */
+public final class ModuloShardingAlgorithm implements StandardShardingAlgorithm<Long> {
+    
+    private static final String MODULO_VALUE = "modulo.value";
+    
+    private Properties properties = new Properties();

Review comment:
       Properties is sync one, we can not use like this way, it will cause all concurrency threads as single synchronized thread. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-io commented on pull request #5318: Create MODULO sharding algorithm

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #5318:
URL: https://github.com/apache/shardingsphere/pull/5318#issuecomment-619497135


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=h1) Report
   > Merging [#5318](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/611c38bd9d1b5d1ac2ba9dd04b48943a41aa6b8c&el=desc) will **increase** coverage by `0.03%`.
   > The diff coverage is `80.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/5318/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5318      +/-   ##
   ============================================
   + Coverage     53.69%   53.72%   +0.03%     
   - Complexity      413      414       +1     
   ============================================
     Files          1163     1164       +1     
     Lines         20793    20818      +25     
     Branches       3763     3770       +7     
   ============================================
   + Hits          11164    11184      +20     
   - Misses         8909     8913       +4     
   - Partials        720      721       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rithm/sharding/inline/ModuloShardingAlgorithm.java](https://codecov.io/gh/apache/shardingsphere/pull/5318/diff?src=pr&el=tree#diff-c2hhcmRpbmctY29yZS9zaGFyZGluZy1jb3JlLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY29yZS9zdHJhdGVneS9hbGdvcml0aG0vc2hhcmRpbmcvaW5saW5lL01vZHVsb1NoYXJkaW5nQWxnb3JpdGhtLmphdmE=) | `80.00% <80.00%> (ø)` | `1.00 <1.00> (?)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=footer). Last update [611c38b...7dc6db6](https://codecov.io/gh/apache/shardingsphere/pull/5318?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org