Class RR::Committers::BufferedCommitter
In: lib/rubyrep/committers/buffered_committer.rb
Parent: DefaultCommitter

This committer periodically commits transactions. It can be used for pre-replication syncs as it

  • updates the activity marker table.
  • switches existing triggers to filter out rubyrep activity

Methods

Constants

DEFAULT_COMMIT_FREQUENCY = 1000   Unless overwritten via configuration, transactions are commited after the given number of record changes

Public Class methods

A new committer is created for each table sync.

  • session: a Session object representing the current database session

Public Instance methods

Returns the name of the activity marker table

Begins new transactions in both databases. After starting the transaction, marks the activity of rubyrep.

Commits the open tranactions and starts new one if the commit_frequency number of record changes have been executed.

Commits the open transactions in both databases. Before committing, clears the rubyrep activity marker.

Returns the number of changes, after which the open transactions should be committed and new transactions be started.

Deletes the specified record in the specified database.

  • database: identifying the database (either :left or :right)
  • table: name of the table
  • values: a hash of column_name => value pairs (must only contain primary key columns).

Switches the trigger mode of the specified table in the specified database to ignore rubyrep activity.

  • database: identifying the database (either :left or :right)
  • table: name of the table

Is called after the last insert / update / delete query.

  • success: should be true if there were no problems, false otherwise.

Inserts the specified record in the specified database.

  • database: identifying the database (either :left or :right)
  • table: name of the table
  • values: a hash of column_name => value pairs.

Returns true if the activity marker table should be maintained.

Returns true if a new transaction was started since the last insert / update / delete.

Rolls back the open transactions in both databases.

Returns the TriggerModeSwitcher (creates it if necessary)

Updates the specified record in the specified database.

  • database: identifying the database (either :left or :right)
  • table: name of the table
  • values: a hash of column_name => value pairs.
  • old_key: A column_name => value hash identifying original primary key. If nil, then the primary key must be contained in values.

[Validate]