Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slave-user and slave-password with pt-table-checksum #381

Closed
wants to merge 4 commits into from

Conversation

tobiaspal
Copy link

When using pt-table-checksum without --sync-to-master and the DSN as the master to sync all slaves, the --slave-user and --slave-password parameters are ignored.

Steps to reproduce:

  1. Set up master-slave replication with percona-server-5.7
  2. Create a user to be used as the slave-user with a random password:
    GRANT ALL PRIVILEGES ON *.* TO 'pt-table-checks' IDENTIFIED BY 'auW2phohsiey';
    
    This user will get replicated to the slaves.
  3. Run pt-table-checksum to create the percona.checksums table:
    pt-table-checksum --slave-user=pt-table-checks --slave-password=auW2phohsiey
    
    This uses the slave-user parameter correctly and finishes successfully.
  4. Run pt-table-sync on the master with the slave-user parameter to sync the slaves to the master:
    pt-table-sync --replicate=percona.checksums --dry-run localhost
    
    This fails with:
    Cannot connect to h=10.4.28.78
    
    Because it's not using the slave-user parameter to connect to the slave.

@CLAassistant
Copy link

CLAassistant commented Dec 13, 2018

CLA assistant check
All committers have signed the CLA.

@ChristianCiach
Copy link

Please merge this! I just wasted hours trying to find out why setting the "--slave-user" option has no effect.

Copy link
Collaborator

@svetasmirnova svetasmirnova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

You modified the auto-generated code that will be removed once we run the update-modules utility. Please put your changes into the MasterSlave package instead.

@svetasmirnova
Copy link
Collaborator

Currently, you can provide a replica username and password as part of the DSN.

@svetasmirnova
Copy link
Collaborator

Other issues with the fix are:

  • options take precedence even if user and password defined in the dsns table. This could cause issues if users have, say, 10 replicas with the same user/password pairs and two with different ones.
  • you access tool options in the library code
  • there is no test case.

There is also a similar PR at #425

@svetasmirnova
Copy link
Collaborator

We will consider similar #425 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants