# Remapping mislukt door deadlock

**URL:** <https://meta.discourse.org/t/remapping-fails-due-to-deadlock/168397>\
**Category:** Product Support\
**Created:** [27 oktober 2020 om 15:14 UTC](https://meta.discourse.org/t/remapping-fails-due-to-deadlock/168397 "2020-10-27T15:14:05Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [27 oktober 2020 om 15:14 UTC](https://meta.discourse.org/t/remapping-fails-due-to-deadlock/168397/1 "2020-10-27T15:14:06Z")

</div>

I’ve got a large database (9.2 million posts) with a bunch of mega-topics (some \> 150K posts!). When I try to do a restore to another server, I get something like this when it’s doing the remap to a new host name.

```plaintext
Restoring uploads, this may take a while...                                                   
Optimizing site icons...                                                                                      
Posts will be rebaked by a background job in sidekiq. You will see missing images until that has completed.
You can expedite the process by manually running "rake posts:rebake_uncooked_posts"  
EXCEPTION: ERROR: deadlock detected                                              
DETAIL: Process 960 waits for ShareLock on transaction 4765; blocked by process 2184.                   
Process 2184 waits for ShareLock on transaction 4915; blocked by process 960. HINT: See server log for query details.
CONTEXT: while updating tuple (566294,13) in relation "posts"                                         

```

Is there something that I can do to resolve this deadlock?

This was on an 8GB standard droplet.

When trying to do a rebake I have had a similar issue with this site on a reasonably fast database server with 16GB of ram and a separate web server with 16GB of ram. Both were also serving some other fairly small and low-volume sites.

Does it seem likely that it’s the megatopics? Is there a solution other than splitting them into smaller ones?

---

_[View the full topic](https://meta.discourse.org/t/remapping-fails-due-to-deadlock/168397)._
