~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/include/wait_for_binlog_event.inc

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# include/wait_for_binlog_event.inc
 
2
#
 
3
# SUMMARY
 
4
#
 
5
#    Waits until SHOW BINLOG EVENTS has returned in last event a specified substring.
 
6
#
 
7
# USAGE
 
8
#
 
9
#    let $wait_binlog_event= DROP;
 
10
#    --source include/wait_for_binlog_event.inc
 
11
 
 
12
let $_loop_count= 300;
 
13
let $_last_event= ;
 
14
let $_event_pos= 1;
 
15
 
 
16
while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`)
 
17
{
 
18
  dec $_loop_count;
 
19
  if (!$_loop_count)
 
20
  {
 
21
    SHOW BINLOG EVENTS;
 
22
    --die ERROR: failed while waiting for $wait_binlog_event in binlog 
 
23
  }
 
24
  real_sleep 0.1;
 
25
  let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
 
26
  let $_last_event= $_event;
 
27
  while (`SELECT "$_event" != "No such row"`)
 
28
  {
 
29
    inc $_event_pos;
 
30
    let $_last_event= $_event;
 
31
    let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
 
32
  }
 
33
}