None of the above. Have each candidate run alongside with an official replacement to fill the term in case of vacancy.
Sort of like a party list/vice-candidate? Interesting. Does the candidate name the replacement? (Seems like it would be rather expensive if you had primaries for all these replacements, few of whom would ever win). And what happens if the replacement won't/can't take the office? Is there a special election then?
I assume the candidates could name their replacement after winning the primary. And yes, a special election occurs if the replacement can't or refuses to serves (or if he/she has already taken office and then vacates it). That would significantly reduce the number of by-elections, at least.