Handle sequence's transactional behaviour on GTM
authorPavan Deolasee <[email protected]>
Mon, 20 Feb 2017 07:44:19 +0000 (13:14 +0530)
committerPavan Deolasee <[email protected]>
Fri, 5 May 2017 04:59:34 +0000 (10:29 +0530)
commit77e5c18763be07607c7f1b1ec1ac14eb034f4eb4
tree35cf4d60552166190277128942d8bc892b48381f
parent416f11f2610738c87e7da8c25b1e284359e5835e
Handle sequence's transactional behaviour on GTM

Previously we were tracking changes to sequences on the coordinator side and
applying those changes at transaction commit/rollback time. While this worked
ok for most cases, there were issues such as what happens if a sequence is
dropped and then recreated in the same transaction. Since the DROP is not
executed until the transaction commit time, the subsequent CREATE would fail on
the GTM.

We now track sequences renamed/dropped/created on the GTM side and do a cleanup
on transaction commit/rollback. For example, if a sequence is renamed but the
transaction is later aborted, the sequence will be renamed back to its original
name. Similarly, if a sequence is dropped and the transaction aborts, the
sequence will be re-instated.
13 files changed:
src/backend/access/transam/gtm.c
src/backend/catalog/dependency.c
src/backend/commands/sequence.c
src/backend/commands/tablecmds.c
src/gtm/client/gtm_client.c
src/gtm/main/gtm_seq.c
src/gtm/main/gtm_txn.c
src/include/commands/sequence.h
src/include/gtm/gtm_client.h
src/include/gtm/gtm_seq.h
src/include/gtm/gtm_txn.h
src/test/regress/expected/xc_sequence.out
src/test/regress/sql/xc_sequence.sql