Fixed Replication Queue Non-Atomicity Issue

Fixed non-atomicity of updating the replication queue. This could lead to replicas being out of sync until the server restarts.