-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
feature: https://github.com/apache/shardingsphere-elasticjob/issues/2461 #2462
feature: https://github.com/apache/shardingsphere-elasticjob/issues/2461 #2462
Conversation
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.
- The PR did not pass the code formatting validation. You can execute first
./mvnw spotless:apply -Pcheck -T1C
. Then execute./mvnw checkstyle:check -Pcheck -T1C
to manually adjust to repair the CI.
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.
Any updates?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2462 +/- ##
============================================
- Coverage 80.10% 79.47% -0.64%
- Complexity 1113 1123 +10
============================================
Files 204 207 +3
Lines 3821 3897 +76
Branches 445 465 +20
============================================
+ Hits 3061 3097 +36
- Misses 570 601 +31
- Partials 190 199 +9 ☔ View full report in Codecov by Sentry. |
Thanks for your advice. I follow the points what you suggested, now all code formatting validation are passed as running: ./mvnw spotless:apply -Pcheck -T1C
./mvnw checkstyle:check -Pcheck -T1C The new codes are pushed, please review. But I a little confused about that the checkstyle which caused the fields of |
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.
But I a little confused about that the checkstyle which caused the fields of AbstractJobFacade are all changed to 'private' access ability, otherwise it would fail on checkstyle testing. This is betrayed of the original intent of AbstractJobFacade which is a parent abstract class. Seems like it doesn't make sense and a little weired.
-
Do you mean you want to use private properties in the interface class? Can you explain why you want to do that? Interfaces should really only have public properties.
-
CI is a bit shaky and I'm helping with retries.
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.
How do I get the error in your picture? I didn't see any relevant error log in checkstyle CI.
No. I am not meaning use private properties in the Interface. Never mind about that now, the current codes are still works fine.
|
Never mind. The error in the picture is gone cause I had changed the codes. |
Just for clarification, you can reference the detail information from this address: https://github.com/apache/shardingsphere-elasticjob/pull/2462/checks?check_run_id=34090530003 thanks |
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.
-
From my point of view, it doesn't make sense to use the
protected
attribute, it's better to useprivate
directly. I don't think it's reasonable for the downstream to use the same java package as elasticjob. -
The current PR looks good from my perspective, but has some formatting issues.
-
If you have anything to add, please provide your opinion.
...rc/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/JobScheduler.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/JobScheduler.java
Outdated
Show resolved
Hide resolved
...sticjob/kernel/internal/sharding/strategy/type/SingleShardingBalanceJobShardingStrategy.java
Outdated
Show resolved
Hide resolved
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.
LGTM!
Fixes #2461.
Changes proposed in this pull request:
Intent
As #2461 figured out, this post is to enhancement job strategy balance in the case of single sharding.
We want to let the job run on every job instance balanced like 'Round Robin' behavior, but not stick with only one certain instance.
Solution
Basically, the design is add new single sharding handling logic which can decouple with exists logic, and can be good benefits on expanding in the future.
So there is new
SingleShardingBalanceJobShardingStrategy
and added in the SPI/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.internal.sharding.strategy.JobShardingStrategy
list. On the other side, I do codes refactor on the job facade for the entrance of job sharding strategy action. So theJobFacade
class is modified to an interface, and we have a newAbstractJobFacade
abstract class, then decouple the default sharding facade with single sharding facade. I do believe makingJobFacade
as an interface is better, this is also a good design following 'Open-close' principle.SingleShardingBalanceJobShardingStrategy
Obviously, if we want to do job running balanced in distribution multiple job instance environment, we need a center controlling on the balancement status, but I don't want this behavior to be heavy. So I use ephemeral node handling in zookeeper, this can be promised that one job running on every job instance balanced is guarded in normal running. And for the other scenarios, you know, some unexpected cases, is totally fallback to the default logic. It is very lightly and effiecent.
I also add unit tests on the new classes, and modified the exists tests code.
Please do check.
Thanks