What is the value of "innodb_lock_wait_timeout" setting? By default this may be 50 seconds. Perhaps there are huge records in your qa_posts table. Therefore, there is a possibility that time to lock the table is insufficient. If your DB server is a VPS or dedicated server, you may be able to avoid this error by increasing this value. As a supplement, you should restore the configuration after the upgrade.