diff options
author | Marko Kreen | 2012-06-15 13:53:34 +0000 |
---|---|---|
committer | Marko Kreen | 2012-06-15 13:53:34 +0000 |
commit | 651dd5f4578bde761cf4164f752b25aad09419df (patch) | |
tree | fcb5652dd79f07b9986d04e1b4ebf575151ff89d | |
parent | 508dae94e95b4e412625a8782a41e1ea10e0338b (diff) |
pgq.maint_rotate_tables: check txid sanity, fail if bad
-rw-r--r-- | sql/pgq/functions/pgq.maint_rotate_tables.sql | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/pgq/functions/pgq.maint_rotate_tables.sql b/sql/pgq/functions/pgq.maint_rotate_tables.sql index d972a04e..d3cee739 100644 --- a/sql/pgq/functions/pgq.maint_rotate_tables.sql +++ b/sql/pgq/functions/pgq.maint_rotate_tables.sql @@ -30,6 +30,12 @@ begin return 0; end if; + -- if DB is in invalid state, stop + if txid_current() < cf.queue_switch_step1 then + raise exception 'queue % maint failure: step1=%, current=%', + i_queue_name, cf.queue_switch_step1, txid_current(); + end if; + -- find lowest tick for that queue select min(sub_last_tick) into lowest_tick_id from pgq.subscription |