use flush id to decide if begin transaction