The Lebesgue differentiation theorem says that for certain metric spaces $X$ (see below), any Borel measure $\mu$ that is finite on bounded sets and any $f: X \rightarrow \mathbb{R}$ locally $\mu$-integrable, there is $A \subseteq X$ s.t. $\mu(X \setminus A)=0$ and
$$\forall x \in A: \lim_{r \rightarrow 0} \frac{1}{\mu(B_r(x))} \int_{B_r(x)} f(y) \mu(dy) = f(x)$$
Here, $B_r(x)$ is the ball of radius $r$ with center $x$.
This holds for $X$ a Riemannian manifold or $X$ a locally compact separable ultrametric space. I'm interested to understand how it fails on somewhat more general spaces. In particular:
Can the theorem fail on $X$ a compact separable metric space? Can you provide a counterexample (i.e. $X$, $\mu$ and $f$ s.t. the conditionidentity fails)?
Is there a compact Polish space $X$ s.t. the theorem can fail for any metrization of $X$ (i.e. for any metrization there are $\mu$ and $f$ s.t. the conditionidentity fails)?