add drain mode, handle replication error, filter stalled request, fix agent error nummber update
Merge pull request #4751 from ticoann/stall_warning

add drain mode, handle replication error, filter stalled request