Cluster Redistribution
Function
Cluster redistribution is an important and time-consuming data migration task after a cluster scale-out. Before the scale-out, service data is stored on original nodes based on the original distribution policy. After the scale-out, there is no data on the new empty nodes. The system evenly redistributes data on the original nodes among all nodes (including the new nodes) based on the new distribution policy. This ensures even data distribution and optimal query performance. After the redistribution is complete, the performance and system load balancing capability are significantly improved.
By default, redistribution is automatically started after a cluster scale-out. For enhanced reliability, disable automatic redistribution and manually perform a redistribution task after the scale-out is successful. In this way, both scale-out and redistribution can be retried upon failures. The redistribution mode is the same as the scale-out mode. If online scale-out is used, online redistribution is also used by default. Before redistribution starts or when redistribution is paused, you can set redistribution priorities for the tables that have not been redistributed by schema or table.
Redistribution Modes
DWS supports offline redistribution and online redistribution. For details, see Table 1.
| Redistribution Mode | Description | Use Case |
|---|---|---|
| Online redistribution | During redistribution, some read, write, and DDL operations are supported, and services are slightly affected. | Use this mode if service continuity is required. |
| Offline redistribution | A shared lock is added to the table being redistributed. Only query operations are supported. DDL and DML write operations are not supported. | Use this mode if short service interruptions are acceptable. |
Notes and Constraints
- The cluster redistribution function is supported in 8.1.1.200 or later cluster versions.
- Redistribution details can be viewed only in clusters running version 8.1.1.200 or later. Table redistribution progress can be viewed only in clusters running version 8.2.1 or later.
- This function can be manually enabled only when the cluster task information displays To be redistributed after scale-out.
- You can also select the redistribution mode when you configure cluster scale-out (see Scaling Out a Cluster for details).
- Redistribution queues are sorted based on the relpage (number of disk pages) size of a table. To ensure that the relpage statistics are correct, you are advised to perform the ANALYZE operation on the table to be redistributed to update table statistics.
- Constraints on offline redistribution are as follows:
- In offline redistribution mode, the database does not support DDL and DCL operations. Tables that are being redistributed support only simple DQL operations (read-only queries).
- During table redistribution, a shared lock is added to tables. All INSERT, UPDATE, and DELETE operations as well as DDL operations on the tables are blocked for a long time, which may cause a lock wait timeout. Do not perform queries that take longer than 20 minutes during the redistribution (the default time for applying for the write lock during redistribution is 20 minutes). Otherwise, data redistribution may fail due to lock wait timeout.
- Constraints on online redistribution are as follows:
- In online redistribution mode, the database supports partial DDL and DCL operations.
- Tables that are being redistributed support INSERT, DELETE, UPDATE, and some DDL operations, including:
- INSERT, DELETE, UPDATE, MERGE INTO, OVERWRITE, and UPSERT operations on local tables that are being redistributed
- Join queries on local tables that are being redistributed across node groups
- Local table renaming, schema modification, DROP, TRUNCATE, TRUNCATE-PARTITION
- The following operations cannot be performed on tables that are being redistributed:
- Execution of ALTER TABLE statements (except for TRUNCATE PARTITION), including adding or deleting columns or partitions
- Creation, modification, and deletion of indexes
- Perform VACUUM FULL and CLUSTER operations on tables.
- Modify the sequence objects on which a column depends, including creating and modifying them. Typical statements are CREATE and ALTER SEQUENCE ... OWNED BY.
- Execution of UPDATE and DELETE statements on tables with more than 996 columns (SELECT and INSERT statements can be executed.)
- Database and tablespace objects cannot be created, deleted, or modified during redistribution.
- Redistribution is performed on a table basis. If you want to exchange partitions between a partitioned table and a non-partitioned table, and one of them has been redistributed while the other has not, the exchange operation is not supported because the two tables belong to different node groups. You can exchange partitions only when both tables have been redistributed.
- You can check redistribution details only if the cluster is being redistributed, failed to be redistributed, or is suspended. There may be a delay in the statistics update.
Offline Redistribution
- Log in to the DWS console.
- In the navigation pane on the left, choose Cluster > Cluster List. All clusters are displayed by default.
- Locate a cluster, click More in the Operation column, and select Scale Node and then Redistribute. In the slide-out panel on the right, Current Resource Details and Redistribution Configuration are displayed.
- You can configure redistribution information in the Redistribution Configuration area by referring to the information in the Current Resource Details area. You can view the redistribution progress in the Progress Details area.
Table 2 Redistribution parameters Parameter
Description
Redistribution Concurrency
Number of tables that can be redistributed concurrently. The value ranges from 1 to 200. The default value is 4. A larger number of concurrent tasks indicates a faster redistribution but also more resource consumption. Set this parameter based on the cluster load.
Redistribution Mode
Retain the default value Offline.
Priority
You can click Adjust Priority to adjust the redistribution priority (schema or table dimension). Then redistribution is performed based on the configured sequence.
- Confirm the information and click Submit to start the redistribution task.
Online Redistribution
- Log in to the DWS console.
- In the navigation pane on the left, choose Cluster > Cluster List. All clusters are displayed by default.
- Locate a cluster, click More in the Operation column, and select Scale Node and then Redistribute. In the slide-out panel on the right, Current Resource Details and Redistribution Configuration are displayed.
- You can configure redistribution information in the Redistribution Configuration area by referring to the information in the Current Resource Details area. You can view the redistribution progress in the Progress Details area.
Table 3 Redistribution parameters Parameter
Description
Redistribution Concurrency
Number of tables that can be redistributed concurrently. The value ranges from 1 to 200. The default value is 4. A larger number of concurrent tasks indicates a faster redistribution but also more resource consumption. Set this parameter based on the cluster load.
Redistribution Mode
Select Online.
Priority
You can click Adjust Priority to adjust the redistribution priority (schema or table dimension). Then redistribution is performed based on the configured sequence.
- Confirm the information and click Submit to start the redistribution task.
Viewing Redistribution Details
- Log in to the DWS console.
- In the navigation pane on the left, choose Cluster > Cluster List. All clusters are displayed by default.
- In the Task Information column of a cluster, click View Details.
- On the View Redistribution Details page, you can view monitoring information, such as the redistribution mode, redistribution progress, and data table redistribution details of the current cluster. You can also pause and resume redistribution. When redistribution is paused, you can set the redistribution priority and change the number of concurrent redistribution tasks.
- Check the redistribution status, configuration, progress, and redistribution details of all the tables in a specified database. To view the redistribution details of a data table, you must specify a database first. You can filter tables by redistribution status or table name. If all tables in a database have been redistributed, the details of the database will not be displayed on the page.
- If the redistribution is triggered when nodes are added to an existing logical cluster, the bucket splitting information after the scale-out is also displayed. Buckets are split so that data can be evenly distributed on all nodes after the redistribution.
- When redistribution is paused, you can set the redistribution priority (in schema or table dimension), and redistribution will be performed based on the configured redistribution sequence. You can also set the redistribution priority before the redistribution starts. Figure 1 Redistribution priority
- During redistribution, you can click Modify to adjust the redistribution concurrency. Clusters running version 8.1.0 or earlier do not support dynamic adjustment. To change the redistribution concurrency, pause the redistribution first.
- After the redistribution is complete, check the redistribution progress statistics, including the amount of completed data, amount of remaining data, number of completed tables, number of remaining tables, and redistribution rate.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot