skytools-legacy icon indicating copy to clipboard operation
skytools-legacy copied to clipboard

Skytools SQL has a missing function

Open martinmarques opened this issue 10 years ago • 2 comments

Hi,

I was today going through a server which had quite some lag and was forced to run "replay --rewind". All this with the surprise that I got this error:

-bash-4.1$ londiste.py ../londiste_main.ini replay --rewind 2015-02-17 16:27:55,650 10308 INFO Rewinding queue 2015-02-17 16:27:55,699 10308 CRITICAL Job main_replicate crashed: <class 'psycopg2.ProgrammingError'>: 'function pgq.register_consumer_at(unknown, unknown, integer) does not exist LINE 1: select pgq.register_consumer_at('main_replicate', 'main... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.' (<traceback object at 0x2213098>: [' File "/usr/pgsql-9.1/lib64/python2.6/site-packages/skytools/scripting.py", line 459, in run\n self.startup()\n', ' File "/usr/pgsql-9.1/lib64/python2.6/site-packages/pgq/consumer.py", line 378, in startup\n self.rewind()\n', ' File "/usr/pgsql-9.1/lib64/python2.6/site-packages/pgq/consumer.py", line 471, in rewind\n src_curs.execute(q, [self.pgq_queue_name, self.consumer_id, dst_tick])\n', ' File "/usr/lib64/python2.6/site-packages/psycopg2/extras.py", line 121, in execute\n return super(DictCursor, self).execute(query, vars)\n'])

Interesting thing was that there is no pgq.register_consumer_at function in the SQL for skytools 2 (running skytools 2.1.13), but there is a call to such a function in the python code, specifically when using --rewind.

I was able to find the pgq.register_consumer_at in the skytools3 pgq.register_consumer.sql

I will be checking the code to see if the new register_consumer* functions are compatible with skytools2, but wanted to let you know of the bug

martinmarques avatar Feb 17 '15 17:02 martinmarques

Looks like the SQL function changed names between skytools 2 and 3, and that change made the call for this function appear in the python code.

I'm about to push a change that fixes this by adding a new function called pgq.register_consumer_at with 3 parameters (as it's called in the python code) and just calls the pgq.register_consumer function with 3 parameters.

That should fix this issue, which looks like a mix up of code from 2.x and 3.x versions

martinmarques avatar Feb 18 '15 16:02 martinmarques

Commited a fix which is waiting for the pull request to be approved: a4800569021424701021f4699f4a2c71ab3afb17

martinmarques avatar Feb 18 '15 18:02 martinmarques