# Restore backup on a replica - still need to set gtid\_purged?

**URL:** <https://forums.percona.com/t/restore-backup-on-a-replica-still-need-to-set-gtid-purged/37031>\
**Category:** Percona XtraBackup\
**Created:** [March 4, 2025, 6:39am UTC](https://forums.percona.com/t/restore-backup-on-a-replica-still-need-to-set-gtid-purged/37031 "2025-03-04T06:39:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charly\_Wu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/charly_wu/32/16997_2.png) [@Charly\_Wu](https://forums.percona.com/u/Charly_Wu)\
**Post date:** [March 4, 2025, 6:39am UTC](https://forums.percona.com/t/restore-backup-on-a-replica-still-need-to-set-gtid-purged/37031/1 "2025-03-04T06:39:44Z")

</div>

In [How to create a new (or repair a broken) GTID-based replica](https://docs.percona.com/percona-xtrabackup/8.0/create-gtid-replica.html) in step 4:

> Set the gtid\_purged variable to the GTID from xtrabackup\_binlog\_info. Then, update the information about the source node and, finally, start the replica.

After restoring from a backup in a replica, I found that the `Executed_Gtid_Set` is set and the value matches the one in `xtrabackup_binlog_info` in the backup folder.

Then, I continue with the following, without setting `gtid_purged` first.

```auto
> CHANGE REPLICATION SOURCE TO
             SOURCE_HOST="$masterip",
             SOURCE_USER="repl",
             SOURCE_PASSWORD="$slavepass",
             SOURCE_AUTO_POSITION = 1;
> START REPLICA;

```

and the replication was able to proceed without any error.

Do I still need to perform this?  
`SET GLOBAL gtid_purged='<gtid_string_found_in_xtrabackup_binlog_info>';` before `CHANGE REPLICATION SOURCE` and `START REPLICA`?

---

<div class="post-metadata">

**Author:** ![satya.bodapati](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/satya.bodapati/32/1322_2.png) [@satya.bodapati](https://forums.percona.com/u/satya.bodapati)\
**Post date:** [March 6, 2025, 12:57pm UTC](https://forums.percona.com/t/restore-backup-on-a-replica-still-need-to-set-gtid-purged/37031/2 "2025-03-06T12:57:48Z")

</div>

Yes, it is recommended to use SET gtid\_purged because the backup directory doesn’t contain all the gtids/binlog files before the position/gtids recorded by xtrabackup.

xtrabackup doesn’t copy all the binlog files. So we should tell the server, that the start point of binlog/gtids is the position recorded in xtrabackup binlog\_info files.
