나는 920만 개의 게시물이 있는 큰 데이터베이스를 가지고 있으며, 그 중 일부는 15만 개 이상의 게시물을 가진 초대형 토픽(mega-topics)도 있습니다. 다른 서버로 복원(restore)을 시도하면 새 호스트 이름으로 재매핑하는 과정에서 다음과 같은 오류가 발생합니다.
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"
이 데드락을 해결할 수 있는 방법이 있을까요?
이것은 8GB 표준 드롭렛(droplet)에서 발생한 문제였습니다.
리베이킹(rebake)을 시도할 때, 16GB RAM을 가진 비교적 빠른 데이터베이스 서버와 16GB RAM을 가진 별도의 웹 서버에서도 이 사이트에서 유사한 문제가 발생했습니다. 두 서버 모두 다른 소형 및 저 트래픽 사이트를 몇 개 더 서비스하고 있었습니다.
이것이 초대형 토픽(mega-topics) 때문일 가능성이 높아 보입니까? 이를 더 작은 토픽으로 나누는 것 외에는 다른 해결책이 있을까요?