[openstack-dev] [Nova] Handling soft delete for instance rows in a new cells database

Ahmed RAHAL arahal at iweb.com
Wed Nov 26 01:15:10 UTC 2014


Hi,

Le 2014-11-24 17:20, Michael Still a écrit :
> Heya,
>
> This is a new database, so its our big chance to get this right. So,
> ideas welcome...
>
> Some initial proposals:
>
>   - we do what we do in the current nova database -- we have a deleted
> column, and we set it to true when we delete the instance.
>
>   - we have shadow tables and we move delete rows to a shadow table.
>
>   - something else super clever I haven't thought of.

Some random thoughts that came to mind ...

1/ as far as I remember, you rarely want to delete a row
- it's usually a heavy DB operation (well, was back then)
- it's destructive (but we may want that)
- it creates fragmentation (less of a problem depending on db engine)
- it can break foreign key relations if not done the proper way

2/ updating a row to 'deleted=1'
- gives an opportunity to set a useful deletion time-stamp
I would even argue that setting the deleted_at field would suffice to 
declare a row 'deleted' (as in 'not NULL'). I know, "explicit is better 
than implicit" ...
- the update operation is not destructive
- an admin/DBA can decide when and how to purge/archive rows

3/ moving the row at deletion
- you want to avoid additional steps to complete an operation, thus 
avoid creating a new record while deleting one
- even if you wrap things into a transaction, not being able to create a 
row somewhere can make your delete transaction fail
- if I were to archive all deleted rows, at scale I'd probably move them 
to another db server altogether


Now, I for one would keep the current mark-as-deleted model.

I however perfectly get the problem of massive churn with instance 
creation/deletion.
So, let's be crazy, why not have a config option 
'on_delete=mark_delete', 'on_delete=purge' or 'on_delete=archive' and 
let the admin choose ? (is that feasible ?)

This would especially come handy if the admin decides the global cells 
database may not need to keep track of deleted instances, the cell-local 
nova database being the absolute reference for that.

HTH,

Ahmed.



More information about the OpenStack-dev mailing list