| 1 |
# |
| 2 |
# Check if event exists for table |
| 3 |
# |
| 4 |
# Arguments: |
| 5 |
# check_event_tabname - name of table |
| 6 |
# check_event_dbname - db of table |
| 7 |
# [check_event_full - expect a full event] |
| 8 |
# |
| 9 |
# |
| 10 |
|
| 11 |
if (!$check_event_tabname) |
| 12 |
{ |
| 13 |
die Need the name of table to check event for; |
| 14 |
} |
| 15 |
|
| 16 |
if (!$check_event_dbname) |
| 17 |
{ |
| 18 |
die Need the db of table to check event for; |
| 19 |
} |
| 20 |
|
| 21 |
# |
| 22 |
# The name for an event has form REPL[F]$<db>/<table_name> |
| 23 |
# - the additional F is used when table should be binlogged |
| 24 |
# with "full" rows |
| 25 |
# |
| 26 |
let $event_prefix = REPL; |
| 27 |
if ($check_event_full) |
| 28 |
{ |
| 29 |
let $event_prefix = REPLF; |
| 30 |
} |
| 31 |
# Expected event name, includes extra escape for the dollar |
| 32 |
# sign avoiding that mysqltest evaluates it before sending the query |
| 33 |
let $expected_event_name = |
| 34 |
$event_prefix\\\$$check_event_dbname/$check_event_tabname; |
| 35 |
#echo expected_event_name: $expected_event_name; |
| 36 |
let $found_event = `SELECT count(*) FROM ndbinfo.events |
| 37 |
WHERE name = '$expected_event_name'`; |
| 38 |
if ($found_event) |
| 39 |
{ |
| 40 |
echo Found event for '$check_event_dbname.$check_event_tabname'; |
| 41 |
|
| 42 |
# |
| 43 |
# Check how report options for the event is configured. Use the 'reporting' |
| 44 |
# column of ndbinfo.events which is a SET that correspond to the flags |
| 45 |
# describing what should be reported |
| 46 |
let $reporting = `SELECT reporting FROM ndbinfo.events |
| 47 |
WHERE name = '$expected_event_name'`; |
| 48 |
echo Report flags: '$reporting'; |
| 49 |
|
| 50 |
} |
| 51 |
if (!$found_event) |
| 52 |
{ |
| 53 |
echo No event found for '$check_event_dbname.$check_event_tabname'; |
| 54 |
} |
| 55 |
|
| 56 |
# Reset args |
| 57 |
let $check_event_tabname = ; |
| 58 |
let $check_event_dbname = ; |
| 59 |
let $check_event_full = ; |
| 60 |
|
| 61 |
--enable_query_log |