~bisscuitt/percona-toolkit/lsof_find

« back to all changes in this revision

Viewing changes to t/pt-online-schema-change/bugs.t

  • Committer: Frank Cizmich
  • Date: 2014-09-08 19:27:40 UTC
  • mfrom: (608.1.8 release-2.2.10)
  • Revision ID: frank.cizmich@percona.com-20140908192740-uab3exq8je1qbczh
merged release-2.2.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
{
125
125
   my $o = new OptionParser(file => "$trunk/bin/pt-table-checksum");
126
126
   $o->get_specs();
 
127
 
 
128
   $o->set('check-plan', 1);  #  check-plan is true by default
 
129
 
127
130
   no warnings;
 
131
 
128
132
   local *pt_online_schema_change::explain_statement = sub {
129
133
      return { key => 'some_key' }
130
134
   };
369
373
   "Bug 1188264: warning about expected MySQL error 1265"
370
374
);
371
375
 
 
376
 
 
377
# #############################################################################
 
378
# Issue 1315130
 
379
# Failed to detect child tables in other schema, and falsely identified
 
380
# child tables in own schema
 
381
# #############################################################################
 
382
 
 
383
$sb->load_file('master', "$sample/bug-1315130_cleanup.sql");
 
384
$sb->load_file('master', "$sample/bug-1315130.sql");
 
385
 
 
386
$output = output(
 
387
   sub { pt_online_schema_change::main(@args, "$master_dsn,D=bug_1315130_a,t=parent_table",
 
388
         '--dry-run', 
 
389
         '--alter', "add column c varchar(16)",
 
390
         '--alter-foreign-keys-method', 'auto'),
 
391
      },
 
392
);
 
393
 
 
394
   like(
 
395
         $output,
 
396
         qr/Child tables:\s*`bug_1315130_a`\.`child_table_in_same_schema` \(approx\. 1 rows\)\s*`bug_1315130_b`\.`child_table_in_second_schema` \(approx\. 1 rows\)[^`]*?Will/s,
 
397
         "Correctly identify child tables from other schemas and ignores tables from same schema referencig same named parent in other schema.",
 
398
   );
 
399
# clear databases with their foreign keys
 
400
$sb->load_file('master', "$sample/bug-1315130_cleanup.sql");  
 
401
 
 
402
 
 
403
# #############################################################################
 
404
# Issue 1340728
 
405
# fails when no index is returned in EXPLAIN,  even though --nocheck-plan is set
 
406
# (happens on HASH indexes)
 
407
# #############################################################################
 
408
 
 
409
$sb->load_file('master', "$sample/bug-1340728_cleanup.sql");
 
410
$sb->load_file('master', "$sample/bug-1340728.sql");
 
411
 
 
412
# insert a few thousand rows (else test isn't valid)
 
413
my $rows = 5000;
 
414
for (my $i = 0; $i < $rows; $i++) {
 
415
   $master_dbh->do("INSERT INTO bug_1340728.test VALUES (NULL, 'xx')");
 
416
}
 
417
 
 
418
 
 
419
$output = output(
 
420
   sub { pt_online_schema_change::main(@args, "$master_dsn,D=bug_1340728,t=test",
 
421
         '--execute', 
 
422
         '--alter', "ADD COLUMN c INT",
 
423
         '--nocheck-plan',
 
424
         ),
 
425
      },
 
426
);
 
427
 
 
428
   like(
 
429
         $output,
 
430
         qr/Successfully altered/s,
 
431
         "--nocheck-plan ignores plans without index",
 
432
   );
 
433
# clear databases 
 
434
$sb->load_file('master', "$sample/bug-1340728_cleanup.sql");  
 
435
 
372
436
# #############################################################################
373
437
# Done.
374
438
# #############################################################################