Created by Daniel Nichter and last modified

Major changes to VersionCheck.pm:

1) No more $self anywhere. The entire package is procedural.

2) version_check() adds a special instance for the system with id=0.

3) Because of #2, there's no need to check the vc file's mtime; we only need to check every line, i.e. every instance. in the vc file.

4) The vc file is now gotten via version_check_file() and it prefers to be in global dirs like /etc/percona, etc. This way, every user on the system will use the same vc file is possible because some system use random /tmp dirs which means the vc file would always be new, and we don't want that.

5) get_perl_module_version() uses eval "<code snippet>" because unless, for example, the program has already done "use DBD::mysql;" (but none of them do), then $DBD::mysql::VERSION will not be available.

6) If IO::Socket::SSL is installed, we use https; else, use http. Trying both protocols could result in a double wait if https works but v.percona.com isn't responding, in which case, since we don't see what the error is/was, we would blindly try http too when it has no chance of succeeding either. So: 1 protocol, 1 chance at success.

7) Removed PTVCDEBUG and added PTDBUG_VERSION_CHECK instead to make version_check() die 255 when done, so we can do things like "PTDEBUG=1 PTDEBUG_VERSION_CHECK=1 pt-query-digest" and have the tool stop right after v-c stuff.

Get this branch:
bzr branch lp:~percona-toolkit-dev/percona-toolkit/enable-version-check-by-default
Members of Percona Toolkit developers can upload to this branch. Log in for directions.

Branch merges

Related bugs

Related blueprints

Recent revisions

539. By Daniel Nichter

Check for ../../.bzr for when a tool is ran as a module in a test.

538. By Daniel Nichter

Add force => ->got('version-check') to tools.

537. By Daniel Nichter

Update t/pt-query-digest/version_check.t.

536. By Daniel Nichter

Update VersionCheck in all tools.

535. By Daniel Nichter

Test that --version-check works/is enabled by default.

534. By Daniel Nichter

Simplify checking for .bzr/ to auto-disable --version-check in dev and test envs. Update t/pt-archiver/version_check.t. Need to update all other tools...

533. By Brian Fraser

VersionCheck: Skip running if called from our bzr repo

532. By Daniel Nichter

Don't try https and http: use https if possible, else http. Lower timeout from 5 to 3 seconds. Start updating/fixing pt-archiver/version_check.t.

531. By Daniel Nichter

Make util/test-env require /etc/percona-toolkit/percona-toolkit.conf have no-version-check.

530. By Daniel Nichter

Change version_check_file() to prefer global system dirs first.

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
This branch contains Public information 
Everyone can see this information.