Replace FLAGS with STATE columns in dispatcher

(cherry picked from commit 3d9bb5ad30dbe3c6a439bc7ec60da10a845e8dce)