sandynz commented on pull request #16512:
URL: https://github.com/apache/shardingsphere/pull/16512#issuecomment-1084236338


   Scaling job on auto mode passed.
   
   Scaling job on manual mode passed.
   Stop/Restore source writing test:
   ```
   mysql> select database();
   +------------+
   | DATABASE() |
   +------------+
   | test1      |
   +------------+
   1 row in set (0.00 sec)
   
   mysql> preview select count(1) from t_order;
   
+------------------+-------------------------------------------------------------------------+
   | data_source_name | actual_sql                                              
                |
   
+------------------+-------------------------------------------------------------------------+
   | ds_0             | select count(1) from t_order_0 UNION ALL select 
count(1) from t_order_2 |
   | ds_1             | select count(1) from t_order_1 UNION ALL select 
count(1) from t_order_3 |
   
+------------------+-------------------------------------------------------------------------+
   2 rows in set (0.01 sec)
   
   mysql> ALTER SHARDING TABLE RULE t_order(
       -> RESOURCES(ds_2,ds_3,ds_4),
       -> SHARDING_COLUMN=order_id,
       -> TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=6)),
       -> 
KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake,PROPERTIES("worker-id"=123)))
       -> ), t_order_item(
       -> RESOURCES(ds_2,ds_3,ds_4),
       -> SHARDING_COLUMN=order_id,
       -> TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=6)),
       -> 
KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake,PROPERTIES("worker-id"=123)))
       -> );
   Query OK, 0 rows affected (0.07 sec)
   
   mysql> show scaling list;
   
+--------------------------------------+----------------------+----------------------+--------+---------------------+-----------+
   | id                                   | tables               | 
sharding_total_count | active | create_time         | stop_time |
   
+--------------------------------------+----------------------+----------------------+--------+---------------------+-----------+
   | 0130317c30317c31305431317c7465737431 | t_order,t_order_item | 2            
        | true   | 2022-03-31 15:22:47 | NULL      |
   
+--------------------------------------+----------------------+----------------------+--------+---------------------+-----------+
   1 row in set (0.04 sec)
   
   mysql> show scaling status 0130317c30317c31305431317c7465737431;
   
+------+-------------+--------------------------+--------+-------------------------------+--------------------------+
   | item | data_source | status                   | active | 
inventory_finished_percentage | incremental_idle_seconds |
   
+------+-------------+--------------------------+--------+-------------------------------+--------------------------+
   | 0    | ds_0        | EXECUTE_INCREMENTAL_TASK | true   | 100               
            | 76                       |
   | 1    | ds_1        | EXECUTE_INCREMENTAL_TASK | true   | 100               
            | 76                       |
   
+------+-------------+--------------------------+--------+-------------------------------+--------------------------+
   2 rows in set (0.01 sec)
   
   mysql> select * from t_order limit 3;
   +----------+---------+--------+-------------+
   | order_id | user_id | status | client_type |
   +----------+---------+--------+-------------+
   |        4 |     516 | ok1    |           1 |
   |        8 |    1537 | ok1    |           1 |
   |       12 |     213 | ok1    |           1 |
   +----------+---------+--------+-------------+
   3 rows in set (0.01 sec)
   
   mysql> stop scaling source writing 0130317c30317c31305431317c7465737431;
   Query OK, 0 rows affected (0.03 sec)
   
   mysql> stop scaling source writing 0130317c30317c31305431317c7465737431;
   ERROR 1997 (C1997): Runtime exception: [Already stopped.]
   
   mysql> update t_order set status='ok0331' where order_id=4;
   ERROR 1300 (C1300): The schema test1 is read-only
   
   mysql> create index idx_order_status on t_order (status);
   ERROR 1300 (C1300): The schema test1 is read-only
   
   mysql> CREATE SHARDING BROADCAST TABLE RULES (t_broadcast_table);
   ERROR 1300 (C1300): The schema test1 is read-only
   
   mysql> CREATE SHARDING BINDING TABLE RULES (t_order,t_order_item);
   ERROR 1300 (C1300): The schema test1 is read-only
   
   mysql> select * from t_order where order_id=4;
   +----------+---------+--------+-------------+
   | order_id | user_id | status | client_type |
   +----------+---------+--------+-------------+
   |        4 |     516 | ok1    |           1 |
   +----------+---------+--------+-------------+
   1 row in set (0.02 sec)
   
   mysql> show scaling status 0130317c30317c31305431317c7465737431;
   
+------+-------------+--------------------------+--------+-------------------------------+--------------------------+
   | item | data_source | status                   | active | 
inventory_finished_percentage | incremental_idle_seconds |
   
+------+-------------+--------------------------+--------+-------------------------------+--------------------------+
   | 0    | ds_0        | EXECUTE_INCREMENTAL_TASK | true   | 100               
            | 696                      |
   | 1    | ds_1        | EXECUTE_INCREMENTAL_TASK | true   | 100               
            | 697                      |
   
+------+-------------+--------------------------+--------+-------------------------------+--------------------------+
   2 rows in set (0.24 sec)
   
   mysql> show sharding table rules t_order;
   
+--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
   | table        | actual_data_nodes | actual_data_sources | 
database_strategy_type | database_sharding_column | 
database_sharding_algorithm_type | database_sharding_algorithm_props | 
table_strategy_type | table_sharding_column | table_sharding_algorithm_type | 
table_sharding_algorithm_props | key_generate_column | key_generator_type | 
key_generator_props |
   
+--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
   | t_order      |                   | ds_0,ds_1           |                   
     |                          |                                  |            
                       | hash_mod            | order_id              | hash_mod 
                     | sharding-count=4               | order_id            | 
snowflake          | worker-id=123       |
   | t_order_item |                   | ds_0,ds_1           |                   
     |                          |                                  |            
                       | hash_mod            | order_id              | hash_mod 
                     | sharding-count=4               | order_id            | 
snowflake          | worker-id=123       |
   
+--------------+-------------------+---------------------+------------------------+--------------------------+----------------------------------+-----------------------------------+---------------------+-----------------------+-------------------------------+--------------------------------+---------------------+--------------------+---------------------+
   2 rows in set (0.02 sec)
   
   mysql> check scaling 0130317c30317c31305431317c7465737431 by type 
(name=crc32_match);
   
+--------------+----------------------+----------------------+-----------------------+-------------------------+
   | table_name   | source_records_count | target_records_count | 
records_count_matched | records_content_matched |
   
+--------------+----------------------+----------------------+-----------------------+-------------------------+
   | t_order      | 5000                 | 5000                 | true          
        | true                    |
   | t_order_item | 5000                 | 5000                 | true          
        | true                    |
   
+--------------+----------------------+----------------------+-----------------------+-------------------------+
   2 rows in set (1.14 sec)
   
   mysql> apply scaling 0130317c30317c31305431317c7465737431;
   Query OK, 0 rows affected (1.09 sec)
   
   mysql> preview select count(1) from t_order;
   
+------------------+-------------------------------------------------------------------------+
   | data_source_name | actual_sql                                              
                |
   
+------------------+-------------------------------------------------------------------------+
   | ds_2             | select count(1) from t_order_0 UNION ALL select 
count(1) from t_order_3 |
   | ds_3             | select count(1) from t_order_1 UNION ALL select 
count(1) from t_order_4 |
   | ds_4             | select count(1) from t_order_2 UNION ALL select 
count(1) from t_order_5 |
   
+------------------+-------------------------------------------------------------------------+
   3 rows in set (0.03 sec)
   
   mysql> restore scaling source writing 0130317c30317c31305431317c7465737431;
   Query OK, 0 rows affected (0.02 sec)
   
   mysql> update t_order set status='ok1' where order_id=4;
   Query OK, 1 row affected (0.02 sec)
   ```
   
   


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