-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Asset.previous
field
#2008
base: master
Are you sure you want to change the base?
Conversation
Now that audit is implemented, we can remove the `previous` field from the `Asset` model. This field was used to store the previous version of an asset, but it is no longer needed since we can track changes using the audit log.
0a1dd28
to
68749e3
Compare
Keeping this as draft until it's ready to merge, since we'll want to perform a DB backup before doing so. |
# Set previous asset and save | ||
new_asset.previous = asset | ||
new_asset.save() | ||
|
||
audit.update_asset(dandiset=version.dandiset, user=user, asset=new_asset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just to be clear, with this change, the only way to relate an audit event to an asset is through it's path
metadata field, correct? Since the old asset metadata isn't tracked, just the new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why does this file need to be changed as a part of this PR? Since I don't believe the API surface is changing at all.
I think we talked about it already, but can you remind me why we need a DB backup before rolling this out? We have the DB snapshot just before audit rolled out, and since that time everything we want to track should be in the audit table. We could take another DB backup out of an abundance of caution, but it's not strictly necessary, is that right? (The tradeoff here is just a downtime if we want to take the backup for safety purposes.) |
@waxlamp - was the previous link captured in the audit log? i.e. did audit backfill old entries based on the database? |
No, instead of backfilling the audit records table with that information, we captured a database backup that preserves whatever historical information exists, giving us the option of performing the backfill at any time. The major problem will be that most of the information that we currently capture in audit records is not recoverable from the previous links (see the audit design doc for details). If we decide we want to do this backfill, we should open an issue and discuss it there. Let me know what you think. |
Now that audit is implemented, we can remove the
previous
field from theAsset
model. This field was used to store the previous version of an asset, but it is no longer needed since we can track changes using the audit log.This also unblocks garbage collection, which will follow this PR.
(GC docs -
https://github.com/dandi/dandi-archive/blob/master/doc/design/garbage-collection-1.md
https://github.com/dandi/dandi-archive/blob/master/doc/design/garbage-collection-uploads-asset-blobs.md
)
Keeping this as draft until it's ready to merge, since we'll want to perform a DB backup before doing so.