Module RR::ReplicationExtenders::MysqlReplication
In: lib/rubyrep/replication_extenders/mysql_replication.rb

Provides Mysql 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

Removes the custom sequence setup for the specified table. If no more rubyrep sequences are left, removes the sequence table.

  • 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 all unadjusted sequences of the given table. Parameters:

  • rep_prefix: The prefix put in front of all replication related database objects as specified via Configuration#options. Is used to create the sequences table.
  • 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]