Browse Source

Add db purge support

Add db purge support to masakari-manage command which will purge
the deleted/unused records from the database.

Implements: blueprint db-purge-support
Change-Id: Ie2df29bf459dcfab98dfbbf979d4334b35ec4275
Abhishek Kekane 1 year ago
parent
commit
e80b1a13d2
1 changed files with 118 additions and 0 deletions
  1. 118
    0
      specs/pike/approved/lite-specs.rst

+ 118
- 0
specs/pike/approved/lite-specs.rst View File

@@ -0,0 +1,118 @@
1
+==================
2
+Masakari Spec Lite
3
+==================
4
+
5
+Please keep this template section in place and add your own copy of it between
6
+the markers. Please fill only one Spec Lite per commit.
7
+
8
+<Title of your Spec Lite>
9
+-------------------------
10
+
11
+:link: <Link to the blueprint.>
12
+
13
+:problem: <What is the driver to make the change.>
14
+
15
+:solution: <High level description what needs to get done. For example:
16
+            "We need to add client function X.Y.Z to interact with new server
17
+            functionality Z".>
18
+
19
+:impacts: <All possible \*Impact flags (same as in commit messages) or 'None'.>
20
+
21
+Optionals (please remove this line and fill or remove the rest until End):
22
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23
+
24
+:how: <More technical details than the high level overview of `solution`
25
+       if needed.>
26
+
27
+:alternatives: <Any alternative approaches that might be worth of bringing
28
+                to discussion.>
29
+
30
+:timeline: <Estimation of the time needed to complete the work.>
31
+
32
+:reviewers: <If reviewers has been agreed for the functionality, list them
33
+             here.>
34
+
35
+:assignee: <If known, list who is going to work on the feature implementation
36
+            here>
37
+
38
+End of Template
39
++++++++++++++++
40
+
41
+Add db purge support
42
+--------------------
43
+
44
+:link: https://blueprints.launchpad.net/masakari/+spec/db-purge-support
45
+
46
+:problem: Masakari do not have any way to delete notification records from
47
+          notification database table. If there are large number of
48
+          notifications in the db, it's going to slow down db search.
49
+          Similarly we can purge records from other database tables.
50
+
51
+:solution: Add db purge support to masakari-manage command which will purge
52
+           the deleted/unused records from the database. As masakari do not
53
+           have delete notification api, notification records will be purged
54
+           on the basis of status and updated_at column. Notifications which
55
+           are in finished, ignored and failed status will be purged from the
56
+           notification table. For other tables records which are marked as
57
+           deleted will be purged from the tables. Two optional command line
58
+           configuration options 'age_in_days' defaults to 30 and 'max_rows'
59
+           defaults to -1 will be introduced to provide operator flexibility
60
+           in purging the records. -1 means purge command will remove all
61
+           records from tables which matches 'age_in_days' criteria. If
62
+           operator specifies 'max_rows' greater than 0 then those many records
63
+           will be purged from entire database (not per table) in one
64
+           operation.
65
+
66
+           For notification table as we do not have deleted_at value;
67
+           'age_in_days' will be calculated on the basis of updated_at value.
68
+           For example, if 'age_in_days' is mentioned as 10 while purging then
69
+           notifications which are having status finished,  ignored and failed
70
+           and updated before 10 days will be eligible for purging. For other
71
+           tables, records which were deleted before 10 days will be eligible
72
+           for purging.
73
+
74
+           Example:
75
+           $ masakari-manage db purge
76
+           This will purge all records from each table which are deleted or
77
+           updated before 30 days.
78
+
79
+           $ masakari-manage db purge --age_in_days 60
80
+           This will purge all records from each table which are deleted or
81
+           updated before 60 days.
82
+
83
+           $ masakari-manage db purge --max-rows 50
84
+           This will purge  total 50 records from entire database which are
85
+           deleted  or updated before 30 days.
86
+
87
+           $ masakari-manage db purge --age_in_days 60 --max-rows 50
88
+           This will purge 50 records from entire database which are deleted or
89
+           updated before 60 days.
90
+
91
+:alternatives: Add new delete_all api which will have status and age_in_days as
92
+               input parameters to delete the notifications. In this case user
93
+               can specify input notification status as either ignored, failed
94
+               or finished and based on age_in_days value those records will
95
+               be deleted from the notification table. For example if user
96
+               specifies status as 'finished' and age_in_days as 10 then
97
+               notifications which are having 'finished' status and updated
98
+               before 10 days will be deleted from the notification table.
99
+
100
+               Advantages:
101
+               1. Operator has flexibility to decide which notifications needs
102
+                  to be deleted from the notification table.
103
+
104
+               Disadvantages:
105
+               1. Only notification records will be deleted in this case,
106
+                  records from other tables will remain as it is.
107
+
108
+:impacts: None
109
+
110
+:timeline: Expected to be merged within the Pike time frame.
111
+
112
+:reviewers: sam47priya@gmail.com, sagaray@nttdata.co.jp,
113
+            tushar.vitthal.patil@gmail.com
114
+
115
+:assignee: Pooja Jadhav
116
+
117
+Add db purge support
118
+++++++++++++++++++++

Loading…
Cancel
Save