pgq: Ability to limit the number of events inserted by one TX
authorMarko Kreen <markokr@gmail.com>
Thu, 2 Apr 2009 10:34:39 +0000 (13:34 +0300)
committerMarko Kreen <markokr@gmail.com>
Thu, 2 Apr 2009 14:00:13 +0000 (17:00 +0300)
commit1656a5e5f3fe9935b75c322a2c6d53aff5c68717
tree3183493afdefe5551c4a015a7f5e847535358dc6
parentcd9decda2095fe422b4fba2dc89a12edab39d2ae
pgq: Ability to limit the number of events inserted by one TX

As PgQ can split batches only on transaction boundaries,
it does not tolerate huge number of events inserted by one TX.

This batch adds per-queue field queue_per_tx_limit, which can be
set to reasonable number and PgQ will enforce the limit, by throwing
error if event counts gets larger, thus rollbacking the problematic TX.

Such limit also adds possibility to survive UPDATE/DELETE statements,
where the WHERE clause is missing or buggy.
sql/pgq/expected/pgq_core.out
sql/pgq/lowlevel/insert_event.c
sql/pgq/sql/pgq_core.sql
sql/pgq/structure/tables.sql