charge compensation
A crystal is obsessed with staying electrically neutral: over any macroscopic region the positive and negative charges must cancel almost exactly, or a huge electrostatic energy would build up. Charge compensation is the crystal's response whenever something threatens that balance — introduce a defect that carries an effective charge, and the crystal automatically produces an equal and opposite counter-defect to cancel it. It is the accountant's rule of defect chemistry: every charge must be matched.
When you push in an aliovalent dopant, the crystal has a menu of ways to compensate, and they fall into two camps. IONIC compensation: it builds a charged vacancy or interstitial — for example an acceptor dopant like Y3+ or Ca2+ in zirconia is compensated by positively-charged oxygen vacancies (V_O••). ELECTRONIC compensation: it releases a free carrier — a donor may give up an electron (e'), an acceptor may take one, creating a hole (h•). The overall statement is the electroneutrality condition, an equation setting the sum of all positive effective charges equal to the sum of all negative ones, e.g. for acceptor-doped zirconia 2[V_O••] + p = [Y_Zr'] + n, where square brackets are concentrations and n, p are electron and hole concentrations.
Which compensation dominates is not fixed — it is chosen by temperature and, for oxides, by the surrounding oxygen partial pressure, because gaining or losing oxygen changes the balance between ionic and electronic carriers. This competition is the whole subject of defect equilibria: at high oxygen pressure a metal-deficient oxide compensates an acceptor with holes (p-type); at low pressure it compensates with electrons (n-type). Controlling which compensation you get — by composition, temperature, and atmosphere during firing — is how a ceramist turns the same base oxide into an insulator, an ionic conductor, or a semiconductor.
In acceptor-doped zirconia the electroneutrality condition simplifies, at moderate temperature and oxygen pressure, to 2[V_O••] = [Y_Zr'] — the ionic compensation branch. This one equation is why 8 mol% Y2O3 gives about 4 mol% oxygen vacancies: the vacancy count is locked to the dopant count.
The electroneutrality condition is a single bookkeeping equation, but choosing which of its terms dominate is how you engineer the material.
Compensation is automatic, but it is not always ionic. Assuming a dopant always makes vacancies is a common error — under an oxidizing or reducing atmosphere the same dopant can instead be compensated electronically, flipping the material's behaviour.