Domain walls and phase transitions in the frustrated two-dimensional XY model