Data Lake Formation (DLF) provides a recycle bin to reduce the risk of accidentally deleting databases, tables, and files. When you delete a database or table, the associated data and metadata are retained in the recycle bin for a configurable retention period, during which they can be queried and restored. For Paimon catalogs, the recycle bin also lets you view orphan files removed by table optimization cleanup.
Scenarios
-
Restore a database or table that was accidentally deleted, as long as it is still within the metadata retention period.
-
Unreferenced files removed by orphan file cleanup during table optimization are moved to the file recycle bin, where they can be inspected for troubleshooting. For more information, see Orphan file cleanup.
Prerequisites
-
Permission: The RAM user must have the required DLF API and data permissions. For more information, see Configure permissions.
-
Catalog status: The catalog must be accessible. If the catalog does not exist, has been deleted, is inaccessible due to insufficient permissions, or is in an unavailable state, the restore operation will fail. The data and metadata in the recycle bin will remain unchanged.
-
Console access: Your account must have permissions to access the Data Lake Formation console, view the recycle bin, and restore resources.
Limitations
-
File recycling scope: File recycling is only supported for catalogs of the Paimon type, and the catalog must have completed system initialization. Other catalog types do not support file recycling.
-
Retention period: After the metadata retention period expires, the data and metadata cannot be recovered. Even if the page still briefly shows Cleaning, you cannot perform a restore operation.
-
Name conflicts: When restoring a database or table, the restore will fail if a database or table with the same name already exists in the target location and is in a normal state. Resolve the naming conflict before retrying the restore.
-
Parent database: Restoring a table requires its parent database to be in a normal state. If the parent database is in the recycle bin, restore the parent database first.
-
Cleaning status: You cannot perform restore operations when the status is Cleaning. Wait for the background cleanup to complete before retrying (typically about 30 minutes).
Procedure
Step 1: Configure the recycle bin retention period
-
Log on to the DLF console
-
In the left-side navigation pane, choose Catalogs.
-
In the catalog list, click the target catalog.
-
On the catalog details page, click Catalog Configuration.
-
In the Advanced Settings section, click Modify.
-
In the Catalog Properties section, add or modify the recycle bin configuration items.
-
Click OK.
The following table describes the recycle bin configuration items.
|
Configuration item |
Type |
Default |
Description |
|
|
Integer |
|
The number of days that the metadata of databases and tables is retained in the recycle bin. Must be an integer greater than or equal to |
|
|
Integer |
|
The number of days that orphan files are retained in the system recycle bin ( |
Step 2: Access the recycle bin page
-
Log on to the DLF console
-
In the left-side navigation pane, choose System & Security.
-
On the System & Security page, click Recycle Bin.
-
Select the Databases, Tables, or Recycle Bin Files tab as needed.
Step 3: Restore a database or table
-
On the Recycle Bin page, click the Databases or Tables tab.
-
Select the target catalog, and enter the database or table name to filter results if needed.
-
Locate the database or table you want to restore.
-
Verify that the status is Under Delete Protection.
-
In the Actions column, click Restore.
Step 4: View recycled files
-
On the Recycle Bin page, click the Recycle Bin Files tab.
-
Select the target catalog, and enter the file name or path keyword to filter results if needed.
-
View information about deleted files.
The Recycle Bin Files tab displays orphan files in the system recycle bin (system.trash). These files can only be viewed; restoration is not supported.
Notes
-
Retention periods: The metadata retention period (
dlf.trashed-meta-retained-days) and the file retention period (dlf.trashed-file-retained-days) are independent configuration items. The former controls how long the metadata and data of databases and tables can be restored. The latter controls how long orphan files are retained in the system recycle bin. -
Restore behavior: When you restore a database, all tables that were deleted together with the database are restored as well. Tables that were deleted separately must be restored individually from the Tables tab.
-
Background cleanup: After you delete a database or table, the associated data and metadata are first moved to the recycle bin. Permanent deletion is performed by a background cleanup task. The exact completion time depends on the configured retention period and the background cleanup schedule.