# \`fdbdr\` failover duration longer than expected

**URL:** <https://forums.foundationdb.org/t/fdbdr-failover-duration-longer-than-expected/3269>\
**Category:** Running FoundationDB\
**Created:** [April 19, 2022, 3:22pm UTC](https://forums.foundationdb.org/t/fdbdr-failover-duration-longer-than-expected/3269 "2022-04-19T15:22:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanworl](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ryanworl/32/440_2.png) [@ryanworl](https://forums.foundationdb.org/u/ryanworl)\
**Post date:** [April 19, 2022, 3:22pm UTC](https://forums.foundationdb.org/t/fdbdr-failover-duration-longer-than-expected/3269/1 "2022-04-19T15:22:46Z")

</div>

We are using `fdbdr` to fail over between two clusters in order to change the hardware configuration and reduce the cluster size from 15 nodes to 9 nodes with a different FDB class topology. The original cluster and new cluster are not anywhere close to saturated by the workload.

Our application code is configured to know about a “primary” and “secondary” cluster for a given logical cluster name. If the application code sees the “database is locked” error, it retries on the secondary. If it detects both are locked, it logs an error message stating the client thinks both clusters are locked.

We configure the secondary cluster as the DR target relatively soon before initiating the failover, but we wait until the “storage server pending mutations” between the two clusters match.

There was a 2 minute period of downtime between the primary cluster going through a recovery and the secondary cluster going through a recovery where we were unable to start or commit any transactions and received many of our “both are locked” errors.

The write throughput of this cluster is relatively low at 2-3MB/s, but the read traffic is \>200MB/s.

 ![Screen Shot 2022-04-19 at 11.14.52 AM](https://global.discourse-cdn.com/foundationdb/original/2X/d/d838a41b930edd2e0cc5ab4180b5bcdf16142f18.png)

This is the “storage server pending mutations” graph over roughly 30 minutes. You can see we waited until both clusters stabilized to do the failover, which happened at the beginning of the dip which lasted 2 minutes.

 ![Screen Shot 2022-04-19 at 11.15.54 AM](https://global.discourse-cdn.com/foundationdb/original/2X/a/a0dc7d8f48a1ddaae2f50327b807c12b41e1eda7.png)  
This is graph showing the two recoveries per cluster which happened over that two minute period. The left bars are the original primary and the right bars are the secondary cluster.

Is this the expected behavior? It seems like if we wait for the “storage server pending mutations” to match between the two clusters, the failover itself shouldn’t take nearly this long.

---

<div class="post-metadata">

**Author:** ![ajbeamon](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ajbeamon/32/13_2.png) [@ajbeamon](https://forums.foundationdb.org/u/ajbeamon)\
**Post date:** [April 20, 2022, 3:44pm UTC](https://forums.foundationdb.org/t/fdbdr-failover-duration-longer-than-expected/3269/2 "2022-04-20T15:44:00Z")

</div>

Do you happen to know or have a status from before the switch that shows what the mutation lag was between the two clusters? A large lag could translate into a log downtime during the switchover. Two minutes of lag in otherwise healthy clusters and modest workload sounds long, but at the very least knowing the answer might help suggest where to look next.

---

<div class="post-metadata">

**Author:** ![ryanworl](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ryanworl/32/440_2.png) [@ryanworl](https://forums.foundationdb.org/u/ryanworl)\
**Post date:** [April 20, 2022, 9:29pm UTC](https://forums.foundationdb.org/t/fdbdr-failover-duration-longer-than-expected/3269/3 "2022-04-20T21:29:26Z")

</div>

I have all the trace logs, and I can graph the values for a given field over time for each cluster. For example, here is a diff of `TLogMetric.KnownCommittedVersion` between the two clusters.

The formula there is `b-a` where `a` is the primary and `b` is the secondary. The switch happened at 9:51:30-9:52 roughly.

 ![Screen Shot 2022-04-20 at 4.49.28 PM](https://global.discourse-cdn.com/foundationdb/original/2X/e/e52060d1bdbca22e448be27b96579df5e149ff84.png)

I can also graph different metrics for each cluster or other event types if that helps.

---

<div class="post-metadata">

**Author:** ![ajbeamon](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ajbeamon/32/13_2.png) [@ajbeamon](https://forums.foundationdb.org/u/ajbeamon)\
**Post date:** [April 25, 2022, 8:37pm UTC](https://forums.foundationdb.org/t/fdbdr-failover-duration-longer-than-expected/3269/4 "2022-04-25T20:37:35Z")

</div>

I’m not actually sure what metrics from the trace logs would indicate the DR lag, as I’ve only even monitored it in status. Possibly it is something logged by the DR agents themselves, do you have logs for those?
