in Databases edited by
14,385 views
62 votes
62 votes

Consider the partial Schedule $S$ involving two transactions $T1$ and $T2$. Only the $\textit{read}$ and the $\textit{write}$ operations have been shown. The $\textit{read}$ operation on data item $P$ is denoted by $\textit{read(P)}$ and $\textit{write}$ operation on data item $P$ is denoted by $\textit{write(P)}$.
$$\overset{\large{\text{Schedule S}}}{\begin{array}{c|ll}
\textbf{Time Instance}&    \rlap{\text{Transaction ID}}\\&\textbf{T1}&  \textbf{T2} \\\hline
1&     \text{read(A)}  \\ 
2&     \text{write(A)}\\   
3&     & \text{read(C)}     \\
4&     & \text{write(C)}     \\
5&     & \text{read(B)}  \\
6&     & \text{write(B)}     \\  
7&     & \text{read(A)}     \\
8&     & \text{commit}       \\
9&     \text{read(B)} \\
\end{array}}$$

Suppose that the transaction $T1$ fails immediately after time instance 9. Which of the following statements is correct?

  1. $T2$ must be aborted and then both $T1$ and $T2$ must be re-started to ensure transaction atomicity
  2. Schedule $S$ is non-recoverable and cannot ensure transaction atomicity
  3. Only $T2$ must be aborted and then re-started to ensure transaction atomicity
  4. Schedule $S$ is recoverable and can ensure transaction atomicity and nothing else needs to be done
in Databases edited by
14.4k views

4 Comments

$T_2$ Read the data $A$ from an uncommitted transaction ( Dirty Reading) $T_1$ and then committed.

Now the commit is causing the problem here if the user in future prints value of $A$ then $T_2$ will see the value written by $T_1$, which violates consistency and atomicity coz $T_1$ was rolled back and shouldn't have had any effect on other transaction ( violation of atomicity) and since value of $A$ is different for $T_2$ so DB might not remain consistent anymore.
0
0
ATOMICITY definition: either execute all the operations of all the transactions or execute none of any transaction if failure occurs.

But here as T2 is committed its changes are made in Database and as it’s doing dirty read from T1, T1 is failing nd rolling back its all operations but T2 has already made the changes so atomicity violated so B is True.
1
1

in option B how this is not follow Atomicity  here transaction T2 all opearation performed and T1all operation not performed ?

according to definition of Atomicity is either performed all operation or none operation of the transaction T1 and T2

@viral8702

0
0

5 Answers

–6 votes
–6 votes

According to me Ans is D

Because T2 is committed that means it's history is recorded in transaction log file to maintain ACID rules.

which also included "which value of A which was read by T2" and That value was written by T1.

As we know the read(A) of T1 [Initial value] and Write(A) of T1 extracted from T2 log file , 

therefore we can recover the S

1 comment

simply dirty read so nonrecoverable sooption b is appropiate
2
2
Answer:

Related questions