I don't know much, only guesses. Often testing recovery after a
recovery is a different code path than the original recovery.
The original recovery will write a bunch of compensating log records,
so doing the same operation again actually does something different
the second time as it has to work through the compensating log
records.
These tests want to very carefully control the layout of the record
in the log file which is why they were done as unit test rather
than standard sql tests. In the second case they go in and hand
corrupt a page to force the checksum logic.
These tests are kind of subtle as what is being tested is not really
visible in the code in the tests. The most important code paths being
tested are the startup recovery code paths taken when each of the
tests recovers from the hard crash simulated by exiting the previous
test by simply exiting.
Unfortunately I see no comments about this. And as you point out the
comments in the actual test look wrong. Likely the comments should
just have the "2" test added.
Note that the second comment has -DTestBadLogSetup=true set and these
tests are run by the following, and it seems like from comments
Log1 should be run
again but I don't know if comment is wrong or test run:
unit/recoverBadChecksumLogSetup.unit
unit/recoverBadChecksumLog1.unit
unit/recoverBadChecksumLog2.unit
unit/recoverBadChecksumLog3.unit
unit/recoverBadChecksumLog4.unit
unit/recoverBadChecksumLog5.unit
unit/recoverBadChecksumLog6.unit
unit/recoverBadChecksumLog7.unit
Overall it is worth noting that just normal crash recovery testing is
woefully small, as it was hard to write. Recently support was added to
junit
testing to make it easy to write as standard junit testing.
On 8/9/2013 6:04 AM, Rick Hillegas wrote:
Does anyone know why the following tests occur twice in the
storeunit.runall suite, which runs on the old test harness?
unit/recoverBadLog1.unit
unit/recoverBadLog2.unit
I believe that these unit tests live in T_RecoverBadLog.java. The header
comment in that file shows recoverBadLog1 being run twice, but not
recoverBadLog2. What is the reason to run these tests twice and why does
the header comment in T_RecoverBadLog disagree with the contents of
storeunit.runall?
Thanks,
-Rick