From 4b728b998e8a4dd9c3ccad946bef0aa778c7f982 Mon Sep 17 00:00:00 2001 From: Geaaru Date: Sun, 4 Nov 2018 17:01:27 +0100 Subject: [PATCH] Fix vacuum on py3.6 pysqlite has a bug on use VACUUM with py3.6 (see https://github.com/ghaering/pysqlite/issues/109) Hereinafter, exception related to eit push --quick --force command: Traceback (most recent call last): File "/usr/lib/entropy/lib/entropy/db/sql.py", line 166, in _proxy_call return method(*args, **kwargs) sqlite3.OperationalError: cannot VACUUM from within a transaction During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/bin/eit", line 17, in main() File "/usr/lib/entropy/server/eit/main.py", line 114, in main exit_st = func(*func_args) File "/usr/lib/entropy/server/eit/commands/command.py", line 237, in _call_exclusive return func(server) File "/usr/lib/entropy/server/eit/commands/push.py", line 172, in _push rc = self._push_repo(entropy_server, repository_id) File "/usr/lib/entropy/server/eit/commands/push.py", line 184, in _push_repo rc = self.__push_repo(entropy_server, repository_id) File "/usr/lib/entropy/server/eit/commands/push.py", line 309, in __push_repo sts = self.__sync_repo(entropy_server, repository_id) File "/usr/lib/entropy/server/eit/commands/push.py", line 262, in __sync_repo enable_download = False, force = self._force) File "/usr/lib/entropy/lib/entropy/server/interfaces/mirrors.py", line 1673, in sync_repository enable_upload, enable_download, force = force) File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 231, in update enable_upload, enable_download, force = force).update() File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 404, in update rc, fine_uris, broken_uris = self._sync() File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 1873, in _sync broken_uris = self._upload(uris) File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 1529, in _upload self._shrink_and_close(dbconn) File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 1234, in _shrink_and_close entropy_repository.vacuum() File "/usr/lib/entropy/lib/entropy/db/sqlite.py", line 703, in vacuum self._cursor().execute("vacuum") File "/usr/lib/entropy/lib/entropy/db/sqlite.py", line 58, in execute cur = self._proxy_call(self._cur.execute, *args, **kwargs) File "/usr/lib/entropy/lib/entropy/db/sql.py", line 173, in _proxy_call raise OperationalError(err) entropy.db.exceptions.OperationalError: cannot VACUUM from within a transaction --- lib/entropy/db/sqlite.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/entropy/db/sqlite.py b/lib/entropy/db/sqlite.py index e2faf4930..3f87f2d5b 100644 --- a/lib/entropy/db/sqlite.py +++ b/lib/entropy/db/sqlite.py @@ -700,6 +700,10 @@ class EntropySQLiteRepository(EntropySQLRepository): """ Reimplemented from EntropySQLRepository. """ + # commit is required for use vacuum with py3.6 + # See issue: https://github.com/ghaering/pysqlite/issues/109 + # and pr for details: https://github.com/Sabayon/entropy/pull/66 + self.commit() self._cursor().execute("vacuum") def initializeRepository(self):