MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / logWrite

Method logWrite

src/java/simpledb/storage/LogFile.java:200–222  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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();

Callers 3

flushAllPagesMethod · 0.80
flushPageMethod · 0.80
flushPagesMethod · 0.80

Calls 4

logMethod · 0.95
preAppendMethod · 0.95
writePageDataMethod · 0.95
getIdMethod · 0.65

Tested by

no test coverage detected