setRetentionPolicy#
- swordfish.function.setRetentionPolicy()#
Set the policy of data retention and tiered storage. The parameter retentionHours should be specified as large as possible for tiered storage to avoid deleting any data.
Both data retention and tiered storage are partition-based. Therefore, the interval configured by retentionHours and hoursToColdVolume must be divisible by the granularity of the partition.
The system will keep the data with the timestamp of the last retentionHours based on the system time: Data of the last hoursToColdVolume are stored in volumes; Data in [current time - hoursToColdVolumes - 10 days, current time - hoursToColdVolumes) are migrated to coldVolumes. If multiple paths are specified for coldVolumes, the data will be transferred randomly to one of the specified directories.
For other data, only data in the range of [current time - retentionHours - 10 days, current time - retentionHours) are deleted. To delete the data outside the range, you can call function dropPartition.
Note
The function is only applied to a DFS database.
- Parameters:
dbHandle (Constant) – A database handle. The data type of at least one of the partitioning columns of the database must be DATE or DATEHOUR.
retentionHours (Constant) – A positive integer indicating the number of hours that data are kept.
retentionDimension (Constant, optional) – An integer indicating the layer of the temporal partition, by default DFLT.
hoursToColdVolume (Constant, optional) – positive integer indicating the number of hours that data are kept in volumes. Data stored in volumes will be migrated to the specified coldVolumes (configuration parameter) after hoursToColdVolume, by default DFLT.