Correct a use-after-free in the indexer thread.
Refactor replication manager to be closer to Warp.