Two dams gave way in the northeastern Brazilian state of Bahia after weeks of heavy rains, swamping already swollen local rivers as flooding hit towns across the region.