refactor handling of read_only txns