# Which one is preferred prepare at the time of incremental backup or restore stage..

**URL:** <https://forums.percona.com/t/which-one-is-preferred-prepare-at-the-time-of-incremental-backup-or-restore-stage/3468>\
**Category:** Percona XtraBackup\
**Created:** [May 12, 2014, 9:48am UTC](https://forums.percona.com/t/which-one-is-preferred-prepare-at-the-time-of-incremental-backup-or-restore-stage/3468 "2014-05-12T09:48:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lakshma20in](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@lakshma20in](https://forums.percona.com/u/lakshma20in)\
**Post date:** [May 12, 2014, 9:48am UTC](https://forums.percona.com/t/which-one-is-preferred-prepare-at-the-time-of-incremental-backup-or-restore-stage/3468/1 "2014-05-12T09:48:55Z")

</div>

I have a Question, We take full backup on Sunday and incremental remaining days of the week. My question is regarding prepare stage to incremental, which way is preferred way, whether to apply at the time of incremental backup is taken or wait and do at the time of restore. I explored the document not able to decide which way is better.

More about the confusing problem:  
FULL BACKUP taken on SUNDAY and did --apply-log and --redo-only(doing this wright after taking the backup)  
INCR BACKUP taken on MONDAY and did --apply-log and --redo-only (doing this wright after taking the backup)  
INCR BACKUP taken on TUESDAY and did --apply-log and --redo-only ​(doing this wright after taking the backup)  
INCR BACKUP taken on WEDNESDAY and did --apply-log and --redo-only ​(doing this wright after taking the backup)  
INCR BACKUP taken on THURSDAY and did --apply-log and --redo-only ​(doing this wright after taking the backup)  
INCR BACKUP taken on FRIDAY and did --apply-log and --redo-only ​(doing this wright after taking the backup)  
INCR BACKUP taken on SATURDAY and did --apply-log only ​(doing this wright after taking the backup)

and the cycle continues, my question doing this way is better or

FULL BACKUP taken on SUNDAY and did --apply-log (doing this wright after taking the backup)  
INCR BACKUP taken on MONDAY  
INCR BACKUP taken on TUESDAY  
INCR BACKUP taken on WEDNESDAY  
INCR BACKUP taken on THURSDAY  
INCR BACKUP taken on FRIDAY  
INCR BACKUP taken on SATURDAY

Just taking the full and incremental backup on the corresponding days, --apply-log and and do prepare stage to incremental at the time of restore(i mean --apply-log and --redo-only to incremental backup). Am doing the right way or is there a technical mistake that am making while taking backup.

Am having this doubt since long please some one percona or some expert help me have the right knowledge.

Thanks  
Lakshma

---

<div class="post-metadata">

**Author:** ![mirfan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mirfan/32/16890_2.png) [@mirfan](https://forums.percona.com/u/mirfan)\
**Post date:** [May 14, 2014, 12:03am UTC](https://forums.percona.com/t/which-one-is-preferred-prepare-at-the-time-of-incremental-backup-or-restore-stage/3468/2 "2014-05-14T00:03:55Z")

</div>

The best option is to apply the logs after every incremental backup to check if the backup is ok. This is done to check the backup integrity because sometimes the apply-log process can fail and then you should discard it and run the backup again. If you don’t prepare it after every backup, you don’t know if the backup is correct or not. Also, it depends on disk requirements too. For example,

1. innobackupex --apply-log --redo-only full-backup
2. innobackupex --apply-log --redo-only full-backup --incremental-dir=INCREMENTAL-DIR-1
3. innobackupex --apply-log --redo-only full-backup --incremental-dir=INCREMENTAL-DIR-2

At this moment, full-backup will contains data up to date till 2nd incremental and after testing backup restore you can remove INCREMENTAL-DIR-1 & INCREMENTAL-DIR-2. So, this way you can save disk space too but you can’t restore to incremental 1 as your full backup is prepared till incremental 2. on the other hand, make another copy of full backup and copy it some other place and all incrementals and for consistency check you can apply logs as suggested above but it requires additional disk space. For details on preparing incremental backups check [url][Incremental Backups with innobackupex](http://www.percona.com/doc/percona-xtrabackup/2.1/innobackupex/incremental_backups_innobackupex.html#preparing-an-incremental-backup-with-innobackupex%5B/url%5D)

Hope that helps.

---

<div class="post-metadata">

**Author:** ![lakshma20in](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@lakshma20in](https://forums.percona.com/u/lakshma20in)\
**Post date:** [May 15, 2014, 9:11am UTC](https://forums.percona.com/t/which-one-is-preferred-prepare-at-the-time-of-incremental-backup-or-restore-stage/3468/3 "2014-05-15T09:11:15Z")

</div>

Thank you. I will check and update if something goes the other way.
