fix relation each_batch, retry on 509 error

* fix get_options and parameter
* move parameter spec to relation_spec.rb