Write an UPDATE record to disk for the specified tid and page (with provided before and after images.) @param tid The transaction performing the write @param before The before image of the page @param after The after image of the page @see Page#getBef
(TransactionId tid, Page before,
Page after)
| 198 | @see Page#getBeforeImage |
| 199 | */ |
| 200 | public synchronized void logWrite(TransactionId tid, Page before, |
| 201 | Page after) |
| 202 | throws IOException { |
| 203 | Debug.log("WRITE, offset = " + raf.getFilePointer()); |
| 204 | preAppend(); |
| 205 | /* update record conists of |
| 206 | |
| 207 | record type |
| 208 | transaction id |
| 209 | before page data (see writePageData) |
| 210 | after page data |
| 211 | start offset |
| 212 | */ |
| 213 | raf.writeInt(UPDATE_RECORD); |
| 214 | raf.writeLong(tid.getId()); |
| 215 | |
| 216 | writePageData(raf,before); |
| 217 | writePageData(raf,after); |
| 218 | raf.writeLong(currentOffset); |
| 219 | currentOffset = raf.getFilePointer(); |
| 220 | |
| 221 | Debug.log("WRITE OFFSET = " + currentOffset); |
| 222 | } |
| 223 | |
| 224 | void writePageData(RandomAccessFile raf, Page p) throws IOException{ |
| 225 | PageId pid = p.getId(); |
no test coverage detected