You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if [[ "$next_diff_backup_base_lsn"="NULL" ]] || [[ "$next_diff_backup_base_lsn"=="" ]];then
217
+
ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the base LSN for the next diff backup couldn't be determined"
218
+
backup_type="full"
219
+
break
220
+
fi
221
+
222
+
# The base of the diff backup we're about to take must exactly match the checkpoint LSN of the full backup file we have
223
+
if [[ "$next_diff_backup_base_lsn"-ne"$full_backup_file_checkpoint_lsn" ]];then
224
+
ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the diff would have base LSN $next_diff_backup_base_lsn yet our full backup has checkpoint LSN $full_backup_file_checkpoint_lsn"
225
+
backup_type="full"
226
+
break
227
+
fi
228
+
fi
229
+
230
+
# Ensure that a transaction log backup will immediately follow the previous one
if [[ "$next_log_backup_starting_lsn"="NULL" ]] || [[ "$next_log_backup_starting_lsn"=="" ]];then
247
+
ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db the starting LSN for the next log backup couldn't be determined"
248
+
backup_type="full"
249
+
break
250
+
fi
251
+
252
+
# The starting LSN of the backup we're about to take must be equal to (or before) the last LSN from the last backup,
253
+
# otherwise there'll be a gap and the logfiles won't be restorable
254
+
if [[ "$next_log_backup_starting_lsn"-gt"$latest_log_backup_last_lsn" ]];then
255
+
ghe_verbose "Taking a full backup instead of a $backup_type backup because for $db a gap would exist between the last backup ending at LSN $latest_log_backup_last_lsn and next backup starting at $next_log_backup_starting_lsn"
256
+
backup_type="full"
257
+
break
258
+
fi
259
+
done
260
+
fi
144
261
fi
145
262
146
263
# Make sure root backup dir exists if this is the first run
147
264
mkdir -p "$backup_dir"
148
265
149
-
#Create hard links to save disk space and time
266
+
#Use hard links to "copy" over previous applicable backups to the new snapshot folder to save disk space and time
150
267
if [ -d$last_mssql ];then
151
268
forpin$last_mssql/*
152
269
do
@@ -156,15 +273,18 @@ if [ -d $last_mssql ]; then
156
273
extension="${filename##*.}"
157
274
transfer=
158
275
159
-
if [ $extension="bak" ] && [ -z$take_full ];then
276
+
# Copy full backups unless we're taking a new full backup
277
+
if [ $extension="bak" ] && [ "$backup_type"!='full' ];then
0 commit comments