~percona-toolkit-dev/percona-toolkit/fix-1062563-1063912-ptc-pxc-bugs

« back to all changes in this revision

Viewing changes to bin/pt-table-sync

Merge fix-978133-remove-pqd-priv-checks

Show diffs side-by-side

added added

removed removed

Lines of Context:
2582
2582
      return 0;
2583
2583
   }
2584
2584
 
2585
 
   PTDEBUG && _d('Table exists; no privs to check');
2586
 
   return 1 unless $args{all_privs};
2587
 
 
2588
 
   $sql = "SHOW FULL COLUMNS FROM $db_tbl";
2589
 
   PTDEBUG && _d($sql);
2590
 
   eval {
2591
 
      $row = $dbh->selectrow_hashref($sql);
2592
 
   };
2593
 
   if ( $EVAL_ERROR ) {
2594
 
      PTDEBUG && _d($EVAL_ERROR);
2595
 
      return 0;
2596
 
   }
2597
 
   if ( !scalar keys %$row ) {
2598
 
      PTDEBUG && _d('Table has no columns:', Dumper($row));
2599
 
      return 0;
2600
 
   }
2601
 
   my $privs = $row->{privileges} || $row->{Privileges};
2602
 
 
2603
 
   $sql = "DELETE FROM $db_tbl LIMIT 0";
2604
 
   PTDEBUG && _d($sql);
2605
 
   eval {
2606
 
      $dbh->do($sql);
2607
 
   };
2608
 
   my $can_delete = $EVAL_ERROR ? 0 : 1;
2609
 
 
2610
 
   PTDEBUG && _d('User privs on', $db_tbl, ':', $privs,
2611
 
      ($can_delete ? 'delete' : ''));
2612
 
 
2613
 
   if ( !($privs =~ m/select/ && $privs =~ m/insert/ && $privs =~ m/update/
2614
 
          && $can_delete) ) {
2615
 
      PTDEBUG && _d('User does not have all privs');
2616
 
      return 0;
2617
 
   }
2618
 
 
2619
 
   PTDEBUG && _d('User has all privs');
 
2585
   PTDEBUG && _d('Table', $db, $tbl, 'exists');
2620
2586
   return 1;
 
2587
 
2621
2588
}
2622
2589
 
2623
2590
sub get_engine {