add replicate_do_dbs support and catch socket broken pipe