From a4800569021424701021f4699f4a2c71ab3afb17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Marqu=C3=A9s?= Date: Wed, 18 Feb 2015 14:41:12 -0300 Subject: [PATCH 1/2] When running londiste relay --rewind you'd get an exception because the python code would use a function called pgq.register_consumer_at which doesn't exist in skytools v2, but does in v3. This fix just by-passes the calls to the non-existing function (which will now exist) to the pgq.register_consumer function with 3 input parameters, which does exist (and was renamed to pgq.register_consumer_at in skytools v3). --- sql/pgq/functions/pgq.register_consumer.sql | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sql/pgq/functions/pgq.register_consumer.sql b/sql/pgq/functions/pgq.register_consumer.sql index ae19d01e..bf4518f6 100644 --- a/sql/pgq/functions/pgq.register_consumer.sql +++ b/sql/pgq/functions/pgq.register_consumer.sql @@ -23,6 +23,39 @@ end; $$ language plpgsql security definer; +create or replace function pgq.register_consumer_at( + x_queue_name text, + x_consumer_name text, + x_tick_pos bigint) +returns integer as $$ +-- ---------------------------------------------------------------------- +-- Function: pgq.register_consumer_at(3) +-- +-- Extended registration, allows to specify tick_id. +-- +-- Note: +-- For usage in special situations. +-- +-- Parameters: +-- x_queue_name - Name of a queue +-- x_consumer_name - Name of consumer +-- x_tick_pos - Tick ID +-- +-- Returns: +-- 0/1 whether consumer has already registered. +-- Calls: +-- None +-- Tables directly manipulated: +-- update/insert - pgq.subscription +-- +-- Fix bug introduced for compatibility from skytools 2.1 subscribers to +-- skytools 3.x providers +-- ---------------------------------------------------------------------- +begin + return pgq.register_consumer(x_queue_name, x_consumer_id, x_tick_pos); +end; + + create or replace function pgq.register_consumer( x_queue_name text, x_consumer_name text, From 5bd820f67359294a8f61f55afc1ea69773c5d713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Marqu=C3=A9s?= Date: Thu, 19 Feb 2015 15:24:11 -0300 Subject: [PATCH 2/2] Forgot to add the function language and finishing semi-colon. Also found a variable name mistaken --- sql/pgq/functions/pgq.register_consumer.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/pgq/functions/pgq.register_consumer.sql b/sql/pgq/functions/pgq.register_consumer.sql index bf4518f6..94f6d3ac 100644 --- a/sql/pgq/functions/pgq.register_consumer.sql +++ b/sql/pgq/functions/pgq.register_consumer.sql @@ -52,8 +52,9 @@ returns integer as $$ -- skytools 3.x providers -- ---------------------------------------------------------------------- begin - return pgq.register_consumer(x_queue_name, x_consumer_id, x_tick_pos); + return pgq.register_consumer(x_queue_name, x_consumer_name, x_tick_pos); end; +$$ language plpgsql security definer; create or replace function pgq.register_consumer(