improve pitr test
ADD
e2e-tests/pitr/compare/select-5.sql
+100500
+100501
+100502
+100503
+100504
+100505
+100506
+100507
+100508
+100509
+100510

ADD
e2e-tests/pitr/conf/on-pitr-minio1.yml
+apiVersion: pxc.percona.com/v1
+kind: PerconaXtraDBClusterBackup
+metadata:
+ name: on-pitr-minio1
+spec:
+ pxcCluster: pitr
+ storageName: minio

MODIFY
e2e-tests/pitr/conf/pitr.yml
e2e-tests/pitr/conf/pitr.yml
@@ -61,7 +61,7 @@ spec:
pitr:
enabled: true
storageName: minio-binlogs
- timeBetweenUploads: 60
+ timeBetweenUploads: 55
storages:
pvc:
type: filesystem

ADD
e2e-tests/pitr/conf/restore-on-pitr-minio1.yaml
+apiVersion: pxc.percona.com/v1
+kind: PerconaXtraDBClusterRestore
+metadata:
+ name: on-pitr-minio1
+spec:
+ pxcCluster: pitr
+ backupSource:
+ destination: <destination>
+ s3:
+ bucket: operator-testing
+ credentialsSecret: minio-secret
+ endpointUrl: http://minio-service:9000
+ region: us-east-1
+ pitr:
+ type: latest
+ backupSource:
+ s3:
+ bucket: operator-testing/binlogs
+ credentialsSecret: minio-secret
+ endpointUrl: http://minio-service:9000
+ region: us-east-1
+

MODIFY
e2e-tests/pitr/run
e2e-tests/pitr/run
@@ -70,7 +70,7 @@ write_test_data() {
}
-write_more_data() {
+write_data_for_pitr() {
local cluster=$1
local proxy=$(get_proxy "$cluster")
@@ -79,6 +79,15 @@ write_more_data() {
"-h $proxy -uroot -proot_password"
}
+write_more_data() {
+ local cluster=$1
+ local proxy=$(get_proxy "$cluster")
+
+ run_mysql \
+ 'INSERT test.test (id) VALUES (100506); INSERT test.test (id) VALUES (100507); INSERT test.test (id) VALUES (100508); INSERT test.test (id) VALUES (100509); INSERT test.test (id) VALUES (100510);' \
+ "-h $proxy -uroot -proot_password"
+}
+
main() {
create_infra $namespace
start_minio
@@ -95,7 +104,7 @@ main() {
gtid=$(run_mysql "SHOW BINLOG EVENTS IN 'binlog.000005';" "-h $proxy -uroot -proot_password" | grep Gtid | tail -c 43)
sleep 60
- write_more_data "$cluster"
+ write_data_for_pitr "$cluster"
sleep 80 # need to wait while collector catch new data
kubectl patch pxc pitr --type=merge -p '{"spec":{"backup":{"pitr":{"enabled":false}}}}'
@@ -109,6 +118,15 @@ main() {
run_recovery_check_pitr "$cluster" "restore-on-pitr-minio" "on-pitr-minio" "select-4" "" "$dest" ""
echo "done latest type"
+ desc 'check if we restore data from binlogs'
+ kubectl patch pxc pitr --type=merge -p '{"spec":{"backup":{"pitr":{"enabled":true}}}}'
+ sleep 20
+ run_backup "$cluster" "on-pitr-minio1"
+ write_more_data "$cluster"
+ dest=$(sed 's,/,\\/,g' <<<$(kubectl get pxc-backup on-pitr-minio1 -o jsonpath='{.status.destination}'))
+ sleep 80 # need to wait while collector catch new data
+ run_recovery_check_pitr "$cluster" "restore-on-pitr-minio1" "on-pitr-minio1" "select-5" "" "$dest" ""
+
destroy $namespace
}

improve pitr test