Merge lp:~gl-az/percona-xtrabackup/2.1-valgrind into lp:percona-xtrabackup/2.1

Proposed by George Ormond Lorch III
Status: Work in progress
Proposed branch: lp:~gl-az/percona-xtrabackup/2.1-valgrind
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 198 lines (+97/-67)
1 file modified
utils/build.sh (+97/-67)
To merge this branch: bzr merge lp:~gl-az/percona-xtrabackup/2.1-valgrind
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Fixing
Review via email: mp+174494@code.launchpad.net

This proposal supersedes a proposal from 2013-07-12.

Description of the change

Added new environment variables to control build:
  MAKE_ONLY - Set this to 1 to only re 'make' the server and xtrabackup. Nothing will be downloaded, unpacked or patched. This is not advised if any compiler or other flags are being changed from previous builds.
  RELWITHDEBINFO - Set this to 1 to eliminate optimizations by changing C/CXXFLAGS to -g -O0 and pass CMAKE_BUILD_TYPE=RelWithDebInfo to PS or MySQL 5.5+ cmake.
  WITH_VALGRIND - Set this to 1 to perform Valgrind compatible build. Eliminates optimizations just like RELWITHDEBINFO and also passes WITH_VALGRIND=ON to PS or MySQL 5.5+ cmake.
Added innobackupex option --use-valgrind which will prefix backup and apply-log calls to xtrabackup with "valgrind".
The valgrind binary must be within path and valgrind options may be set by either using the ~/.valgrindrc file or setting the environment variable VALGRIND_OPTS.

----

Rebased to trunk and fixed typo.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.1-param/378

To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) wrote : Posted in a previous version of this proposal

This will probably conflict with https://code.launchpad.net/~stewart/percona-xtrabackup/source-dist-refactor/+merge/167709 as I've moved things about a bit with regards to downloading/unpacking things and it may have the same end result as MAKE_ONLY

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

This needs a bug/BP and rebasing on trunk (as source-dist-refactor has been merged to 2.1).

review: Needs Fixing
Revision history for this message
George Ormond Lorch III (gl-az) wrote : Posted in a previous version of this proposal
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Hm, the comments mention the new --use-valgrind option in innobackupex, but I don't see it in the code?

Which is good, because I would prefer this to be implemented in a different way. Instead of adding a new option to innobackupex we can modify the test suite to pass:

--ibbackup="valgrind xtrabackup*"

to innobackupex. And likewise, call "valgrind xtrabackup*", if the xtrabackup binary is called directly by tests.

This is a bit tricky to implement due to Bash word splitting. But the following proof-of-concept patch works for me:

=== modified file 'test/inc/common.sh'
--- test/inc/common.sh 2013-07-25 15:04:49 +0000
+++ test/inc/common.sh 2013-07-27 10:17:31 +0000
@@ -2,7 +2,7 @@ set -eu

 function innobackupex()
 {
- run_cmd $IB_BIN $IB_ARGS $*
+ run_cmd $IB_BIN "${IB_ARGS[@]}" $*
 }

 function xtrabackup()
@@ -239,7 +239,7 @@ function switch_server()
  MYSQLD_ARGS="$MYSQLD_ARGS --user=root"
     fi

- IB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf --ibbackup=$XB_BIN"
+ IB_ARGS=("--defaults-file=$MYSQLD_VARDIR/my.cnf" "--ibbackup=$XB_BIN")
     XB_ARGS="--defaults-file=$MYSQLD_VARDIR/my.cnf"

     # Some aliases for compatibility, as tests use the following names

=== modified file 'test/run.sh'
--- test/run.sh 2013-07-25 15:04:49 +0000
+++ test/run.sh 2013-07-27 10:17:40 +0000
@@ -435,7 +435,7 @@ function get_version_info()
  vlog "Cannot find '$XB_BIN' in PATH"
  return 1
     fi
- XB_BIN="$XB_PATH"
+ XB_BIN="valgrind $XB_PATH"

     # Set the correct binary for innobackupex
     IB_BIN="`which innobackupex`"

The downside is that IB_ARGS is now an array (this is required to prevent "--ibbackup=valgrind xtrabackup" as 2 different words), so all tests referencing IB_ARGS also have to be modified. But I like it more than another option to innobackupex.

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Having a Blueprint for this work would also be nice.

Unmerged revisions

629. By George Ormond Lorch III

Added new environment variables to control build:
  MAKE_ONLY - Set this to 1 to only re 'make' the server and xtrabackup. Nothing will be downloaded, unpacked or patched. This is not advised if any compiler or other flags are being changed from previous builds.
  RELWITHDEBINFO - Set this to 1 to eliminate optimizations by changing C/CXXFLAGS to -g -O0 and pass CMAKE_BUILD_TYPE=RelWithDebInfo to PS or MySQL 5.5+ cmake.
  WITH_VALGRIND - Set this to 1 to perform Valgrind compatible build. Eliminates optimizations just like RELWITHDEBINFO and also passes WITH_VALGRIND=ON to PS or MySQL 5.5+ cmake.
Added innobackupex option --use-valgrind which will prefix backup and apply-log calls to xtrabackup with "valgrind".
The valgrind binary must be within path and valgrind options may be set by either using the ~/.valgrindrc file or setting the environment variable VALGRIND_OPTS.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'utils/build.sh'
--- utils/build.sh 2013-06-05 08:39:54 +0000
+++ utils/build.sh 2013-07-12 20:00:37 +0000
@@ -35,8 +35,20 @@
35 ;;35 ;;
36esac36esac
3737
38if [ -n "$WITH_VALGRIND" ]
39then
40 export CFLAGS="$CFLAGS -g -O0"
41 export CXXFLAGS="$CXXFLAGS -g -O0"
42 extra_config_51=
43 extra_config_55plus="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_VALGRIND=ON"
44elif [ -n "$RELWITHDEBINFO" ]
45then
46 export CFLAGS="$CFLAGS -g -O0"
47 export CXXFLAGS="$CXXFLAGS -g -O0"
48 extra_config_51=
49 extra_config_55plus="-DCMAKE_BUILD_TYPE=RelWithDebInfo"
38# Percona Server 5.5 does not build with -Werror, so ignore DEBUG for now50# Percona Server 5.5 does not build with -Werror, so ignore DEBUG for now
39if [ -n "$DEBUG" -a "$type" != "xtradb55" -a "$type" != "xtradb51" ]51elif [ -n "$DEBUG" -a "$type" != "xtradb55" -a "$type" != "xtradb51" ]
40then52then
41 # InnoDB extra debug flags53 # InnoDB extra debug flags
42 innodb_extra_debug="-DUNIV_DEBUG -DUNIV_MEM_DEBUG \54 innodb_extra_debug="-DUNIV_DEBUG -DUNIV_MEM_DEBUG \
@@ -219,14 +231,17 @@
219 server_tarball=mysql-$mysql_version.tar.gz231 server_tarball=mysql-$mysql_version.tar.gz
220 innodb_dir=$server_dir/storage/$innodb_name232 innodb_dir=$server_dir/storage/$innodb_name
221233
222 echo "Downloading sources"234 if [ -z "$MAKE_ONLY" ]
223 auto_download $server_tarball235 then
224236 echo "Downloading sources"
225 test -d $server_dir && rm -r $server_dir237 auto_download $server_tarball
226238
227 echo "Preparing sources"239 test -d $server_dir && rm -r $server_dir
228 unpack_and_patch $server_tarball $server_patch240
229 mv $top_dir/mysql-$mysql_version $server_dir241 echo "Preparing sources"
242 unpack_and_patch $server_tarball $server_patch
243 mv $top_dir/mysql-$mysql_version $server_dir
244 fi
230245
231 build_server $type246 build_server $type
232247
@@ -302,35 +317,43 @@
302 fi317 fi
303318
304319
305 echo "Downloading sources"320 if [ -z "$MAKE_ONLY" ]
321 then
322 echo "Downloading sources"
306 323
307 # Get Percona Server324 # Get Percona Server
308 if [ -d $branch_dir ]325 if [ -d $branch_dir ]
309 then326 then
310 rm -rf $branch_dir327 rm -rf $branch_dir
311 fi328 fi
312329
313 if [ ! -f Percona-Server-XtraBackup-$PS_51_VERSION.tar.gz ]330 if [ ! -f Percona-Server-XtraBackup-$PS_51_VERSION.tar.gz ]
314 then331 then
315 make ps51source332 make ps51source
316 fi333 fi
317334
318 rm -rf $branch_dir335 rm -rf $branch_dir
319 tar xfz Percona-Server-XtraBackup-$PS_51_VERSION.tar.gz336 tar xfz Percona-Server-XtraBackup-$PS_51_VERSION.tar.gz
320 cd $branch_dir337 cd $branch_dir
321 $MAKE_CMD main338 $MAKE_CMD main
322 cd $top_dir339 cd $top_dir
323 rm -rf $server_dir340 rm -rf $server_dir
324 ln -s $branch_dir/Percona-Server $server_dir341 ln -s $branch_dir/Percona-Server $server_dir
325342
326 # Patch Percona Server343 # Patch Percona Server
327 cd $server_dir344 cd $server_dir
328 patch -p1 < $top_dir/patches/xtradb51.patch345 patch -p1 < $top_dir/patches/xtradb51.patch
329346
330 build_server $type347 build_server $type
331348
332 build_xtrabackup349 build_xtrabackup
333350 else
351 cd $server_dir
352
353 build_server $type
354
355 build_xtrabackup
356 fi
334 ;;357 ;;
335"xtradb55" )358"xtradb55" )
336 server_dir=$top_dir/Percona-Server-5.5359 server_dir=$top_dir/Percona-Server-5.5
@@ -350,37 +373,44 @@
350 configure_cmd="LIBS=-lrt $configure_cmd"373 configure_cmd="LIBS=-lrt $configure_cmd"
351 fi374 fi
352375
353376 if [ -z "$MAKE_ONLY" ]
354 echo "Downloading sources"377 then
378 echo "Downloading sources"
355 379
356 # Get Percona Server380 # Get Percona Server
357 if [ -d $branch_dir ]381 if [ -d $branch_dir ]
358 then382 then
359 rm -rf $branch_dir383 rm -rf $branch_dir
360 fi384 fi
361385
362 if [ ! -f Percona-Server-XtraBackup-$PS_55_VERSION.tar.gz ]386 if [ ! -f Percona-Server-XtraBackup-$PS_55_VERSION.tar.gz ]
363 then387 then
364 make ps55source388 make ps55source
365 fi389 fi
366390
367 rm -rf $branch_dir391 rm -rf $branch_dir
368 tar xfz Percona-Server-XtraBackup-$PS_55_VERSION.tar.gz392 tar xfz Percona-Server-XtraBackup-$PS_55_VERSION.tar.gz
369 cd $branch_dir393 cd $branch_dir
370394
371 $MAKE_CMD PERCONA_SERVER=Percona-Server-5.5 main395 $MAKE_CMD PERCONA_SERVER=Percona-Server-5.5 main
372 cd $top_dir396 cd $top_dir
373 rm -rf $server_dir397 rm -rf $server_dir
374 ln -s $branch_dir/Percona-Server $server_dir398 ln -s $branch_dir/Percona-Server $server_dir
375399
376 # Patch Percona Server400 # Patch Percona Server
377 cd $server_dir401 cd $server_dir
378 patch -p1 < $top_dir/patches/xtradb55.patch402 patch -p1 < $top_dir/patches/xtradb55.patch
379403
380 build_server $type404 build_server $type
381405
382 build_xtrabackup406 build_xtrabackup
383407 else
408 cd $server_dir
409
410 build_server $type
411
412 build_xtrabackup
413 fi
384 ;;414 ;;
385*)415*)
386 usage416 usage

Subscribers

People subscribed via source and target branches