Tue Aug 3 18:17:33 PDT 2004
- Previous message: [Slony1-commit] By cbbrowne: Change this to look at all nodes and request function
- Next message: [Slony1-commit] By cbbrowne: Changed "conventional" port to 5432
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message: ----------- Add comments to all tables and to an increasing population of functions Modified Files: -------------- slony1-engine/src/backend: slony1_base.sql (r1.14 -> r1.15) slony1_funcs.sql (r1.15 -> r1.16) -------------- next part -------------- Index: slony1_base.sql =================================================================== RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_base.sql,v retrieving revision 1.14 retrieving revision 1.15 diff -Lsrc/backend/slony1_base.sql -Lsrc/backend/slony1_base.sql -u -w -r1.14 -r1.15 --- src/backend/slony1_base.sql +++ src/backend/slony1_base.sql @@ -26,7 +26,7 @@ CONSTRAINT "sl_node-pkey" PRIMARY KEY (no_id) ); - +comment on table @NAMESPACE at .sl_node is 'Holds the list of nodes associated with this namespace. no_id is the unique ID number for the node; no_comment is a human-oriented description of the node'; -- ---------------------------------------------------------------------- -- TABLE sl_set @@ -43,6 +43,13 @@ FOREIGN KEY (set_origin) REFERENCES @NAMESPACE at .sl_node (no_id) ); +comment on table @NAMESPACE at .sl_set is 'Holds definitions of replication sets. + +set_id is a unique ID number for the set. +set_origin is the ID number of the source node for the replication set. +set_locked indicates whether or not the set is locked. +set_comment is a human-oriented description of the set. +'; -- ---------------------------------------------------------------------- @@ -66,6 +73,7 @@ FOREIGN KEY (ssy_origin) REFERENCES @NAMESPACE at .sl_node (no_id) ); +comment on table @NAMESPACE at .sl_setsync is 'Not documented yet'; -- ---------------------------------------------------------------------- @@ -85,6 +93,12 @@ FOREIGN KEY (tab_set) REFERENCES @NAMESPACE at .sl_set (set_id) ); +comment on table @NAMESPACE at .sl_table is 'Holds information about the tables being replicated. + +tab_id - unique key for Slony-I to use to identify the table +tab_reloid - the OID of the table in pg_catalog.pg_class.oid +tab_idxname - the name of the primary index of the table +tab_comment - Human-oriented description of the table'; -- ---------------------------------------------------------------------- @@ -101,6 +115,7 @@ REFERENCES @NAMESPACE at .sl_table (tab_id) ON DELETE CASCADE ); +comment on table @NAMESPACE at .sl_trigger is 'Indicates the name of a trigger [for what purpose?]'; -- ---------------------------------------------------------------------- @@ -118,6 +133,11 @@ FOREIGN KEY (seq_set) REFERENCES @NAMESPACE at .sl_set (set_id) ); +comment on table @NAMESPACE at .sl_sequence is 'Similar to sl_table, each entry identifies a sequence being replicated. +seq_id is an internally-used ID for Slony-I to use in its sequencing of updates +seq_reloid is the OID of the sequence object +seq_set indicates which replication set the object is in +seq_comment is a human-oriented comment'; -- ---------------------------------------------------------------------- @@ -138,6 +158,13 @@ FOREIGN KEY (pa_client) REFERENCES @NAMESPACE at .sl_node (no_id) ); +comment on table @NAMESPACE at .sl_path is 'Holds connection information for the paths between nodes, and the synchronisation delay + +pa_server - The Node ID # (from sl_node.no_id) of the data source +pa_client - The Node ID # (from sl_node.no_id) of the data target +pa_conninfo - The PostgreSQL connection string used to connect to the source node. +pa_connretry - The synchronisation delay, in seconds +'; -- ---------------------------------------------------------------------- @@ -157,6 +184,12 @@ FOREIGN KEY (li_provider, li_receiver) REFERENCES @NAMESPACE at .sl_path (pa_server, pa_client) ); +comment on table @NAMESPACE at .sl_listen is 'Indicates how nodes listen to events from other nodes in the Slony-I network. + +li_origin : Integer. The ID # (from sl_node.no_id) of the node this listener is operating on +li_provider : Integer. The ID # (from sl_node.no_id) of the source node for this listening event +li_receiver : Integer. The ID # (from sl_node.no_id) of the target node for this listening event +'; -- ---------------------------------------------------------------------- @@ -178,6 +211,7 @@ FOREIGN KEY (sub_set) REFERENCES @NAMESPACE at .sl_set (set_id) ); +comment on table @NAMESPACE at .sl_subscribe is 'Not documented yet'; -- ---------------------------------------------------------------------- @@ -203,6 +237,41 @@ CONSTRAINT "sl_event-pkey" PRIMARY KEY (ev_origin, ev_seqno) ); +comment on table @NAMESPACE at .sl_event is 'Holds information about replication events. + +After a period of time, Slony removes old confirmed events from both this table and the sl_confirm table. + +ev_origin : Integer. The ID # (from sl_node.no_id) of the source node for this event +ev_seqno : Integer. The ID # for the event +ev_timestamp : Timestamp. When this event record was created +ev_minxid : +ev_maxxid : +ev_xip : String. +ev_type : String. The type of event this record is for. + + SYNC = Synchronise + STORE_NODE = + ENABLE_NODE = + DROP_NODE = + STORE_PATH = + DROP_PATH = + STORE_LISTEN = + DROP_LISTEN = + STORE_SET = + DROP_SET = + MERGE_SET = + SET_ADD_TABLE = + SET_ADD_SEQUENCE = + STORE_TRIGGER = + DROP_TRIGGER = + MOVE_SET = + FAILOVER_SET = + SUBSCRIBE_SET = + ENABLE_SUBSCRIPTION = + UNSUBSCRIBE_SET = + DDL_SCRIPT = + ADJUST_SEQ = +'; -- ---------------------------------------------------------------------- @@ -214,12 +283,20 @@ con_seqno int8, con_timestamp timestamp DEFAULT timeofday()::timestamp ); +comment on table @NAMESPACE at .sl_confirm is 'Holds confirmation of replication events. + +After a period of time, Slony removes old confirmed events from both this table and the sl_event table. + +con_origin : Integer. The ID # (from sl_node.no_id) of the source node for this event +con_received : Integer. +con_seqno : Integer. The ID # for the event +con_timestamp : Timestamp. When this event was confirmed +'; create index sl_confirm_idx1 on @NAMESPACE at .sl_confirm (con_origin, con_received, con_seqno); create index sl_confirm_idx2 on @NAMESPACE at .sl_confirm (con_received, con_seqno); - -- ---------------------------------------------------------------------- -- TABLE sl_seqlog -- ---------------------------------------------------------------------- @@ -229,6 +306,7 @@ seql_ev_seqno int8, seql_last_value int8 ); +comment on table @NAMESPACE at .sl_seqlog is 'Not documented yet'; create index sl_seqlog_idx on @NAMESPACE at .sl_seqlog (seql_origin, seql_ev_seqno, seql_seqid); @@ -283,6 +361,13 @@ create index sl_log_1_idx1 on @NAMESPACE at .sl_log_1 (log_origin, log_xid @NAMESPACE at .xxid_ops, log_actionseq); +comment on table @NAMESPACE at .sl_log_1 is 'Stores each change to be propagated to subscriber nodes + +log_origin - origin node from which the change came +log_xid - transaction ID on the origin node +log_table_id - the table ID (from sl_table.tab_id) that this log entry is to affect +log_cmdtype - replication action to take. U = Update, I = Insert, D = DELETE +log_cmddata - the data needed to perform the log action'; -- ---------------------------------------------------------------------- -- TABLE sl_log_2 @@ -295,6 +380,13 @@ log_cmdtype char, log_cmddata text ); +comment on table @NAMESPACE at .sl_log_2 is 'Stores each change to be propagated to subscriber nodes + +log_origin - origin node from which the change came +log_xid - transaction ID on the origin node +log_table_id - the table ID (from sl_table.tab_id) that this log entry is to affect +log_cmdtype - replication action to take. U = Update, I = Insert, D = DELETE +log_cmddata - the data needed to perform the log action'; create index sl_log_2_idx1 on @NAMESPACE at .sl_log_2 (log_origin, log_xid @NAMESPACE at .xxid_ops, log_actionseq); @@ -313,6 +405,7 @@ create sequence @NAMESPACE at .sl_local_node_id MINVALUE -1; SELECT setval('@NAMESPACE at .sl_local_node_id', -1); +comment on sequence @NAMESPACE at .sl_local_node_id is 'The local node ID is initialized to -1, meaning that this node is not initialized yet.'; -- ---------------------------------------------------------------------- @@ -321,7 +414,7 @@ -- The sequence for numbering events originating from this node. -- ---------------------------------------------------------------------- create sequence @NAMESPACE at .sl_event_seq; - +comment on sequence @NAMESPACE at .sl_event_seq is 'The sequence for numbering events originating from this node.'; -- ---------------------------------------------------------------------- -- SEQUENCE sl_action_seq @@ -331,6 +424,8 @@ -- statements. -- ---------------------------------------------------------------------- create sequence @NAMESPACE at .sl_action_seq; +comment on sequence @NAMESPACE at .sl_action_seq is 'The sequence to number statements in the transaction logs, so that the replication engines can figure out the "agreeable" order of statements.'; + -- ---------------------------------------------------------------------- @@ -342,6 +437,7 @@ -- ---------------------------------------------------------------------- create sequence @NAMESPACE at .sl_rowid_seq; grant select, update on @NAMESPACE at .sl_rowid_seq to public; +comment on sequence @NAMESPACE at .sl_rowid_seq is 'Application tables that do not have a natural primary key must be modified and an int8 column added that serves as a rowid for us. The values are assigned with a default from this sequence.'; -- ---------------------------------------------------------------------- @@ -360,6 +456,17 @@ create sequence @NAMESPACE at .sl_log_status MINVALUE 0 MAXVALUE 3; SELECT setval('@NAMESPACE at .sl_log_status', 0); +comment on sequence @NAMESPACE at .sl_log_status is ' +Bit 0x01 determines the currently active log table +Bit 0x02 tells if the engine needs to read both logs +after switching until the old log is clean and truncated. + +Possible values: + 0 sl_log_1 active, sl_log_2 clean + 1 sl_log_2 active, sl_log_1 clean + 2 sl_log_1 active, sl_log_2 unknown - cleanup + 3 sl_log_2 active, sl_log_1 unknown - cleanup +'; -- ********************************************************************** @@ -377,7 +484,8 @@ create table @NAMESPACE at .sl_config_lock ( dummy integer ); - +comment on table @NAMESPACE at .sl_config_lock is 'This table exists solely to prevent overlapping execution of configuration change procedures and the resulting possible deadlocks. +'; -- ---------------------------------------------------------------------- -- Last but not least grant USAGE to the replication schema objects. Index: slony1_funcs.sql =================================================================== RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v retrieving revision 1.15 retrieving revision 1.16 diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.15 -r1.16 --- src/backend/slony1_funcs.sql +++ src/backend/slony1_funcs.sql @@ -26,54 +26,99 @@ language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text, text, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text, text, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text, text, text, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text, text, text, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + create or replace function @NAMESPACE at .createEvent (name, text, text, text, text, text, text, text, text, text) returns bigint as '$libdir/slony1_funcs', '_Slony_I_createEvent' language C called on null input; +comment on function @NAMESPACE at .createEvent (name, text, text, text, text, text, text, text, text, text) is +'FUNCTION createEvent (cluster_name, ev_type [, ev_data [...]]) + +Create an sl_event entry'; + -- ---------------------------------------------------------------------- -- FUNCTION denyAccess (cluster_name) @@ -86,6 +131,10 @@ as '$libdir/slony1_funcs', '_Slony_I_denyAccess' language C security definer; + +comment on function @NAMESPACE at .denyAccess () is + 'Trigger function to prevent modifications to a table on a subscriber'; + grant execute on function @NAMESPACE at .denyAccess () to public; @@ -100,6 +149,8 @@ as '$libdir/slony1_funcs', '_Slony_I_lockedSet' language C; +comment on function @NAMESPACE at .lockedSet () is + 'Trigger function to prevent modifications to a table before and after a moveSet()'; -- ---------------------------------------------------------------------- -- FUNCTION getLocalNodeId (name) @@ -112,6 +163,8 @@ security definer; grant execute on function @NAMESPACE at .getLocalNodeId (name) to public; +comment on function @NAMESPACE at .getLocalNodeId (name) is + 'not yet documented'; -- ---------------------------------------------------------------------- -- FUNCTION setSessionRole (name, role) @@ -122,6 +175,8 @@ as '$libdir/slony1_funcs', '_Slony_I_setSessionRole' language C security definer; +comment on function @NAMESPACE at .setSessionRole (name) is + 'not yet documented'; grant execute on function @NAMESPACE at .setSessionRole (name, text) to public; @@ -134,6 +189,8 @@ as '$libdir/slony1_funcs', '_Slony_I_getSessionRole' language C security definer; +comment on function @NAMESPACE at .getSessionRole (name) is + 'not yet documented'; grant execute on function @NAMESPACE at .getSessionRole (name) to public; @@ -146,9 +203,10 @@ as '$libdir/slony1_funcs', '_Slony_I_logTrigger' language C security definer; +comment on function @NAMESPACE at .logTrigger () is + 'not yet documented'; grant execute on function @NAMESPACE at .logTrigger () to public; - -- ---------------------------------------------------------------------- -- FUNCTION terminateNodeConnections (name) -- @@ -157,6 +215,8 @@ create or replace function @NAMESPACE at .terminateNodeConnections (name) returns int4 as '$libdir/slony1_funcs', '_Slony_I_terminateNodeConnections' language C; +comment on function @NAMESPACE at .terminateNodeConnections (name) is + 'not yet documented'; -- ********************************************************************** @@ -205,6 +265,12 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .initializeLocalNode (int4, text) is + 'no_id - Node ID # +no_comment - Human-oriented comment + +Initializes the new node, no_id'; + -- ---------------------------------------------------------------------- -- FUNCTION storeNode (no_id, no_comment) @@ -225,6 +291,11 @@ ' language plpgsql called on null input; +comment on function @NAMESPACE at .storeNode(int4, text) is +'no_id - Node ID # +no_comment - Human-oriented comment + +Generate the STORE_NODE event for node no_id'; -- ---------------------------------------------------------------------- -- FUNCTION storeNode_int (no_id, no_comment) @@ -271,6 +342,12 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .storeNode_int(int4, text) is +'no_id - Node ID # +no_comment - Human-oriented comment + +Internal function to process the STORE_NODE event for node no_id'; + -- ---------------------------------------------------------------------- -- FUNCTION enableNode (no_id) @@ -315,6 +392,10 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .enableNode(int4) is +'no_id - Node ID # + +Generate the ENABLE_NODE event for node no_id'; -- ---------------------------------------------------------------------- -- FUNCTION enableNode_int (no_id) @@ -387,6 +468,10 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .enableNode_int(int4) is +'no_id - Node ID # + +Internal funciton to process the ENABLE_NODE event for node no_id'; -- ---------------------------------------------------------------------- -- FUNCTION disableNode (no_id) @@ -403,7 +488,8 @@ raise exception ''Slony-I: disableNode() not implemented''; end; ' language plpgsql; - +comment on function @NAMESPACE at .disableNode(int4) is +'generate DISABLE_NODE event for node no_id'; -- ---------------------------------------------------------------------- -- FUNCTION disableNode_int (no_id) @@ -421,6 +507,10 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .disableNode(int4) is +'process DISABLE_NODE event for node no_id + +NOTE: This is not yet implemented!'; -- ---------------------------------------------------------------------- -- FUNCTION dropNode (no_id) @@ -481,7 +571,8 @@ p_no_id); end; ' language plpgsql; - +comment on function @NAMESPACE at .dropNode(int4) is +'generate DROP_NODE event to drop node node_id from replication'; -- ---------------------------------------------------------------------- -- FUNCTION dropNode_int (no_id) @@ -536,13 +627,15 @@ return p_no_id; end; ' language plpgsql; +comment on function @NAMESPACE at .dropNode_int(int4) is +'internal function to process DROP_NODE event to drop node node_id from replication'; -- ---------------------------------------------------------------------- -- FUNCTION failedNode (failed_node, backup_node) -- -- Initiate a failover. This function must be called on all nodes --- and then waited for the restart of all node deamons. +-- and then waited for the restart of all node daemons. -- ---------------------------------------------------------------------- create or replace function @NAMESPACE at .failedNode(int4, int4) returns int4 @@ -747,7 +840,9 @@ return p_failed_node; end; ' language plpgsql; - +comment on function @NAMESPACE at .failedNode(int4,int4) is +'Initiate failover from failed_node to backup_node. This function must be called on all nodes, +and then waited for the restart of all node daemons.'; -- ---------------------------------------------------------------------- -- FUNCTION failedNode2 (failed_node, backup_node, set_id, ev_seqno, ev_seqfake) @@ -805,6 +900,11 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .failedNode2 (int4, int4, int4, int8, int8) is +'FUNCTION failedNode2 (failed_node, backup_node, set_id, ev_seqno, ev_seqfake) + +On the node that has the highest sequence number of the failed node, +fake the FAILED_NODE event.'; -- ---------------------------------------------------------------------- -- FUNCTION failoverSet_int (failed_node, backup_node, set_id) @@ -899,7 +999,10 @@ return p_failed_node; end; ' language plpgsql; +comment on function @NAMESPACE at .failoverSet_int (int4, int4, int4) is +'FUNCTION failoverSet_int (failed_node, backup_node, set_id) +Finish failover for one set.'; -- ---------------------------------------------------------------------- -- FUNCTION uninstallNode () @@ -932,6 +1035,9 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .uninstallNode() is +'Reset the whole database to standalone by removing the whole +replication system.'; -- ---------------------------------------------------------------------- -- FUNCTION storePath (pa_server, pa_client, pa_conninfo, pa_connretry) @@ -954,6 +1060,12 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .storePath (int4, int4, text, int4) is +'FUNCTION storePath (pa_server, pa_client, pa_conninfo, pa_connretry) + +Generate the STORE_PATH event indicating that node pa_client can +access node pa_server using DSN pa_conninfo'; + -- ---------------------------------------------------------------------- -- FUNCTION storePath_int (pa_server, pa_client, pa_conninfo, pa_connretry) @@ -1016,7 +1128,11 @@ return 0; end; ' language plpgsql; +comment on function @NAMESPACE at .storePath_int (int4, int4, text, int4) is +'FUNCTION storePath (pa_server, pa_client, pa_conninfo, pa_connretry) +Process the STORE_PATH event indicating that node pa_client can +access node pa_server using DSN pa_conninfo'; -- ---------------------------------------------------------------------- -- FUNCTION dropPath (pa_server, pa_client) @@ -1071,6 +1187,8 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .dropPath (int4, int4) is + 'Generate DROP_PATH event to drop path from pa_server to pa_client'; -- ---------------------------------------------------------------------- -- FUNCTION dropPath_int (pa_server, pa_client) @@ -1110,6 +1228,8 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .dropPath_int (int4, int4) is +'Process DROP_PATH event to drop path from pa_server to pa_client'; -- ---------------------------------------------------------------------- -- FUNCTION storeListen (li_origin, li_provider, li_receiver) @@ -1131,6 +1251,12 @@ ' language plpgsql called on null input; +comment on function @NAMESPACE at .storeListen(int4,int4,int4) is +'FUNCTION storeListen (li_origin, li_provider, li_receiver) + +generate STORE_LISTEN event, indicating that receiver node li_receiver +listens to node li_provider in order to get messages coming from node +li_origin.'; -- ---------------------------------------------------------------------- -- FUNCTION storeListen_int (li_origin, li_provider, li_receiver) @@ -1184,6 +1310,13 @@ end; ' language plpgsql; +comment on function @NAMESPACE at .storeListen_int(int4,int4,int4) is +'FUNCTION storeListen_int (li_origin, li_provider, li_receiver) + +Process STORE_LISTEN event, indicating that receiver node li_receiver +listens to node li_provider in order to get messages coming from node +li_origin.'; + -- ---------------------------------------------------------------------- -- FUNCTION dropListen (li_origin, li_provider, li_receiver)
- Previous message: [Slony1-commit] By cbbrowne: Change this to look at all nodes and request function
- Next message: [Slony1-commit] By cbbrowne: Changed "conventional" port to 5432
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list