Skip to content
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

Fix: ISE 500 on concurrent tag addition #926

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

psrok1
Copy link
Member

@psrok1 psrok1 commented Mar 12, 2024

Your checklist for this pull request

  • I've read the contributing guideline.
  • I've tested my changes by building and running the project, and testing changed functionality (if applicable)
  • I've added automated tests for my change (if applicable, optional)
  • I've updated documentation to reflect my change (if applicable)

What is the current behaviour?

  • When tag is added concurrently: MWDB incorrectly recovers from conflict and re-raises IntegrityError due to incorrect sanity check.
  • db_tag in self.tags doesn't work when db_tag is transient object and doesn't have primary key which is used for comparison.

What is the new behaviour?

Object.add_tag correctly returns False in case of IntegrityError indicating that tag was already added (by concurrent transaction).

@psrok1 psrok1 added the type:bug Something isn't working label Mar 12, 2024
Copy link
Member

@msm-cert msm-cert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good I guess. I think we should also update the documentation to say that we require database integrity level to be read comitted (and not repeatable read).

@@ -540,18 +540,24 @@ def get_tags(self):
for tag in db.session.query(Tag).filter(Tag.object_id == self.id).all()
]

def add_tag(self, tag_name, commit=True):
def get_tag(self, tag_name):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add typing and docstring maybe?

@psrok1 psrok1 merged commit 0b08dcb into master Mar 12, 2024
12 checks passed
@psrok1 psrok1 deleted the fix/tag-ise-500-on-concurrent-add branch March 12, 2024 15:49
@psrok1 psrok1 mentioned this pull request Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants