Skip to content

Commit

Permalink
add new backup dump parameter maxallowedpacket
Browse files Browse the repository at this point in the history
  • Loading branch information
cfasnacht committed Jun 21, 2016
1 parent 52477c0 commit e733df7
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ Sets the server backup implementation. Valid values are:
* `mysqlbackup`: Implements backups with MySQL Enterprise Backup from Oracle. Backup type: Physical. To use this type of backup, you'll need the `meb` package, which is available in RPM and TAR formats from Oracle. For Ubuntu, you can use [meb-deb](https://github.com/dveeden/meb-deb) to create a package from an official tarball.
* `xtrabackup`: Implements backups with XtraBackup from Percona. Backup type: Physical.

##### `maxallowedpacket`

Define the maximum SQL statement size for the backup dump script. The default value is 1MB as this is the default Mysql Server value.

#### mysql::server::monitor

##### `mysql_monitor_username`
Expand Down
1 change: 1 addition & 0 deletions manifests/backup/mysqlbackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class mysql::backup::mysqlbackup (
$backupuser = '',
$backuppassword = '',
$maxallowedpacket = '1M',
$backupdir = '',
$backupdirmode = '0700',
$backupdirowner = 'root',
Expand Down
1 change: 1 addition & 0 deletions manifests/backup/mysqldump.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$backupuser = '',
$backuppassword = '',
$backupdir = '',
$maxallowedpacket = '1M',
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = $mysql::params::root_group,
Expand Down
1 change: 1 addition & 0 deletions manifests/backup/xtrabackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$backupuser = '',
$backuppassword = '',
$backupdir = '',
$maxallowedpacket = '1M',
$backupmethod = 'mysqldump',
$backupdirmode = '0700',
$backupdirowner = 'root',
Expand Down
2 changes: 2 additions & 0 deletions manifests/server/backup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$postscript = false,
$execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
$provider = 'mysqldump',
$maxallowedpacket = '1M',
) {

if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ {
Expand Down Expand Up @@ -47,6 +48,7 @@
'prescript' => $prescript,
'postscript' => $postscript,
'execpath' => $execpath,
'maxallowedpacket' => $maxallowedpacket,
}
})

Expand Down
2 changes: 2 additions & 0 deletions spec/classes/mysql_server_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
let(:default_params) {
{ 'backupuser' => 'testuser',
'backuppassword' => 'testpass',
'maxallowedpacket' => '1M',
'backupdir' => '/tmp',
'backuprotate' => '25',
'delete_before_dump' => true,
'execpath' => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
'maxallowedpacket' => '1M',
}
}

Expand Down
3 changes: 2 additions & 1 deletion templates/mysqlbackup.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

USER=<%= @backupuser %>
PASS='<%= @backuppassword %>'
MAX_ALLOWED_PACKET=<%= @maxallowedpacket %>
DIR=<%= @backupdir %>
ROTATE=<%= [ Integer(@backuprotate) - 1, 0 ].max %>

# Create temporary mysql cnf file.
TMPFILE=`mktemp /tmp/backup.XXXXXX` || exit 1
echo -e "[client]\npassword=$PASS\nuser=$USER" > $TMPFILE
echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE

# Ensure backup directory exist.
mkdir -p $DIR
Expand Down

0 comments on commit e733df7

Please sign in to comment.