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

Database: fix deletion of old tokens #4815

Closed
davidpob99 opened this issue Sep 1, 2021 · 0 comments · Fixed by #4822
Closed

Database: fix deletion of old tokens #4815

davidpob99 opened this issue Sep 1, 2021 · 0 comments · Fixed by #4822

Comments

@davidpob99
Copy link
Member

Motivation

The current deletion of old tokens does not work properly (deadlocks) and the hints do not run:

session.query(models.Token).filter(models.Token.expired_at < datetime.datetime.utcnow(),
models.Token.account == account).with_for_update(skip_locked=True).delete()

Modification

Rewrite the queries to the new SQLAlchemy syntax, splitting each of them in a select and a delete statement. Add the following hint in the delete statement:

element = element.prefix_with("/*+ INDEX(TOKENS_ACCOUNT_EXPIRED_AT_IDX) */")

davidpob99 added a commit to davidpob99/rucio that referenced this issue Sep 6, 2021
davidpob99 added a commit to davidpob99/rucio that referenced this issue Sep 6, 2021
davidpob99 added a commit to davidpob99/rucio that referenced this issue Sep 6, 2021
bari12 pushed a commit that referenced this issue Oct 25, 2021
* Authentication: fix deletion of old tokens from DB #4815

* Update authentication.py

Co-authored-by: Mario Lassnig <mlassnig@users.noreply.github.com>
bari12 pushed a commit that referenced this issue Oct 25, 2021
* Authentication: fix deletion of old tokens from DB #4815

* Update authentication.py

Co-authored-by: Mario Lassnig <mlassnig@users.noreply.github.com>
@bari12 bari12 added this to the 1.26.8 milestone Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants