Help Center/
GaussDB/
Feature Guide(Distributed_V2.0-8.x)/
Logical Replication/
Logical Decoding/
Data Restoration by Logical Decoding
Updated on 2025-05-29 GMT+08:00
Data Restoration by Logical Decoding
Logical decoding can restore DML data on a single node. Specifically, it restores online or archived WALs.
- Online data: To restore online DML data, you can use the pg_logical_get_area_changes function. For details, see the usage of the pg_logical_get_area_changes function.
- Archived data: OM_Agent uses the pg_logical_get_area_changes function to restore archived logs on OBS. OM_Agent downloads archived logs from OBS to the corresponding node and creates a folder named with the first eight digits of the WAL file name. After the decoding is complete, the restored data is stored in a file and the file path is returned.
Restrictions
- The log level of parsed WALs is logical.
- The replication identity FULL must be specified for copying a data table; otherwise, the copied rows on which UPDATE or DELETE is performed are not complete.
- After the decoding starts, do not perform the VACUUM FULL operation on the service table for which data modifications are recorded using WALs; otherwise, DML operations before the VACUUM FULL operation cannot be restored.
- The size of each WAL file cannot exceed 500 MB.
- Xlogs generated before scale-out cannot be restored.
- A result file is generated for each shard in the cluster. Files are not merged.
- Only archived data can be restored. To restore the data, ensure that the archive function is enabled. If data has not been archived, it cannot be restored using this API.
- Before downloading files, the OM Agent checks whether the used local space is greater than 80% of the total space. If the used space exceeds 80% of the total space, the following error is reported, indicating that extra space is required for storing decoded files: "no enough space left on device, available space must be greater than 20%."
- If the download or decoding fails, the downloaded WAL files are cleared. If the clearing fails, the program is not forcibly ended and only the error information is recorded in DN logs.
- The start time cannot exceed the maximum time in the gs_txn_lsn_time system catalog, and the end time cannot exceed the minimum time in the gs_txn_lsn_time system catalog. Otherwise, an error is reported.
- The data retrieval API cannot be concurrently called on the same node.
- If a node is replaced, the data of the node before the replacement cannot be restored.
- Only data restoration through direct connection to DNs is supported.
- After upgrade, restoration can be performed only after a baseline is established. In addition, only the Xlogs generated after the baseline can be restored. The Xlogs generated before the upgrade cannot be parsed.
- By default, data generated within one year can be restored and those generated earlier will be automatically deleted. To restore data generated more than one year ago, change the value of the GUC parameter logical_replication_dictionary_retention_time before data is cleared.
Parent topic: Logical Decoding
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot