apache / apache/shardingsphere

[Feature Request] Use unified registry center client for different scenarios in proxy

Open
#18,609 1 comment 1 reaction 0 assignees View on GitHub
mode: cluster type: refactor
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

Some discussion notes with @terrymanu . It's related to ElasticJob and ShardingSphere Proxy Mode.

Currently, registry center client will be created, all of them use configuration from mode in server.yaml:
- ModeScheduleContext.initRegistryCenter, create org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter. Which is used by db-discovery rule.
- CoordinatorRegistryCenterInitializer.createRegistryCenter, create org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter. Which is used by scaling.
- ClusterPersistRepositoryFactory.getInstance, create org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository. Which is used by proxy.

It means it might create 3 ZooKeeper client if mode Cluster type is ZooKeeper.

Why there're several registry center client?
1. `org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter` is different with `org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository`, seems could not be wrappered simply.
2. Since modules dependency hierarchy, `ModeScheduleContext` could not reuse `CoordinatorRegistryCenterInitializer`.

```
data-pipeline-core (includes CoordinatorRegistryCenterInitializer)
mode-core (CoordinatorRegistryCenterInitializer depends on it)
schedule-core (includes ModeScheduleContext)
```

It's better to use unified registry center client, just reuse the proxy one.

Contributor guide

Open the contributing guide

Research direction

Start by tracing ModeScheduleContext.initRegistryCenter, CoordinatorRegistryCenterInitializer.createRegistryCenter, and ClusterPersistRepositoryFactory.getInstance across the listed module dependency hierarchy. Compare the three registry-client creation paths and determine how the proxy repository can be reused without violating those dependencies. Done means the relevant proxy, scaling, and database-discovery scenarios use one registry center client instead of creating three ZooKeeper clients.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.