pgq_node.set_partition_watermark: finally sync with other pgq_node cleanups
authorMarko Kreen <markokr@gmail.com>
Wed, 24 Nov 2010 20:19:02 +0000 (22:19 +0200)
committerMarko Kreen <markokr@gmail.com>
Wed, 24 Nov 2010 20:19:02 +0000 (22:19 +0200)
sql/pgq_node/functions/pgq_node.set_partition_watermark.sql

index 172d2cd83e59876ad732f39bf2f341b2965da79c..d3d69f842de91049e870e4cbc5bd6ede10678f7d 100644 (file)
@@ -28,22 +28,17 @@ begin
         where p.queue_name = i_part_queue_name
           and c.queue_name = i_combined_queue_name
           and p.combined_queue = c.queue_name
-          and p.node_type = 'merge-leaf'
-          and c.node_type = 'combined-branch';
+          and p.node_type = 'leaf'
+          and c.node_type = 'branch';
     if not found then
         select 201, 'Part-queue does not exist' into ret_code, ret_note;
         return;
     end if;
 
-    if n.node_type <> 'branch' then
-        select 202, 'Not branch node' into ret_code, ret_note;
-        return;
-    end if;
-
     update pgq_node.local_state
        set last_tick_id = i_watermark
-     where queue_name = i_part_node_name
-       and worker_name = n.worker_name;
+     where queue_name = i_part_queue_name
+       and consumer_name = n.worker_name;
     if not found then
         select 401, 'Worker registration not found' into ret_code, ret_note;
         return;