\begin{frame} \frametitle{Phantom Row Problem} \begin{exampleblock}{} \begin{tcenter} \begin{tabular}{|l|l|l|} \hline \emph{Transaction 1} & \emph{Transaction 2} & \emph{Effect} \\ \hline & & \\[-1ex] \emph{scan} relation R & & $T_1$ locks all rows\\ & \emph{insert} new row into R & $T_2$ locks new row\\ & commit & $T_2$'s lock released\\ \emph{scan} relation R & & reads \emph{new} row too!\\ \hline \end{tabular} \end{tcenter} \end{exampleblock} \pause \begin{alertblock}{} Both transactions properly follow the 2 PL protocol! \\[1ex] Nevertheless, $T_1$ observed an effect caused by $T_2$. \begin{itemize} \item Isolation violated! \item Cause of the problem: \emph{$T_1$ can only lock existing rows}. \end{itemize} \end{alertblock} \pause \begin{goal}{Solutions} \begin{enumerate} \item \emph{multi-granularity locking} (locking the table) \item \emph{declarative locking}: key-range or predicate locking \end{enumerate} \end{goal} \end{frame}