-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Add CosIdKeyGenerateAlgorithm
/ CosIdIntervalShardingAlgorithm
/CosIdModShardingAlgorithm
#14132
Conversation
- add `CosIdIntervalShardingAlgorithm` - add `CosIdModShardingAlgorithm`
…-dd HH:mm:ss` (`CosIdIntervalShardingAlgorithm`).
Codecov Report
@@ Coverage Diff @@
## master #14132 +/- ##
============================================
- Coverage 63.64% 60.88% -2.76%
+ Complexity 1843 1766 -77
============================================
Files 2865 2858 -7
Lines 42737 42502 -235
Branches 7269 7250 -19
============================================
- Hits 27198 25878 -1320
- Misses 13453 14625 +1172
+ Partials 2086 1999 -87
Continue to review full report at Codecov.
|
...main/java/org/apache/shardingsphere/sharding/algorithm/keygen/CosIdKeyGenerateAlgorithm.java
Outdated
Show resolved
Hide resolved
*/ | ||
public final class CosIdIntervalShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>> { | ||
|
||
public static final String TYPE = CosIdAlgorithm.TYPE_PREFIX + "INTERVAL"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please confirm whether all variables need public
.../apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdIntervalShardingAlgorithm.java
Outdated
Show resolved
Hide resolved
.../apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdIntervalShardingAlgorithm.java
Outdated
Show resolved
Hide resolved
.../apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdIntervalShardingAlgorithm.java
Outdated
Show resolved
Hide resolved
...a/org/apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdModShardingAlgorithm.java
Outdated
Show resolved
Hide resolved
.../java/org/apache/shardingsphere/sharding/algorithm/keygen/CosIdKeyGenerateAlgorithmTest.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@RunWith(Parameterized.class) | ||
public static class LocalDateTimePreciseValueDoShardingTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could these test methods be split into test classes?
...g/apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdModShardingAlgorithmTest.java
Outdated
Show resolved
Hide resolved
/** | ||
* CosId key generate algorithm. | ||
*/ | ||
public final class CosIdKeyGenerateAlgorithm implements KeyGenerateAlgorithm { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to know how it works in the cluster mode.
...main/java/org/apache/shardingsphere/sharding/algorithm/keygen/CosIdKeyGenerateAlgorithm.java
Outdated
Show resolved
Hide resolved
...a/org/apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdModShardingAlgorithm.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/cosid/PropertiesUtil.java
Outdated
Show resolved
Hide resolved
.../apache/shardingsphere/sharding/algorithm/sharding/cosid/CosIdIntervalShardingAlgorithm.java
Outdated
Show resolved
Hide resolved
IntervalTimeline intervalTimeline = new IntervalTimeline(logicNamePrefix, Range.closed(effectiveLower, effectiveUpper), IntervalStep.of(stepUnit, stepAmount), suffixFormatter); | ||
boolean isSecondTs = getProps().containsKey(TIMESTAMP_TYPE_KEY) | ||
&& TIMESTAMP_SECOND_TYPE.equalsIgnoreCase(getProps().getProperty(TIMESTAMP_TYPE_KEY)); | ||
final String dateTimePattern = getProps().getProperty(DATE_TIME_PATTERN_KEY, DEFAULT_DATE_TIME_PATTERN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ahoo-Wang Please remove this final modifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder: The license files under shardingsphere-distribution
should be updated since new dependencies introduced.
@TeslaCN I will follow up. |
@TeslaCN @menghaoranss |
Fixes #14047 .
Changes proposed in this pull request:
CosIdKeyGenerateAlgorithm
CosIdIntervalShardingAlgorithm
CosIdModShardingAlgorithm
https://github.com/Ahoo-Wang/CosId#shardingsphere-plugin
This pull request does not include (I will finish the rest of the issue in the next time.):