Trunce django_session table instead of cleanning it up.
The table django_session is used to keep track of connections and
reuse sessions that have been created. As it currently stands this is
not really respected/used in the Autotest framework and this table
just ends up growing to ridiculous sizes with no benefit.
Truncating the table offers a quick way of clearing all entries we
have accrued with no side effects. As opposed to cleaning up the table
which adds processing overhead to the database and lag when restarting
the scheduler or when it hits its maintenance window.
TEST=Ran truncate on the test server and during RPC/Web page
accesses to ensure that we do not impact scripts or page loads.
BUG=chromium-os:31608
STATUS=Fixed
Change-Id: I600284ef231f2a6943d35e7a72e4fed1328475d7
Reviewed-on: https://gerrit.chromium.org/gerrit/30013
Commit-Ready: Scott Zawalski <scottz@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Scott Zawalski <scottz@chromium.org>
diff --git a/scheduler/monitor_db_cleanup.py b/scheduler/monitor_db_cleanup.py
index d8bab11..ad5556c 100644
--- a/scheduler/monitor_db_cleanup.py
+++ b/scheduler/monitor_db_cleanup.py
@@ -218,7 +218,7 @@
http://www.djangoproject.com/documentation/0.96/sessions/
"""
logging.info('Deleting old sessions from django_session')
- sql = 'DELETE FROM django_session WHERE expire_date < NOW()'
+ sql = 'TRUNCATE TABLE django_session'
self._db.execute(sql)