soulasuna opened a new issue #11661:
URL: https://github.com/apache/shardingsphere/issues/11661


   Hi,community:
   
   I am very happy to bring you the refactoring plan of 
theshardingsphere-shadow  project. @terrymanu @tristaZero @wu-sheng
   
   Combining the characteristics of the shardingsphere-shadow project's own 
functions and the configuration style of other functions of the 
shardingsphere.Make changes to the user API configuration.
   
   In the future, shardingsphere-shadow will become an important part of data 
routing in full-link stress test scenarios.
   
   The process of project reconstruction will not have any impact on the 
original functions.
   
   #### After the refactoring is completed, the user API configuration changes 
are as follows:
   - Spring-namespace xml file configuration
   
   ```xml
   <beans xmlns="http://www.springframework.org/schema/beans";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          
xmlns:shadow="http://shardingsphere.apache.org/schema/shardingsphere/shadow";
          xsi:schemaLocation="http://www.springframework.org/schema/beans 
                              
http://www.springframework.org/schema/beans/spring-beans.xsd
                              
http://shardingsphere.apache.org/schema/shardingsphere/shadow
                              
http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow.xsd
                              ">
                              
       <shadow:shadow-algorithm id="user-id-match-algorithm" 
type="COLUMN-REGULAR-MATCH">
           <props>
               <prop key="operation">UPDATE</prop>
               <prop key="column">user_id</prop>
               <prop key="regex">[a]</prop>
           </props>
       </shadow:shadow-algorithm>
       <shadow:shadow-algorithm id="note-algorithm" type="SIMPLE-NOTE">
           <props>
               <prop key="shadow">true</prop>
           </props>
       </shadow:shadow-algorithm>
       
       <shadow:rule id="shadowRule">
           <shadow:data-source id="shadow-data-source" 
source-data-source-name="ds" shadow-data-source-name="ds-shadow"/>
   
           <shadow:shadow-table name="t_order">
               <shadow:shadow-algorithm ref= "user-id-match-algorithm" />
               <shadow:shadow-algorithm ref= "note-algorithm" />
           </shadow:shadow-table>
           <shadow:shadow-table name="t_user">
               <shadow:shadow-algorithm ref= "user-id-match-algorithm" />
           </shadow:shadow-table>
       </shadow:rule>
   </beans>
   ```
   
   - Spring-boot properties file configuration
   
   ```properties
   
spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.source-data-source-name=ds
   
spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.shadow-data-source-name=ds-shadow
   
   
spring.shardingsphere.rules.shadow.shadow-tables.t_order.shadow-algorithm-names[0]=user-id-match-algorithm
   
spring.shardingsphere.rules.shadow.shadow-tables.t_order.shadow-algorithm-names[1]=note-algorithm
   
   
spring.shardingsphere.rules.shadow.shadow-tables.t_user.shadow-algorithm-names[0]=note-algorithm
   
   
spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-match-algorithm.type=COLUMN-REGULAR-MATCH
   
spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-match-algorithm.props.operation=UPDATE
   
spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-match-algorithm.props.column=user_id
   
spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-match-algorithm.props.regex=[a]
   
   
spring.shardingsphere.rules.shadow.shadow-algorithms.note-algorithm.type=SIMPLE-NOTE
   
spring.shardingsphere.rules.shadow.shadow-algorithms.note-algorithm.props.shadow=true
   ```
   
   - Spring-boot yml file configuration
   
   ```yml
   rules:
     shadow:
       data-sources:
         shadow-data-source:
           source-data-source-name: ds
           shadow-data-source-name: ds-shadow
           
       shadow-tables:
         t_order:
           shadow-algorithm-names: 
             - user-id-match-algorithm
             - note-algorithm
         t_user:
           shadow-algorithm-names:
             - note-algorithm
             
       shadow-algorithms:
         user-id-match-algorithm:
           type: COLUMN-REGULAR-MATCH
           props:
             operation: UPDATE
             column: user_id
             regex: [a]
         note-algorithm:
           type: SIMPLE-NOTE
           props:
             shadow: true
   ```
   


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


Reply via email to