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 2020/05/19 12:35:43 UTC

[GitHub] [shardingsphere] menghaoranss opened a new pull request #5691: Initialize cluster state module

menghaoranss opened a new pull request #5691:
URL: https://github.com/apache/shardingsphere/pull/5691


   For #5666 
   
   Changes proposed in this pull request:
   - Write/read instance state to/from registry center
   - Initialize cluster state module, define the state api
   


----------------------------------------------------------------
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] codecov-commenter commented on pull request #5691: Initialize cluster state module

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #5691:
URL: https://github.com/apache/shardingsphere/pull/5691#issuecomment-631175202


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=h1) Report
   > Merging [#5691](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/e0c3345461690b8c4f46b8148765f5c831cc3652&el=desc) will **decrease** coverage by `1.90%`.
   > The diff coverage is `47.05%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/5691/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5691      +/-   ##
   ============================================
   - Coverage     55.66%   53.76%   -1.91%     
   + Complexity      430      428       -2     
   ============================================
     Files          1137     1152      +15     
     Lines         20207    20279      +72     
     Branches       3665     3660       -5     
   ============================================
   - Hits          11249    10903     -346     
   - Misses         8286     8713     +427     
   + Partials        672      663       -9     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...dingsphere/cluster/state/ClusterStateInstance.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItc3RhdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2NsdXN0ZXIvc3RhdGUvQ2x1c3RlclN0YXRlSW5zdGFuY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [.../shardingsphere/cluster/state/enums/NodeState.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItc3RhdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2NsdXN0ZXIvc3RhdGUvZW51bXMvTm9kZVN0YXRlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...ation/core/facade/ShardingOrchestrationFacade.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uL3NoYXJkaW5nc3BoZXJlLW9yY2hlc3RyYXRpb24tY29yZS9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uLWNvcmUtZmFjYWRlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9vcmNoZXN0cmF0aW9uL2NvcmUvZmFjYWRlL1NoYXJkaW5nT3JjaGVzdHJhdGlvbkZhY2FkZS5qYXZh) | `94.44% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ter/configuration/config/ClusterConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL2NvbmZpZy9DbHVzdGVyQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...r/configuration/config/HeartBeatConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL2NvbmZpZy9IZWFydEJlYXRDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...ation/swapper/ClusterConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3N3YXBwZXIvQ2x1c3RlckNvbmZpZ3VyYXRpb25ZYW1sU3dhcHBlci5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...r/configuration/yaml/YamlClusterConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3lhbWwvWWFtbENsdXN0ZXJDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...configuration/yaml/YamlHeartBeatConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3lhbWwvWWFtbEhlYXJ0QmVhdENvbmZpZ3VyYXRpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...hestration/core/registrycenter/RegistryCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uL3NoYXJkaW5nc3BoZXJlLW9yY2hlc3RyYXRpb24tY29yZS9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uLWNvcmUtcmVnaXN0cnljZW50ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL29yY2hlc3RyYXRpb24vY29yZS9yZWdpc3RyeWNlbnRlci9SZWdpc3RyeUNlbnRlci5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...re/datasource/metadata/CachedDatabaseMetaData.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9qZGJjL2NvcmUvZGF0YXNvdXJjZS9tZXRhZGF0YS9DYWNoZWREYXRhYmFzZU1ldGFEYXRhLmphdmE=) | `0.00% <0.00%> (-97.17%)` | `0.00% <0.00%> (ø%)` | |
   | ... and [67 more](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=footer). Last update [c13507e...2f84d40](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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] codecov-commenter edited a comment on pull request #5691: Initialize cluster state module

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #5691:
URL: https://github.com/apache/shardingsphere/pull/5691#issuecomment-631175202


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=h1) Report
   > Merging [#5691](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/e0c3345461690b8c4f46b8148765f5c831cc3652&el=desc) will **decrease** coverage by `1.98%`.
   > The diff coverage is `47.05%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/5691/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5691      +/-   ##
   ============================================
   - Coverage     55.66%   53.68%   -1.99%     
   + Complexity      430      428       -2     
   ============================================
     Files          1137     1154      +17     
     Lines         20207    20309     +102     
     Branches       3665     3663       -2     
   ============================================
   - Hits          11249    10903     -346     
   - Misses         8286     8743     +457     
   + Partials        672      663       -9     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...dingsphere/cluster/state/ClusterStateInstance.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItc3RhdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2NsdXN0ZXIvc3RhdGUvQ2x1c3RlclN0YXRlSW5zdGFuY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [.../shardingsphere/cluster/state/enums/NodeState.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItc3RhdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2NsdXN0ZXIvc3RhdGUvZW51bXMvTm9kZVN0YXRlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...ation/core/facade/ShardingOrchestrationFacade.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uL3NoYXJkaW5nc3BoZXJlLW9yY2hlc3RyYXRpb24tY29yZS9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uLWNvcmUtZmFjYWRlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9vcmNoZXN0cmF0aW9uL2NvcmUvZmFjYWRlL1NoYXJkaW5nT3JjaGVzdHJhdGlvbkZhY2FkZS5qYXZh) | `94.44% <ø> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ter/configuration/config/ClusterConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL2NvbmZpZy9DbHVzdGVyQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...r/configuration/config/HeartBeatConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL2NvbmZpZy9IZWFydEJlYXRDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...ation/swapper/ClusterConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3N3YXBwZXIvQ2x1c3RlckNvbmZpZ3VyYXRpb25ZYW1sU3dhcHBlci5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...r/configuration/yaml/YamlClusterConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3lhbWwvWWFtbENsdXN0ZXJDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...configuration/yaml/YamlHeartBeatConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3lhbWwvWWFtbEhlYXJ0QmVhdENvbmZpZ3VyYXRpb24uamF2YQ==) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
   | [...hestration/core/registrycenter/RegistryCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uL3NoYXJkaW5nc3BoZXJlLW9yY2hlc3RyYXRpb24tY29yZS9zaGFyZGluZ3NwaGVyZS1vcmNoZXN0cmF0aW9uLWNvcmUtcmVnaXN0cnljZW50ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL29yY2hlc3RyYXRpb24vY29yZS9yZWdpc3RyeWNlbnRlci9SZWdpc3RyeUNlbnRlci5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...re/datasource/metadata/CachedDatabaseMetaData.java](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9qZGJjL2NvcmUvZGF0YXNvdXJjZS9tZXRhZGF0YS9DYWNoZWREYXRhYmFzZU1ldGFEYXRhLmphdmE=) | `0.00% <0.00%> (-97.17%)` | `0.00% <0.00%> (ø%)` | |
   | ... and [113 more](https://codecov.io/gh/apache/shardingsphere/pull/5691/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=footer). Last update [c13507e...c3dd503](https://codecov.io/gh/apache/shardingsphere/pull/5691?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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] menghaoranss closed pull request #5691: Initialize cluster state module

Posted by GitBox <gi...@apache.org>.
menghaoranss closed pull request #5691:
URL: https://github.com/apache/shardingsphere/pull/5691


   


----------------------------------------------------------------
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] kimmking merged pull request #5691: Initialize cluster state module

Posted by GitBox <gi...@apache.org>.
kimmking merged pull request #5691:
URL: https://github.com/apache/shardingsphere/pull/5691


   


----------------------------------------------------------------
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] kimmking commented on a change in pull request #5691: Initialize cluster state module

Posted by GitBox <gi...@apache.org>.
kimmking commented on a change in pull request #5691:
URL: https://github.com/apache/shardingsphere/pull/5691#discussion_r427752090



##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-state/src/main/java/org/apache/shardingsphere/cluster/state/ClusterStateInstance.java
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.cluster.state;
+
+import com.google.common.base.Preconditions;
+import org.apache.shardingsphere.cluster.state.enums.NodeState;
+import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import org.apache.shardingsphere.orchestration.core.facade.ShardingOrchestrationFacade;
+
+import java.util.HashMap;
+import java.util.Optional;
+
+/**
+ * Cluster state instance.
+ */
+public final class ClusterStateInstance {
+    
+    private ClusterStateInstance() {
+    }
+    
+    /**
+     * Get cluster state instance.
+     * @return cluster state instance
+     */
+    public static ClusterStateInstance getInstance() {
+        return ClusterStateInstanceHolder.INSTANCE;
+    }
+    
+    /**
+     * Persist data source state.
+     * @param dataSourceName data source name

Review comment:
       keep a blank line after line 45

##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-state/src/main/java/org/apache/shardingsphere/cluster/state/ClusterStateInstance.java
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.cluster.state;
+
+import com.google.common.base.Preconditions;
+import org.apache.shardingsphere.cluster.state.enums.NodeState;
+import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import org.apache.shardingsphere.orchestration.core.facade.ShardingOrchestrationFacade;
+
+import java.util.HashMap;
+import java.util.Optional;
+
+/**
+ * Cluster state instance.
+ */
+public final class ClusterStateInstance {
+    
+    private ClusterStateInstance() {
+    }
+    
+    /**
+     * Get cluster state instance.
+     * @return cluster state instance
+     */
+    public static ClusterStateInstance getInstance() {
+        return ClusterStateInstanceHolder.INSTANCE;
+    }
+    
+    /**
+     * Persist data source state.
+     * @param dataSourceName data source name
+     * @param dataSourceState data source state
+     */
+    public void persistDataSourceState(final String dataSourceName, final DataSourceState dataSourceState) {
+        String instanceData = ShardingOrchestrationFacade.getInstance().getRegistryCenter().loadInstanceData();
+        InstanceState instanceState = Optional.ofNullable(YamlEngine.unmarshal(instanceData, InstanceState.class)).orElse(new InstanceState(new HashMap<>()));
+        instanceState.getDataSources().put(dataSourceName, dataSourceState);
+        ShardingOrchestrationFacade.getInstance().getRegistryCenter().persistInstanceData(YamlEngine.marshal(instanceState));
+    }
+    
+    /**
+     * Load instance state.
+     * @return instance state
+     */
+    public InstanceState loadInstanceState() {
+        String instanceData = ShardingOrchestrationFacade.getInstance().getRegistryCenter().loadInstanceData();

Review comment:
       check null.




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