add drain mode, handle replication error, filter stalled request, fix agent error nummber update