~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/replication/helpers.py

Undo rename. Again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
        self.table_id, self.replication_set_id, self.master_node_id = row
146
146
 
147
147
 
148
 
def sync(timeout, exit_on_fail=True):
 
148
def sync(timeout):
149
149
    """Generate a sync event and wait for it to complete on all nodes.
150
150
 
151
151
    This means that all pending events have propagated and are in sync
154
154
 
155
155
    :param timeout: Number of seconds to wait for the sync. 0 to block
156
156
                    indefinitely.
157
 
 
158
 
    :param exit_on_fail: If True, on failure of the sync
159
 
                         SystemExit is raised using the slonik return code.
160
 
 
161
 
    :returns: True if the sync completed successfully. False if
162
 
              exit_on_fail is False and the script failed for any reason.
163
157
    """
164
 
    return execute_slonik("", sync=timeout, exit_on_fail=exit_on_fail)
 
158
    return execute_slonik("", sync=timeout)
165
159
 
166
160
 
167
161
def execute_slonik(script, sync=None, exit_on_fail=True, auto_preamble=True):
320
314
    """Return the preable needed at the start of all slonik scripts."""
321
315
 
322
316
    if con is None:
323
 
        con = connect(user='slony')
 
317
        con = connect('slony')
324
318
 
325
319
    master_node = get_master_node(con)
326
320
    nodes = get_all_cluster_nodes(con)