<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 6 oct. 2022 à 09:48, Sylvain Bauza <<a href="mailto:sbauza@redhat.com">sbauza@redhat.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 6 oct. 2022 à 09:38, Sylvain Bauza <<a href="mailto:sbauza@redhat.com" target="_blank">sbauza@redhat.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 6 oct. 2022 à 07:54, Artem Goncharov <<a href="mailto:artem.goncharov@gmail.com" target="_blank">artem.goncharov@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hey,<div dir="auto"><br></div><div dir="auto">If this is there mostly for audit purposes then I guess a more efficient solution is to introduce an audit table which will have no performance impact on the "current state" of service. Audit records are also never updated means performance here is relatively straight forward. Audit may become a "feature" with enable switch.</div><div dir="auto"><br></div><div dir="auto">This should be a better solution rather then letting db permanently grow and forcing admins to constantly "fight" against it. This also gives a much cleaner audit experience. Actually this is also not a new approach and is being followed in many places (i.e. auditd)</div><div dir="auto"><br></div></div></blockquote><div><br></div><div>This isn't true. Any operator that sees the Nova DBs [1] growing can use two commands (or just cron them) :</div><div><div><code><span>nova-manage</span> <span>db</span> <span>archive_deleted_rows<br></span></code></div><div><code><span><code><span>nova-manage</span> <span>db</span> <span>purge</span></code></span></code></div></div><div><br></div><div>The first command will archive the soft-deleted records to another table and the second one will purge them.</div></div></div></blockquote><div><br></div><div>My apologies, forgot to add the link <br></div><div><a href="https://docs.openstack.org/nova/rocky/cli/nova-manage.html#nova-database" target="_blank">https://docs.openstack.org/nova/rocky/cli/nova-manage.html#nova-database</a><br></div><div><br></div></div></div></blockquote><div><br></div><div>Morning not caffeinated yet, sorry.</div><div>Wrong link : <a href="https://docs.openstack.org/nova/latest/cli/nova-manage.html#db-archive-deleted-rows">https://docs.openstack.org/nova/latest/cli/nova-manage.html#db-archive-deleted-rows</a></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div>Also, forgot the footnote<br></div><div>[1] actually only the nova cell DBs are supporting soft-delete records, we don't have this for the API DB.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Here, I don't see why we would change this by a configuration option, but we can discuss this at the PTG like Stephen said.</div><div>-Sylvain<br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"></div><div dir="auto">Regards,</div><div dir="auto">Artem<br><br><div dir="auto">----<br>typed from mobile, auto-correct typos assumed<br>----</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 6, 2022, 07:27 Dmitriy Rabotyagov <<a href="mailto:noonedeadpunk@gmail.com" target="_blank">noonedeadpunk@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Not having soft delete in the database is really quite bad for operators and it's not about tooling, but it's about audit purposes.<div dir="auto"><br></div><div dir="auto">If take nova as example, this also means that once server is deleted, event log will be also wiped with no way to see who and when has performed delete action. And that is really used feature, as we got requests like "why my VM has disappeared" at very least one a week.</div><div dir="auto"><br></div><div dir="auto">For other services having deleted_at at least points to the datetime where to search in the logs.</div><div dir="auto"><br></div><div dir="auto">At the same time I don't see any issue in having soft delete. It's just a matter of one systemd-timer, and too concerned about performance can set it to 1 day, thus almost no impact on db performance.</div><div dir="auto"><br></div><div dir="auto">So from operator perspective I can say this is very valuable feature and I personally do struggle regularly with neutron services where it's absent. And I would hate this to disappear at all, as it would be really a nightmare.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 5 окт. 2022 г., 14:48 Stephen Finucane <<a href="mailto:stephenfin@redhat.com" rel="noreferrer" target="_blank">stephenfin@redhat.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">👋<br>
<br>
I'm planning on bringing this up in the nova rooms at the PTG in a few weeks,<br>
but I'm also raising it here since this potentially affects other service<br>
projects and I can't attend all of those room :)<br>
<br>
Many projects use the concept of "soft delete" in their database models. A soft<br>
deletable model typically has two additional columns, 'deleted' and<br>
'deleted_at'. When deleting such a model, instead of actually deleting the<br>
database row (i.e. 'DELETE FROM table WHERE condition'), we set 'deleted' to<br>
'True' and populate the 'deleted_at' column. This is helpful for auditing<br>
purposes (e.g. you can inspect all resources ever created, even after they've<br>
been "deleted") but bad for database performance (your tables can grow without<br>
bound). To work around the performance issues, most projects implement some kind<br>
of archive or purge command that will allow operators to periodically clean up<br>
these deleted resources. However, at least in nova, we've long since come to the<br>
conclusion that soft deleting isn't as useful as initially suspected and the<br>
need to run these commands is additional work for no benefit. We've moved toward<br>
not using it for all new models.<br>
<br>
With this said, it's going to be difficult to get away from soft-delete quickly.<br>
Not only are there database migrations involved, but operators will need to<br>
rework their tooling to adapt to a new, no-soft-delete world. As such, I'd like<br>
to propose a half-way measure of making soft-delete configurable. To do this,<br>
I'd like to add a new flag in oslo.db, '[database] enable_soft_delete'. When set<br>
to 'False' anyone using the 'SoftDeleteMixin' from oslo.db would see these<br>
models hard deleted rather than soft deleted when calling 'soft_delete'. This<br>
would avoid the need for operators to run the various project-specific purge<br>
tooling. The RFC patch for this is available for review [1]. I can also do this<br>
on a project-specific basis and have proposed a similar patch for nova [2],<br>
however, doing it in oslo.db means every project that uses 'SoftDeleteMixin' in<br>
their models will get this for free. Projects that don't (glance, cinder) can<br>
switch to using this mixin and also get it for free.<br>
<br>
As noted above, I intend to discuss this in the nova room at the PTG, but I'd be<br>
interested in people's thoughts ahead of time. Do you think this is a good idea?<br>
Should we proceed with it? Perhaps there are there better ways to do this? Let<br>
me know!<br>
<br>
Cheers,<br>
Stephen<br>
<br>
[1] <a href="https://review.opendev.org/c/openstack/oslo.db/+/860407" rel="noreferrer noreferrer noreferrer" target="_blank">https://review.opendev.org/c/openstack/oslo.db/+/860407</a><br>
[2] <a href="https://review.opendev.org/c/openstack/nova/+/860401" rel="noreferrer noreferrer noreferrer" target="_blank">https://review.opendev.org/c/openstack/nova/+/860401</a><br>
<br>
<br>
</blockquote></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>