Clean up data replacement in the translate_messageindex table

* Avoid letting callers see the table being briefly empty.
* Also made the REPLACE and INSERT since everything is always deleted first.

Change-Id: Ic80d21b6abe6aa076359b3b277f2b6b527af63c9