forked from wal-g/wal-g
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix mysql copy * fix tests && and more tests * configuration from conf fix * fix path incorrect concatinations + fmt & tests Co-authored-by: reshke <Kirill Reshke>
- Loading branch information
Showing
43 changed files
with
262 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
rm -rf tmp/ | ||
rm -rf vendor/github.com/google/brotli/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
# test tools | ||
mysql_kill_and_clean_data() { | ||
kill -9 "$(pidof mysqld)" || true | ||
rm -rf "${MYSQLDATA}"/* | ||
rm -rf "${MYSQLDATA}"/.tmp | ||
rm -rf /root/.walg_mysql_binlogs_cache | ||
} | ||
|
||
mysql_set_gtid_purged() { | ||
gtids=$(tr -d '\n' < /var/lib/mysql/xtrabackup_binlog_info | awk '{print $3}') | ||
echo "Gtids from backup $gtids" | ||
mysql -e "RESET MASTER; SET @@GLOBAL.GTID_PURGED='$gtids';" | ||
} | ||
|
||
sysbench() { | ||
/usr/bin/sysbench --verbosity=0 /usr/share/sysbench/oltp_insert.lua "$@" | ||
} | ||
|
||
date3339() { | ||
date --rfc-3339=ns | sed 's/ /T/' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh | ||
set -e -x | ||
|
||
. /usr/local/export_test_funcs.sh | ||
|
||
# https://github.com/wal-g/wal-g/issues/790 | ||
## ensure correct conf option will overwrite this trash | ||
#export AWS_ENDPOINT=we23i902309239 | ||
|
||
cat > /root/conf.yaml <<EOH | ||
WALE_S3_PREFIX: s3://mysqlconfonly | ||
AWS_ENDPOINT: http://s3:9000 | ||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE | ||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | ||
WALG_S3_MAX_PART_SIZE: 5242880 | ||
WALG_STREAM_RESTORE_COMMAND: "xbstream -x -C ${MYSQLDATA}" | ||
WALG_MYSQL_BACKUP_PREPARE_COMMAND: "xtrabackup --prepare --target-dir=${MYSQLDATA}" | ||
WALG_MYSQL_BINLOG_REPLAY_COMMAND: 'mysqlbinlog --stop-datetime="$WALG_MYSQL_BINLOG_END_TS" "$WALG_MYSQL_CURRENT_BINLOG" | mysql' | ||
WALG_MYSQL_BINLOG_DST: /tmp | ||
WALG_MYSQL_DATASOURCE_NAME: sbtest:@/sbtest | ||
WALG_STREAM_CREATE_COMMAND: "xtrabackup --backup \ | ||
--stream=xbstream \ | ||
--user=sbtest \ | ||
--host=localhost \ | ||
--parallel=2 \ | ||
--datadir=${MYSQLDATA}" | ||
EOH | ||
|
||
mysqld --initialize --init-file=/etc/mysql/init.sql | ||
service mysql start | ||
mysql mysql -e 'create table testt1(i int)' | ||
|
||
export NAME | ||
NAME=$(wal-g backup-push --config=/root/conf.yaml 2>&1 | grep -oe 'stream_[0-9]*T[0-9]*Z') | ||
|
||
mysql_kill_and_clean_data | ||
|
||
wal-g backup-fetch "$NAME" --config=/root/conf.yaml | ||
|
||
chown -R mysql:mysql "$MYSQLDATA" | ||
service mysql start || (cat /var/log/mysql/error.log && false) | ||
mysql mysql -e 'show tables' | grep testt1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
set -e -x | ||
|
||
. /usr/local/export_common.sh | ||
|
||
mysqld --initialize --init-file=/etc/mysql/init.sql | ||
service mysql start | ||
mysql mysql -e 'create table testt1(i int)' | ||
|
||
cat > /root/from.yaml <<EOH | ||
WALE_S3_PREFIX: "s3://mysqlcopybackupfrom" | ||
AWS_ENDPOINT: "http://s3:9000" | ||
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" | ||
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" | ||
WALG_S3_MAX_PART_SIZE: 5242880 | ||
EOH | ||
|
||
cat > /root/to.yaml <<EOH | ||
WALE_S3_PREFIX: "s3://mysqlcopybackupto" | ||
AWS_ENDPOINT: "http://s3:9000" | ||
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" | ||
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" | ||
WALG_S3_MAX_PART_SIZE: 5242880 | ||
EOH | ||
|
||
wal-g delete everything FORCE --confirm --config=/root/from.yaml | ||
wal-g delete everything FORCE --confirm --config=/root/to.yaml | ||
|
||
export NAME | ||
NAME=$(wal-g backup-push --config=/root/from.yaml 2>&1 | grep -oe 'stream_[0-9]*T[0-9]*Z') | ||
|
||
sleep 1 | ||
|
||
echo "$NAME" | ||
|
||
wal-g backup-list --config=/root/from.yaml | ||
wal-g backup-list --config=/root/to.yaml | ||
|
||
wal-g copy --from=/root/from.yaml --to=/root/to.yaml --backup "$NAME" | ||
|
||
mysql_kill_and_clean_data | ||
|
||
wal-g backup-fetch "$NAME" --config=/root/to.yaml | ||
|
||
chown -R mysql:mysql "$MYSQLDATA" | ||
service mysql start || (cat /var/log/mysql/error.log && false) | ||
mysql mysql -e 'show tables' | grep testt1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.