The DLM feature uses two system tables: mysql.dlm_policies and mysql.dlm_progress. You can use a privileged account to view all available DLM policies and their execution records on the current cluster. The two tables are automatically created when the system starts. You do not need to manually create them.

mysql.dlm_policies table

The mysql.dlm_policies table records all available DLM policies on the current cluster.

Table format
CREATE TABLE `dlm_policies` (
  `Id` bigint(20) NOT NULL AUTO_INCREMENT,
  `Table_schema` varchar(64) NOT NULL,
  `Table_name` varchar(64) NOT NULL,
  `Policy_name` varchar(64) NOT NULL,
  `Policy_type` varchar(64) DEFAULT NULL,
  `Archive_type` varchar(20) DEFAULT NULL,
  `Storage_mode` varchar(20) DEFAULT NULL,
  `Storage_engine` varchar(64) DEFAULT NULL,
  `Storage_media` varchar(20) DEFAULT NULL,
  `Storage_schema_name` varchar(64) DEFAULT NULL,
  `Storage_table_name` varchar(64) DEFAULT NULL,
  `Data_compressed` varchar(10) DEFAULT 'OFF',
  `Compressed_algorithm` varchar(64) DEFAULT NULL,
  `Enabled` varchar(10) DEFAULT 'ON',
  `Priority_number` int(11) NOT NULL,
  `Tier_partition_number` int(11) DEFAULT '0',
  `Tier_condition` varchar(512) DEFAULT NULL,
  `Extra_info` json NOT NULL,
  `Comment` varchar(2048) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `unique_policy` (`Table_schema`,`Table_name`,`Policy_name`)
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='PolarDB DLM policies table'
1 row in set (0.00 sec)
Parameters
ParameterDescription
IdThe auto-increment primary key.
Table_schemaThe database that contains the table.
Table_nameThe name of the table.
Policy_nameThe name of the DLM policy.
Policy_typeThe type of the DLM policy. Default value: TABLE. Valid values:
  • TABLE: Data is archived as a table.
  • PARTITION: Data is archived as a partition. This value will be supported soon.
  • NONE: Data is deleted directly.
Archive_typeThe execution mode of the DLM policy. Default value: PARTITION COUNT. Valid values:
  • PARTITION COUNT: archives data that meets the number of partitions.
  • CONDITION: archives data that meets the conditions. This value will be supported soon.
Storage_modeThe storage mode. Default value: READ ONLY. Valid values:
  • READ ONLY.
  • READ WRITE. This value will be supported soon.
Storage_engineThe storage engine of the DLM table. Currently, data can be archived only in the CSV format.
Storage_mediaThe storage medium of the DLM table. Currently, data can be archived only on OSS.
Storage_schema_nameThe database that contains the table when DLM data is archive is a table.
Storage_table_nameThe name of the table when DLM data is archived as a table.
Data_compressedSpecifies whether the archived data is compressed. This value will be supported soon.
Compressed_algorithmThe data compression algorithm. This value will be supported soon.
EnabledSpecifies whether the DLM policy is enabled. Default value: ENABLED. Valid values:
  • ENABLED
  • DISABLED
Priority_numberThe execution priority of the DLM policy. This value will be supported soon.
Tier_partition_numberThe number of partitions for data archiving when Archive_type is set to PARTITION COUNT.
Tier_conditionThe execution condition for data archiving when Archive_type is set to CONDITION. This value will be supported soon.
Extra_infoThe additional information.
CommentThe comment of the DLM policy.

mysql.dlm_progress table

The mysql.dlm_progress table stores the execution records of DLM policies on the current cluster.

Table format
CREATE TABLE `dlm_progress` (
  `Id` bigint(20) NOT NULL AUTO_INCREMENT,
  `Table_schema` varchar(64) NOT NULL,
  `Table_name` varchar(64) NOT NULL,
  `Policy_name` varchar(64) NOT NULL,
  `Policy_type` varchar(64) DEFAULT NULL,
  `Archive_option` varchar(64) DEFAULT NULL,
  `Storage_engine` varchar(64) DEFAULT NULL,
  `Storage_media` varchar(20) DEFAULT NULL,
  `Data_compressed` varchar(10) DEFAULT 'OFF',
  `Compressed_algorithm` varchar(64) DEFAULT NULL,
  `Archive_partitions` varchar(2048) DEFAULT NULL,
  `Archive_stage` varchar(64) DEFAULT NULL,
  `Archive_percentage` int(11) DEFAULT NULL,
  `Archived_file_info` json NOT NULL,
  `Start_time` datetime NOT NULL,
  `End_time` datetime DEFAULT NULL,
  `Extra_info` json NOT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `unique_progress` (`Table_schema`,`Table_name`,`Policy_name`,`Start_time`)
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='PolarDB DLM progress table'
1 row in set (0.00 sec)
Parameters
ParameterDescription
IdThe auto-increment primary key.
Table_schemaThe database that contains the table.
Table_nameThe name of the table.
Policy_nameThe name of the DLM policy.
Policy_typeThe type of the DLM policy. Default value: TABLE. Valid values:
  • TABLE: Data is archived as a table.
  • PARTITION: Data is archived as a partition. This value will be supported soon.
  • NONE: Data is deleted directly.
Archive_optionThe execution condition of the DLM policy.
Storage_engineThe storage engine of the DLM policy. Currently, data can be archived only in the CSV format.
Storage_mediaThe storage medium of the DLM policy. Default value: OSS. Valid values:
  • OSS.
  • DISK. This value will be supported soon.
Data_compressedSpecifies whether the archived data is compressed. This value will be supported soon.
Compressed_algorithmThe data compression algorithm. This value will be supported soon.
Archive_partitionsName of the partition for data archiving.
Archive_stageThe execution phase of the DLM policy. Valid values:
  • INITIALIZE: The task is being initialized.
  • WAITING: The task is waiting to be executed.
  • DATA_COPYING: The required data is being copied to the new storage medium.
  • STORAGE_MOVING: The system is modifying the engine for data archiving.
  • DATA_VERIFYING: The system is checking whether the archived data is consistent with the original data.
  • DATA_DELETING: The system is deleting the original data to release storage space.
  • ARCHIVE_COMPLETE: The DLM policy execution is complete.
  • ARCHIVE_ERROR: An error occurs during the DLM policy execution.
Note
  • If a DLM policy is in a phase other than ARCHIVE_COMPLETE, a duplicate execution of the current DLM policy is automatically skipped.
  • If the DLM policy is in the ARCHIVE_ERROR phase, an error occurs during the DLM policy execution. The error message is stored in the Extra_info field in the mysql.dlm_progress table. After you discover the cause for the failed execution of the DLM policy, you must manually delete the execution record of the current DLM policy, or execute the UPDATE mysql.dlm_progress SET Archive_stage = "ARCHIVE_COMPLETE" where Id = current_progress_id; statement to change the status of the current policy to ARCHIVE_COMPLETE. Execute the DLM policy again.
Archive_percentageThe execution progress in percentage of the current DLM policy.
Archived_file_infoThe file information after the DLM policy is archived.
Start_timeThe execution start time of the DLM policy.
End_timeThe execution end time of the DLM policy.
Extra_infoThe additional information.