From 8a44b7f72e42e8c0e71d5823663b656380b5d3d4 Mon Sep 17 00:00:00 2001
From: Jim Foraker <foraker1@llnl.gov>
Date: Nov 07 2019 00:50:20 +0000
Subject: koji-sweep-db: Turn on autocommit to eliminate VACUUMing errors


psycopg2 leaves transactions open by default, which causes VACUUM to
fail.  Turning on autocommit disables this behavior.

---

diff --git a/util/koji-sweep-db b/util/koji-sweep-db
index 3c1a65b..1d71007 100755
--- a/util/koji-sweep-db
+++ b/util/koji-sweep-db
@@ -81,6 +81,7 @@ if __name__ == "__main__":
                           port=opts.get("DBPort", None))
 
     conn = koji.db.connect()
+    conn.set_session(autocommit=True)
     cursor = conn.cursor()
 
     clean_sessions(cursor, options.vacuum)

