baiyangzhuhong opened a new pull request, #2462:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/2462
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 the `JobFacade` class is modified
to an interface, and we have a new `AbstractJobFacade` abstract class, then
decouple the default sharding facade with single sharding facade. I do believe
making `JobFacade` as an interface is better, this is also a good design
following 'Open-close' principle.
```text
JobFacade
|
\|/
AbstractJobFacade
|
/ \
/ \
/ \
ShardingJobFacade SingleShardingJobFacade
```
### 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
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]