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

Method TestOpenCommitOpenCrash

test/simpledb/systemtest/LogTest.java:349–388  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

347 }
348
349 @Test public void TestOpenCommitOpenCrash()
350 throws IOException, DbException, TransactionAbortedException {
351 setup();
352 doInsert(hf1, 1, 2);
353
354 // *** Test:
355 // T1 inserts but does not commit
356 // T2 inserts and commits
357 // T3 inserts but does not commit
358 // crash
359 // only T2 data should be there
360
361 Transaction t1 = new Transaction();
362 t1.start();
363 insertRow(hf1, t1, 10);
364 Database.getBufferPool().flushAllPages(); // XXX defeat NO-STEAL-based abort
365 insertRow(hf1, t1, 11);
366
367 // T2 commits
368 doInsert(hf2, 22, 23);
369
370 Transaction t3 = new Transaction();
371 t3.start();
372 insertRow(hf2, t3, 24);
373 Database.getBufferPool().flushAllPages(); // XXX defeat NO-STEAL-based abort
374 insertRow(hf2, t3, 25);
375
376 crash();
377
378 Transaction t = new Transaction();
379 t.start();
380 look(hf1, t, 1, true);
381 look(hf1, t, 10, false);
382 look(hf1, t, 11, false);
383 look(hf2, t, 22, true);
384 look(hf2, t, 23, true);
385 look(hf2, t, 24, false);
386 look(hf2, t, 25, false);
387 t.commit();
388 }
389
390 @Test public void TestOpenCommitCheckpointOpenCrash()
391 throws IOException, DbException, TransactionAbortedException {

Callers

nothing calls this directly

Calls 9

setupMethod · 0.95
doInsertMethod · 0.95
startMethod · 0.95
insertRowMethod · 0.95
getBufferPoolMethod · 0.95
crashMethod · 0.95
lookMethod · 0.95
commitMethod · 0.95
flushAllPagesMethod · 0.80

Tested by

no test coverage detected