Skip to content

平成27年度 秋期 ITパスポート試験 問71

This question's explanation and your answers so far.

問71
頻出度★☆☆

処理一覧に示す実行順に,トランザクション1~4を実行する。あるトランザクションが途中で異常終了し,トランザクションを中断してロールバックした結果,データAとデータBが残った。異常終了したトランザクションはどれか。ここで,トランザクションが正常終了したときにコミットを行い,次のトランザクションがあれば,それを実行する。異常終了したときは,当該トランザクション以降のトランザクションを実行しないものとする。 〔処理一覧〕

実行順トランザクション名処理
1トランザクション1データAを作成する。
2トランザクション2データBを作成し,データAを削除する。
3トランザクション3データAを作成する。
4トランザクション4データBを削除する。
出典 平成27年度 秋期 ITパスポート試験 問71
解説

問 71

  • Incorrectア

    If transaction 1 terminates abnormally, it rolls back its own creation (data A), and the subsequent transactions are not executed either, so no data remains at all. This does not match the result where data A and data B remain.

  • Incorrectイ

    If transaction 2 terminates abnormally, only up through transaction 1 has been committed, so only data A remains. Data B has not yet been created, so the result is not one where both remain.

  • Incorrectウ

    If transaction 3 terminates abnormally, only up through transaction 2 has been committed, at which point data A has been deleted and only data B remains. Transaction 3's re-creation of data A is also rolled back, so only data B remains and not both.

  • エ

    正解 The result of a transaction whose commit completed normally is finalized and remains, while a transaction that terminated abnormally rolls back and undoes its own changes, and the transactions after it are not executed. Therefore the data that finally remains matches the committed state up to just before the transaction that terminated abnormally. Tracing the state at each commit point: after transaction 1 it is “A”, after transaction 2 it is “B” (A is deleted), after transaction 3 it is “A and B” (A is re-created), after transaction 4 it is “A” (B is deleted). Data A and data B both remain only when transactions up through transaction 3 have been committed and transaction 4 terminates abnormally and rolls back (undoing the deletion of data B). Therefore the correct answer is エ (transaction 4).

ここがポイント
  • The result of a committed transaction is finalized and remains, while a transaction that terminated abnormally rolls back and undoes its own changes. Transactions after the abnormal termination are not executed.
  • The data that finally remains = the committed state up to just before the transaction that terminated abnormally. Trace the state at each commit point in order and work backward to the point where it becomes “A and B” to identify the transaction that terminated abnormally.
用語

Your answers