Skip to content

Commit 13d2ecb

Browse files
committed
K8SPSMDB-1396: use write_time for restore to date check
1 parent a215cd4 commit 13d2ecb

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

e2e-tests/functions

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ write_document() {
17441744
local cmp_postfix="$1"
17451745
local sleep_value=${2:-0}
17461746

1747-
desc 'write initial data, read from all'
1747+
log 'write initial data, read from all'
17481748
run_mongos \
17491749
'use myApp\n db.test.insert({ x: 100500 })' \
17501750
"myApp:myPass@$cluster-mongos.$namespace"
@@ -1861,6 +1861,8 @@ check_recovery() {
18611861
echo
18621862
set -o xtrace
18631863

1864+
wait_for_running $cluster-rs0 3
1865+
wait_for_running $cluster-cfg 3
18641866
wait_for_running $cluster-mongos 3
18651867
sleep 10
18661868

e2e-tests/pitr-physical/run

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ main() {
4141
wait_for_running $cluster-cfg 3 "false"
4242
sleep 10
4343

44+
desc "write data"
45+
4446
write_initial_data
4547
write_document
4648

49+
desc "wait for pbm agents to start"
50+
4751
wait_backup_agent $cluster-rs0-0
4852
wait_backup_agent $cluster-rs0-1
4953
wait_backup_agent $cluster-rs0-2
@@ -54,27 +58,29 @@ main() {
5458
wait_backup_agent $cluster-rs2-1
5559
wait_backup_agent $cluster-rs2-2
5660

57-
# The sleep is needed to workaround a bug in PBM, check PBM-1265 for more info
58-
echo "Sleeping for 360 seconds"
61+
log "Sleeping for 360 seconds to avoid PBM-1265"
5962
sleep 360
6063

6164
backup_name_minio="backup-minio"
6265
run_backup $backup_name_minio 2 physical
6366

64-
write_document "-2nd" '130'
67+
write_document "-2nd" '120'
6568

66-
backup_last_write=$(kubectl_bin exec $cluster-rs0-0 -c backup-agent -- pbm status -o json | jq .backups.snapshot[0].restoreTo)
69+
last_write=$(date +%s)
6770
last_chunk=$(get_latest_oplog_chunk_ts $cluster)
6871

72+
log "last write: ${last_write}"
73+
log "last chunk: ${last_chunk}"
74+
6975
retries=0
70-
until [[ ${last_chunk} -gt ${backup_last_write} ]]; do
76+
until [[ ${last_chunk} -gt ${last_write} ]]; do
7177
if [[ $retries -gt 30 ]]; then
72-
echo "Last oplog chunk ($(format_date ${last_chunk})) is not greater than last write ($(format_date ${backup_last_write}))"
78+
echo "Last oplog chunk ($(format_date ${last_chunk})) is not greater than last write ($(format_date ${last_write}))"
7379
exit 1
7480
fi
7581
last_chunk=$(get_latest_oplog_chunk_ts $cluster)
7682
retries=$((retries + 1))
77-
echo "Waiting for last oplog chunk ($(format_date ${last_chunk})) to be greater than last write ($(format_date ${backup_last_write}))"
83+
log "Waiting for last oplog chunk ($(format_date ${last_chunk})) to be greater than last write ($(format_date ${last_write}))"
7884
sleep 10
7985
done
8086

0 commit comments

Comments
 (0)