図は処理1, 処理2の順でデータベースを更新するトランザクションの処理フローを示している。図中のa~cのうち, コミット処理 (処理1, 処理2の更新結果を確定させる処理) に該当する箇所だけを全て挙げたものはどれか。
平成26年度 秋期 ITパスポート試験 問71
This question's explanation and your answers so far.
問 71
- ア
正解 The correct answer is ア (a). A transaction treats Process 1 and Process 2 together as a single indivisible unit, so the update results may be finalized (committed) only when both Process 1 and Process 2 have ended normally. Following the figure, the path where “Did Process 1 end normally?” is Yes and the following “Did Process 2 end normally?” is also Yes leads only to a. Therefore, the only location that corresponds to commit processing is a.
Incorrectイ
a is correct, but b is wrong. b is the location reached when “Did Process 2 end normally?” is No. Since Process 2 has failed, the update results must not be finalized. At b, the update made by Process 1 must also be cancelled (rolled back), so b does not correspond to commit processing.
Incorrectウ
Both b and c are locations on paths that ended abnormally, and both correspond to rollback rather than commit. In addition, this option is wrong because it does not include a, the location on the only path where both processes ended normally.
Incorrectエ
c is the location reached when “Did Process 1 end normally?” is No. The failure occurred at the Process 1 stage and Process 2 was not even executed, so there is no successful update result to finalize. c is rollback processing that cancels the update made by Process 1, not commit processing.
- A transaction is an indivisible unit of processing that makes multiple updates either all applied or all cancelled (atomicity among the ACID properties). Therefore, a commit is possible only on the path where every process it contains ended normally.
- Distinguish between commit (finalizing the update results) and rollback (returning to the state before the update). In flowchart questions, follow the Yes/No of each decision to identify the path where all processes succeeded; the location ahead of it is the commit, while the locations branching off from abnormal termination are rollbacks.