-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Unnecessary changelog records for tag add/change/remove #5583
Comments
Multiple change records are created because tags (a many-to-many relationship) are added and removed using separate queries. I agree that it's not optimal but the necessary data is still captured. Attempting to consolidate these changes would likely take quite a bit of effort. If you'd like to volunteer for this work, I'll assign it to you. Otherwise, I don't think there's much to be done. |
I think it is ok for Step 4. to have two change records, one for tag remove and one for tag add. But the additional change records in Step 3., 4., and 5. which shows no changes should not be created. Sadly my knowledge of the NetBox code is not good enough to fix this myself in a reasonable time. |
I agree with @netsandbox, there's no reason to create a log entry if there's no changes. @jeremystretch Is this something that you would accept a PR for? In my limited testing it seems to fix the problem, but I'm not sure if theres any other drawbacks of doing it this way. |
With the improvements made to change logging in v2.11 (see #5913), we should be able to update the first ObjectChange instance on |
This will be fixed in the upcoming v2.11 release. |
Environment
Steps to Reproduce
Expected Behavior
Steps 3., 4. and 5. create only one changelog record
Observed Behavior
Step 3. creates two changelog records (with the same request id), where only one record shows the tag add and one shows no change.
Step 4. creates three changelog records (with the same request id), where one record shows the TagA remove, one the TagB add, and one shows no change.
Step 5. creates two changelog records (with the same request id), where only one record shows the tag remove and one shows no change.
Here are the database
extras_objectchange
records for the above steps 2.-5.:https://gist.github.com/cloos/e7dd4c3b1f064098e4250e7cddb29c85
The text was updated successfully, but these errors were encountered: