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

Add airflow db clean-all-expired-sessions ? command #33370

Open
1 task done
potiuk opened this issue Aug 13, 2023 · 5 comments
Open
1 task done

Add airflow db clean-all-expired-sessions ? command #33370

potiuk opened this issue Aug 13, 2023 · 5 comments
Assignees
Labels
good first issue kind:meta High-level information important to the community

Comments

@potiuk
Copy link
Member

potiuk commented Aug 13, 2023

Body

With #33347 we already can cleanup session table with the same mechanism we have for all tables where --clean-before-timestamp == expiry. This is consistent with other tables, but 'session` table might have a dedicated command that will clean all the already expired sessions.

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.
@potiuk potiuk added the kind:meta High-level information important to the community label Aug 13, 2023
@arjunanan6
Copy link
Contributor

I'd like to give this one a try, could you please assign it to me?

@potiuk
Copy link
Member Author

potiuk commented Aug 14, 2023

Did.

@arjunanan6
Copy link
Contributor

Will work on this soon.

@SeethalakshmiB
Copy link

SeethalakshmiB commented Nov 14, 2023

Any update about this feature's availability. RIght now am experiencing DB Storage outage (95GB over 100GB) for airflow metadata DB, where session table utilized 92GB, This command would really helpful to clear them out.
thanks

@arjunanan6
Copy link
Contributor

arjunanan6 commented Nov 16, 2023

Hi @SeethalakshmiB, unfortunately, I've not been able to get started on this - too much going on. However, you can clear this out manually provided you have access to the metadata database. I assume that you are using the default session lifetime configuration of 30 days.

If that's the case, simply back up your session table and run (postgres syntax):

DELETE FROM session
WHERE expiry < NOW() - INTERVAL '30 days';

And of course, remember to run a VACUUM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue kind:meta High-level information important to the community
Projects
None yet
Development

No branches or pull requests

3 participants