5.20. Repository Maintenance #
Certain tables of the repository database can overflow, for example, tables containing metrics and logs. To avoid table overflow, PPEM uses housekeeping rules. A housekeeping rule cleans the table by deleting the data stored longer than the specified amount of time. It can also be a set of one or multiple conditions containing a table field, logical operator, and value or function.
If a housekeeping rule is a set of multiple conditions, the AND logical connective is used.
For example, a housekeeping rule can delete the table data stored longer than 12 hours and include the condition containing the oid table field, the > logical operator, and the 10 value. With such a rule, the table data is deleted after 12 hours and if the value of the oid table field exceeds 10.
You can mark housekeeping rules as auto-run. In this case, they clean the table at the specified time interval.
This section explains how to manage housekeeping rules. It contains the following instructions:
Important
The housekeeping rules functionality is in the beta phase. It will be updated and expanded later.
Creating a Housekeeping Rule
In the navigation panel, go to Settings → Repository.
In the top-right corner of the page, click Create rule.
Enter parameters of the new housekeeping rule (parameters marked with an asterisk are required):
Instance: The instance where the repository database is located.
The value is entered automatically.
Name.
Schema: The schema where the table is located.
Table: The table that will be cleaned.
Timestamp column: The table column that contains the timestamp for determining the data age.
Maximum storage time: The maximum time the table data can be stored before deletion.
Specify a value in one of the following formats:
<, for example,number_of_hours>h<number_of_minutes>m24h00m<, for example,number_of_hours>h24h<, for example,number_of_minutes>m24m
Auto-run schedule: Specifies whether the housekeeping rule is auto-run or not.
If this toggle is turned on, specify the time interval for cleaning the table in one of the following ways:
In Crontab interval, enter the string in the crontab format.
Click Configure schedule, and then specify the following parameters:
Interval: The unit of measurement of the time interval.
Possible values:
Minutes
Hours
Days
Repeat every: The time interval for cleaning the table by minutes or hours.
This parameter is available only if you select Minutes or Hours from Interval.
Execution days: The days when the table will be cleaned.
Cron total line: The string in the crontab format that specifies the time interval for cleaning the table.
The value is entered automatically.
After configuring the time interval, click Save.
Description.
Additional conditions: The housekeeping rule conditions.
To add a housekeeping rule condition, click Add condition, and then specify the following parameters:
Field: The table field for the housekeeping rule condition.
Condition: The logical operator of the housekeeping rule condition.
Possible values:
=
≠
IN
NOT IN
LIKE
NOT LIKE
>
<
≥
≤
REGEXP
NOT REGEXP
Value type: The type of the value of the housekeeping rule condition.
Possible values:
Literal
Function
Currently, the only function you can use is
now. This function takes the current timestamp.
Value: The value of the housekeeping rule condition.
For example, if you select oid from Field, = from Condition, Literal from Value type, and enter
10in Value, the data is deleted if the value of theoidtable field is equal to10.After configuring the housekeeping rule condition, click Save.
You can add multiple housekeeping rule conditions by clicking Add condition. In this case, the
ANDlogical connective is used.Action after cleaning: The action that will be performed after cleaning the table.
To add an action, click Add action, and then select the action. Currently, the only supported action is table vacuuming.
You can also enable the following checkboxes:
Analyze: Update the table statistics.
Full: Run the
VACUUM FULLcommand.In this case, more data is vacuumed, but the operation takes longer to complete and locks the table.
Freeze: Perform an aggressive tuple freeze.
This is equivalent to running the
VACUUMcommand with thevacuum_freeze_min_ageparameter set to0.
After adding the action, click Save.
You can add multiple actions by clicking Add action.
Click Create.
Viewing Housekeeping Rules
In the navigation panel, go to Settings → Repository.
The table of housekeeping rules with the following columns will be displayed:
ID.
Name.
Maximum storage time: The maximum time the table data can be stored before deletion.
Auto-run: Specifies whether the housekeeping rule is auto-run or not.
Possible values:
On schedule: The housekeeping rule is auto-run.
Disabled: The housekeeping rule is not auto-run.
Schedule: The time interval in the crontab format for cleaning the table.
Status.
Possible values:
Completed: The table is cleaned successfully.
Executing: The table is being cleaned.
Error: An error occurred when cleaning the table.
Canceled: The table cleaning was canceled.
Last run: The date and time the table was last cleaned.
Schema: The schema where the table is located.
Table: The table that is being cleaned.
Deleted: The amount of deleted table data.
You can view the following table parameters by hovering over the dislayed value:
Deleted.
Current size.
Previous size.
Decrease: The table size descrease percentage.
Actions.
For more information about available actions, refer to other instructions in this section.
Viewing Detailed Housekeeping Rule Information
In the navigation panel, go to Settings → Repository.
Click
next to the housekeeping rule.
The window with detailed information about the housekeeping rule will open. On Last run, the following parameters related to the last table cleaning are displayed:
Status.
Start: The date and time the table cleaning started.
End: The date and time the table cleaning ended.
Duration: The duration of the table cleaning.
Cleaning process ID.
Table size before vacuuming.
Table size after vacuuming.
Deleted: The amount of deleted table data.
On Parameters, the following housekeeping rule parameters are displayed:
Instance: The instance where the repository database is located.
ID.
Type: Specifies whether this is the system or user housekeeping rule.
Possible values:
System
User
Schema: The schema where the table is located.
Table: The table that is being cleaned.
Timestamp column: The table column that contains the timestamp for determining the data age.
Maximum storage time: The maximum time the table data can be stored before deletion.
Auto-run: Specifies whether the housekeeping rule is auto-run or not.
Possible values:
On schedule: The housekeeping rule is auto-run.
Disabled: The housekeeping rule is not auto-run.
Schedule in the crontab format: The time interval in the crontab format for cleaning the table.
Description.
Additional conditions: The table of housekeeping rule conditions.
This table includes the following columns:
Field: The table field for the housekeeping rule condition.
Condition: The logical operator of the housekeeping rule condition.
Possible values:
=
≠
IN
NOT IN
LIKE
NOT LIKE
>
<
≥
≤
REGEXP
NOT REGEXP
Value: The value of the housekeeping rule condition.
Running a Housekeeping Rule
You can manually run a housekeeping rule to clean the table immediately if this rule is auto-run.
To run a housekeeping rule:
In the navigation panel, go to Settings → Repository.
Click
next to the housekeeping rule.
Click Run now.
Editing a Housekeeping Rule
In the navigation panel, go to Settings → Repository.
Click
→ Edit next to the housekeeping rule.
Edit housekeeping rule parameters.
Click Save.
Deleting a Housekeeping Rule
Important
System housekeeping rules cannot be deleted.
Deleted housekeeping rules cannot be restored.
In the navigation panel, go to Settings → Repository.
Click
→ Delete next to the housekeeping rule.
Click Delete.