MySQL QA Episode 11: Valgrind Testing: Pro’s, Con’s, Why and How

MySQL QA Episode 11: Valgrind Testing: Pro’s, Con’s, Why and How

PREVIOUS POST
NEXT POST

Today’s episode is all about Valgrind – from the pro’s to the con’s, from the why to the how! This episode will be of interest to anyone who is or wants to work with Valgrind on a regular or semi-regular basis.

  1. Pro’s/Why
  2. Con’s
  3. How
    1. Using the latest version
      sudo [yum/apt-get] install valgrind
      #OR#
      sudo [yum/apt-get] remove valgrind
      sudo [yum/apt-get] install bzip2 glibc*
      wget http://valgrind.org/downloads/valgrind-3.10.1.tar.bz2
      tar -xf valgrind-3.10.1.tar.bz2; cd valgrind-3.10.1
      ./configure; make; sudo make install
      valgrind –version # This should now read 3.10.1
    2. VGDB (cd ./mysql-test)
      ./lib/v1/mysql-test-run.pl –start-and-exit –valgrind –valgrind-option=”–leak-check=yes”
      –valgrind-option=”–vgdb=yes” –valgrind-option=”–vgdb-error=0″ 1st
      #OR# valgrind –leak-check=yes –vgdb=yes –vgdb-error=0 ./mysqld –options…
      #ALSO CONSIDER# –num-callers=40 –show-reachable=yes –track-origins=yes
      gdb /Percona-server/bin/mysqld
      (gdb) target remote | vgdb
      (gdb) bt
    3. pquery Valgrind
    4. Valgrind stacks overview & analysis

Full-screen viewing @ 720p resolution recommended.

Checkout the full MySQL QA Series today!

PREVIOUS POST
NEXT POST

Share this post

Comments (5)

  • Jörg Brühe Reply

    I sure would like to follow your explanations – but I won’t install insecure stuff like Flash.
    Please: Isn’t there a safe way to publish your material?

    Regards,
    Jörg

    August 5, 2015 at 6:10 am
  • Roel Van de Paar Reply

    Hi Jörg, you mean installing Flash to watch the YouTube video? That’s not required; use the HTML5 YouTube player: https://www.youtube.com/html5 instead.

    August 5, 2015 at 11:40 pm
  • Shahriyar Rzayev Reply

    If you try to install valgrind debuginfo package and got something like:
    “debuginfo-install: command not found”
    Just install yum-utils package:
    [root@centos-base ~]# yum install yum-utils

    August 23, 2015 at 8:25 am
  • Shahriyar Rzayev Reply

    Just for a note if somebody wondering how to have a “Debug” or “Valgrind” MySQL on they own. Simply it means that you have compiled MySQL from source code with:
    -DWITH_DEBUG=1 for “Debug” build, -DWITH_VALGRIND=1 for “Valgrind” build.

    The full command will be like above for eg with MySQL 5.6.19:

    cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.6.19 -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/opt/mysql-5.6.19 -DWITH_SSL=system -DMYSQL_TCP_PORT=3307 -DMYSQL_UNIX_ADDR=/opt/mysql-5.6.19/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DCOMPILATION_COMMENT=”Shahriyar Rzayev’s Ubuntu MySQL-5.6.19″ -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1 -DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify

    Then:
    make
    make install

    You may have some problems with installing MySQL from source code. So i have noted them in our local community page:

    http://mysql.az/installing-mysql-from-source-cmake-issues/

    August 23, 2015 at 8:54 am
  • Roel Van de Paar Reply

    There’s also some build* scripts in percona-qa.

    @All, please note we have moved percona-qa to GitHub:
    https://github.com/Percona-QA/percona-qa

    To clone it, use:
    $ sudo yum install git
    $ cd ~
    $ git clone https://github.com/Percona-QA/percona-qa.git

    reducer.sh was also put directly into this repository (and it is maintained there), so *no* need anymore to separately fetch lp:randgen.

    November 26, 2015 at 1:01 am

Leave a Reply