You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/05/03 11:14:13 UTC

[GitHub] [shardingsphere] tristaZero opened a new issue #10252: [Enhancement] Support authority rule governance through different proxies

tristaZero opened a new issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252


   Hi, community,
   
   This issue is about authority rule governance. I have to say it is difficult.. But you will perceive how the governance works and how proxies refresh its metadata to keep consistent! Oh, great challenge! 
   
   ### Introduction
   As you know, the authority module is a new feature for our incoming release. Authority is about user and privileges' management. Consequently, the authority rule is to configure users and privilege-loading algorithm, i.e.,
   
   ```yaml
   # server.yaml
   users:
     - root@%:root
     - sharding@:sharding
   rules:
     - !AUTHORITY
       provider:
         type: NATIVE
   ```
   **Notice, #10251 is for merging the user's configuration into authority rule.  Two of the issues are relevant, so please keep an eye on the other one.**
   
   Currently, the proxy has supported authority rule configuration but can not do authority governance through multiple proxies, which means when there is an authority rule change, other proxies can receive the modification from a zookeeper. 
   
   So the sub-tasks of this issue are,
   1 Synchronize local authority configuration to zookeeper once proxy starts.
   2 When authority rule is altered in zookeeper, proxies can receive this change notification from the zookeeper and refresh its local metadata.
   ---
   Once #10251 finishes, the following tasks are ready to begin.
   3 The change of handling `CREATE USER` event
   4 Remove the user node and user listener from governance.
   
   From [zookeeper node distribution](https://shardingsphere.apache.org/document/current/cn/features/governance/management/registry-center/), we can know the directory tree of metadata in the zookeeper is the following one. Finally, we aim at removing `users node` and adding a `global rule node` like the following diagram shows,
   
   ```yaml
   namespace
      ├──users  # To be removed                                    
      ├──props    
      ├──rule  # To be added                                 
      ├──metadata                                  
      ├      ├──${schema_1}                        
      ├      ├      ├──datasource                  
      ├      ├      ├──rule                     
      ├      ├      ├──schema                      
      ├      ├──${schema_2}                        
      ├      ├      ├──datasource                  
      ├      ├      ├──rule                        
      ├      ├      ├──schema 
   ```
   
   ### How?
   #### Sub-task-1
   1 Add `GLOBAL_RULE_NODE` in `RegistryCenterNode` (Refer to `USERS_NODE`).
   2 Add and implement `GlobalRuleChangedListener` in `shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/impl` (Refer to `PropertiesChangedListener` and `RuleChangedListener`).
   3  Modify `initConfigurations(final  xx)`  of `GovernanceBootstrapInitializer` and `public void onlineInstance(xx, xx)` to pass `global authority rule` to governance to persist it into its node.
   
   #### Sub-task-2
   1 Create `RuleConfigurationsChangedEvent` in `shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/event/rule`
   2 Send this  `RuleConfigurationsChangedEvent` in `GlobalRuleChangedListener`.
   3 Subscribe and handle `RuleConfigurationsChangedEvent` in `GovernanceMetaDataContexts` (Refer to the handling of `RuleConfigurationsChangedEvent` and `PropertiesChangedEvent`).
   4 Do some tests with the zookeeper to ensure a proxy can receive the event and refresh its local metadata.
   
   #### Sub-task-3
   1 Rewrite the function of `public synchronized void renew(final CreateUserStatementEvent event)` in `RegistryCenter`.  Instead of persisting the new info into `user node`, it is expected to create new `YamlAuthorityRuleConfiguration` and put it into `rule node`.
   2 Remove everything concerning  `USERS_NODE` in`RegistryCenterNode`
   3 Remove `UserChangedListener`


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-835254774


   another question is : now `org.apache.shardingsphere.governance.core.registry.listener.event.rule.RuleConfigurationsChangedEvent` had existed and used for schema sharding rule configuration,
   
   ![image](https://user-images.githubusercontent.com/34728144/117534896-ebb94c00-b025-11eb-97f7-80bda886d400.png)
   
   so maybe we can defind `AuthorityRuleConfigurationsChangedEvent`  to save authority rule configurations.
   
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-835801069






-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 edited a comment on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
huanghao495430759 edited a comment on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-835254774


   Hi @tristaZero  now `org.apache.shardingsphere.governance.core.registry.listener.event.rule.RuleConfigurationsChangedEvent` had existed and used for schema sharding rule configuration,
   
   ![image](https://user-images.githubusercontent.com/34728144/117534896-ebb94c00-b025-11eb-97f7-80bda886d400.png)
   
   so maybe we can defind `AuthorityRuleConfigurationsChangedEvent`  to save authority rule configurations.
   
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-831764894


   @huanghao495430759 Hey, could you comment something here so that I can assign this one for you.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-831800710


   > @huanghao495430759 Hey, could you comment something here so that I can assign this one for you.
   
   OK, Let me try this issue.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 removed a comment on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
huanghao495430759 removed a comment on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-835250070


   Hi @tristaZero ,does `GLOBAL_RULE_NODE` in zk name is `rules` instead of `rule` ?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-835801466


   I just updated this issue. :)


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252#issuecomment-835250070


   Hi @tristaZero ,does `GLOBAL_RULE_NODE` in zk name is `rules` instead of `rule` ?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero closed issue #10252: [Enhancement] Support authority rule governance through different proxies

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #10252:
URL: https://github.com/apache/shardingsphere/issues/10252


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org