Home »
DBMS
Commit Point of Transaction | DBMS
In this tutorial, we will learn about the commit point of transaction in database management system (DBMS).
By Akash Kumar Last updated : May 28, 2023
What is Commit Point of Transaction in DBMS?
A transaction T is said to reach its commit point only when it completes all its operation that has actually accessed the database and have been executed successfully and the effect of all transaction operation on the database have been recorded in the log.
The transaction is actually said to be committed when it is beyond the commit point and its effect is actually assumed to be permanently recorded or captured in the database.
After this transaction basically writes a commit record[commit, T] into the log.
If a system fails or system failure occurs, then we basically search back in the log for all transactions T have written a [start_transaction, T] record into the log but not written them [commit, T] record yet.
During the recovery process, these transactions on the database may have to be rolled back to undo their effect.
Transactions that have written their commit record in the log must also have recovery process. The transaction that has written their commit record in the log must also have recorded all their WRITE operation in the log, so their effect on the database can be redone from the log records.
We must keep the log file on the disk. Updating a disk file basically involves copying the appropriate block of the file from disk to a buffer in the main memory, updating the buffer in main memory, and copying the buffer to the disk.
It is too common to keep one or more blocks of the log file in main memory buffers as long as they are not filled with log entries and then we write them back to disk only once, rather than writing to the disk every time a log entry is added. This basically saves the overhead of multiple disk writes of the same log file block. At the time of system crash, only the log entries that have written back to the disk are basically considered in the recovery process because the content of main memory may get lost.
Hence, before a transaction reaches to its commit point, we see whether any portion of the log that has not been written to the disk yet must now be written to the disk. This process is called force-writing in the log file before actually committing a transaction.