Skip to content

Commit

Permalink
Better handling of lack of powa extension on remote servers.
Browse files Browse the repository at this point in the history
As reported by Thoma Reiss, if the extension isn't available on the remote
server, users get an error message that's not helpful at all.  To fix, first
do the sanity check for the extension in the catalog to possibly avoid to hit
an error when trying to load powa, and also add a specific error message if the
extension cannot be loaded.

Patch by Thomas Reiss and Julien Rouhaud.
  • Loading branch information
rjuju committed Jun 28, 2019
1 parent bba35ad commit ade22a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
0.0.3
Bugfix:
- Support standard_conforming_strings = off
- Better error message for remote servers lacking powa extension (Thomas
Reiss and Julien Rouhaud)

0.0.2
Bugfix:
Expand Down
14 changes: 14 additions & 0 deletions powa_collector/powa_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,25 @@ def __check_powa(self):
self.logger.error("PoWA extension not found")
self.__disconnect_all()
self.__stopping.set()
return
elif (res[0] < 4):
self.logger.error("Incompatible PoWA version, found %s,"
" requires at least 4.0.0" % res[1])
self.__disconnect_all()
self.__stopping.set()
return

try:
# make sure the GUC are present in case powa isn't in
# shared_preload_librairies
cur = self.__remote_conn.cursor()
cur.execute("LOAD 'powa'")
cur.close()
self.__remote_conn.commit()
except psycopg2.Error as e:
self.logger.error("Could not load extension powa:\n%s" % e)
self.__disconnect_all()
self.__stopping.set()

def __reload(self):
self.logger.info("Reloading configuration")
Expand Down

0 comments on commit ade22a5

Please sign in to comment.