Support Apache ShardingSphere in StackGres
The objective of this issue is to support sharding in StackGres with Apache ShardingSphere technology. This work evolves on the capabilities that StackGres already provides for sharding (SGShardedCluster).
Project site: https://shardingsphere.apache.org/
The initial proposal is to support the Apache ShardingSphere by allowing setting the field SGShardedCluster.spec.type to shardingsphere.
The first iteration will use the ShardingSphere Proxy with the help of the ShardingSphere operator that will be a dependency of the first implementation (we may remove it in the future). The ShardingSphere Proxy Deployment (and other resources) will be generated by the ShardingSphere operator through the ComputeNode custom resource.
The Apache ShardingSphere technology will not support (in this first implementation) backup and resharding operations. Also ReducedImpact restart will not work.
The operator will configure new nodes by calling the REGISTER STORAGE UNIT statement provided by the RDL under the DistSQL umbrella from ShardingSphere Proxy using a dynamically created SGScripts. Operator will not remove nodes automatically and downscaling clusters will require the user to be already prepared by draining the shard cluster to remove manually beforehand or data loss will happens.
Operator will not support more than one database but the user will be free to create more and include them in the configuration.
Finally the ShardingSphere Proxy port (that supports DistSQL) will be published on port 5432 and no port 5433 (replication) or 8008 (patroni) will be published in the corresponding service (this part will require review to know if the implementation can support it).
The section SGShardedCluster.spec.shardingSphere will allow to configure a curated set of parameters that we will discuss in this issue (see comments) and will update here as soon as there is a quorum. Following a first proposal of how a ShardingSphere SGShardedCluster will look like:
kind: SGShardedCluster
spec:
coordinator:
configurations:
shardingSphere:
mode:
type: <string> # (standalone|cluster)
repository:
type: <string> # (memory|zooKeeper|etcd)
# if mode.type is standalone repository.type could be only memory
# if mode.type is cluster repository.type could be any of zooKeeper or etcd
zooKeeper:
serverList: [<string>] # List of ZooKeeper servers to connect to (required).
retryIntervalMilliseconds: <integer> # Retry interval milliseconds when connect with ZooKeeper curator client. Default 500.
maxRetries: <integer> # Max Retry times when connect with ZooKeeper curator client. Default 3.
timeToLiveSeconds: <integer> # ZooKeeper client session timeout value. Default 60.
operationTimeoutMilliseconds: <integer> # ZooKeeper client operation timeout value. Default 500.
digest: <string> # ZooKeeper client connection authorization schema name.
etcd:
serverList: [<string>] # List of Etcd servers to connect to (required).
timeToLiveSeconds: <integer> # Time to live seconds. Default 30.
connectionTimeout: <integer> # Time out to connection. Default 30.
authority:
privilege:
type: <string> # Authority priviliege for compute node, the default value is ALL_PRIVILEGES_PERMITTED.
Acceptance criteria:
-
Implement Apache ShardingSphere technology -
Create an E2E test -
Document the use case.