Suppose $f: X \to Y$ is a morphism between varieties, let $y \in Y$ be a closed point, and $X_y$ be the fibre of the morphism over $y$. I learned that the canonical divisor $K_X$ of $X$, the canonical divisor $K_{X_y}$ of $X_y$, and the relative canonical divisor $K_{X/Y}:= K_X -f^*K_Y$ are somehow related as the following:
(1) For generic $y \in Y$, one has $ K_{X_y} \cong K_X|_{X_y}$.
Remark Intuitively, I can understanding the relation given above, but I do not know how to show this rigorously. Besides, I do not know the correct conditions to be put on $ f, X, Y$. Certainly one should assume $X,Y$ at least to be normal, but it seems that it is too strong to assume they are smooth . However, you can freely assume they are projective/proper varieties.
(2) For generic $y$, $K_{X_y} \cong K_{X/Y}|_{X_y}$.
Remark (i) $Y$ should to be at least $\mathbb{Q}$-Gorenstein in order to make sense of pull-back of $K_Y$. (ii) If (1) is true, then (2) is equivalent to $(f^*K_Y)|_{X_y}=0$, this seems like some projection formula. (3) Both formula are not valid for all $y \in Y$, this can be seen from the example of $f$ being the blowup of one point in $\mathbb{P}^2$.