Commit 3e96515f authored by Artyom Kartasov's avatar Artyom Kartasov

Merge branch 'last-snapshot-time' into 'master'

Skip taking a new snapshot if there is no new data:
Check the last snapshot time in the create snapshot script and compare with the current `data_state_at` 

See merge request !106
parents b0a69abf 705cac3e
Pipeline #146454253 passed with stages
in 4 minutes and 14 seconds
......@@ -215,6 +215,15 @@ else
data_state_at=$(TZ=UTC date '+%Y%m%d%H%M%S')
# Check if there is no new data.
last_snapshot_time=$(sudo zfs list -t snapshot -r dblab_pool_replica -H -o dblab:datastateat -S dblab:datastateat -S creation | head -1)
if [[ ! -z ${last_snapshot_time+x} && ${last_snapshot_time} -ge ${data_state_at} ]]; then
echo >&2 -e "\e[32mThe last existing snapshot already contains the latest data. Skip taking a new snapshot.\e[0m"
exit 0
# Promote to the master. Again, it may take a while.
if [[ $should_be_promoted == "t" ]]; then
echo >&2 "Promote"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment