|
From: Tatsuo I. <is...@po...> - 2012-11-02 02:27:26
|
> I am sure you already know that a Postgres-XC cluster needs a unique GTM > (global transaction manager) to feed global transaction ID values and > global snapshots to each node of the cluster, the same GTM is used for the > feed of sequence values in a global way. > As a start if you want to have a look at how it is managed in XC, for the > postgres backend side have a look at nextval_internal in > src/backend/commands/sequence.c, we put in the PG code a hook called > GetNextValGTM to get the next global sequence value from GTM. There are > similar hooks for CREATE/ALTER/DROP SEQUENCE. All the backend-side client > APIs related to GTM are located in src/backend/access/transam/gtm.c. > > On the GTM side, I would recommend you to have a look at src/gtm/main, > mainly gtm_seq.c which contains all the sequence-related APIs. > Also, the message types exchanged between GTM and backend nodes are listed > in src/include/gtm/gtm_msg.h. MSG_SEQUENCE_GET_NEXT is for example the > message type used to get the next global value of a sequence. Look at how > messages of this type are managed on backend and GTM side and you will > understand easily the process flow. Thanks for a quick response. I will take a look at the source code. -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp |