Module RR::ReplicationExtenders::PostgreSQLReplication
In: lib/rubyrep/replication_extenders/postgresql_replication.rb

Provides PostgreSQL specific functionality for database replication

Methods

Public Instance methods

Adds a big (8 byte value), auto-incrementing primary key column to the specified table.

  • table_name: name of the target table
  • key_name: name of the primary key column

Restores the original sequence settings. (Actually it sets the sequence increment to 1. If before, it had a different value, then the restoration will not be correct.)

  • rep_prefix: not used (necessary) for the Postgres
  • table_name: name of the table

Creates or replaces the replication trigger function. See create_replication_trigger for a descriptions of the params hash.

Creates a trigger to log all changes for the given table. params is a hash with all necessary information:

  • :trigger_name: name of the trigger
  • :table: name of the table that should be monitored
  • :keys: array of names of the key columns of the monitored table
  • :log_table: name of the table receiving all change notifications
  • :activity_table: name of the table receiving the rubyrep activity information
  • :key_sep: column seperator to be used in the key column of the log table
  • :exclude_rr_activity: if true, the trigger will check and filter out changes initiated by RubyRep

Removes a trigger and related trigger procedure.

  • trigger_name: name of the trigger
  • table_name: name of the table for which the trigger exists

Returns true if the named trigger exists for the named table.

  • trigger_name: name of the trigger
  • table_name: name of the table

Returns the schema prefix (including dot) that will be used by the triggers to write into the rubyrep infrastructure tables. To avoid setting the wrong prefix, it will only return a schema prefix if the current search path

  • consists of only a single schema
  • does not consists of a variable search path (i. e. the default "$user")

Returns all unadjusted sequences of the given table. Parameters:

  • rep_prefix: not used (necessary) for the Postgres
  • table_name: name of the table

Return value: a hash with

  • key: sequence name
  • value: a hash with
    • :increment: current sequence increment
    • :value: current value

Ensures that the sequences of the named table (normally the primary key column) are generated with the correct increment and offset.

  • rep_prefix: not used (necessary) for the Postgres
  • table_name: name of the table (not used for Postgres)
  • increment: increment of the sequence
  • offset: offset
  • left_sequence_values:
     hash as returned by #sequence_values for the left database
    
  • right_sequence_values:
     hash as returned by #sequence_values for the right database
    
  • adjustment_buffer:
     the "gap" that is created during sequence update to avoid concurrency problems
    
  1. g. an increment of 2 and offset of 1 will lead to generation of odd

numbers.

[Validate]