Fennel: SnapshotSegmentTest Class Reference (original) (raw)
Inheritance diagram for SnapshotSegmentTest:

| Public Types | |
|---|---|
| enum | OpType { OP_READ_SEQ, OP_WRITE_SEQ, OP_READ_RAND, OP_WRITE_RAND, OP_READ_NOWAIT, OP_WRITE_NOWAIT, OP_WRITE_SKIP, OP_SCRATCH, OP_PREFETCH, OP_PREFETCH_BATCH, OP_ALLOCATE, OP_DEALLOCATE, OP_CHECKPOINT, OP_RESIZE_CACHE, OP_MAX } |
| The various operations that can be run in the multi-threaded test. More... | |
| Public Member Functions | |
| SnapshotSegmentTest () | |
| void | testSnapshotReads () |
| void | testRollback () |
| void | testUncommittedReads () |
| void | testDeallocateOld () |
| void | deallocateOldPages (TxnId oldestActiveTxnId, uint numPagesBefore, uint numPagesAfter, uint readStart, uint readEnd) |
| virtual void | testCaseSetUp () |
| Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked. | |
| virtual void | openSegmentStorage (DeviceMode openMode) |
| virtual void | closeStorage () |
| virtual void | testAllocateAll () |
| Initializes all disk pages, filling them with information based on their block numbers. | |
| virtual void | verifyPage (CachePage &page, uint x) |
| Verifies that the page contents are correct (based on the parameter x). | |
| virtual void | fillPage (CachePage &page, uint x) |
| Scribbles on the contents of a page. | |
| virtual void | openStorage (DeviceMode openMode) |
| virtual CachePage * | lockPage (OpType opType, uint iPage) |
| virtual void | unlockPage (CachePage &page, LockMode lockMode) |
| virtual void | prefetchPage (uint iPage) |
| virtual void | prefetchBatch (uint, uint) |
| virtual void | testAllocate () |
| virtual void | testDeallocate () |
| virtual void | testCheckpoint () |
| Performs a periodic checkpoint. | |
| void | testSingleThread () |
| virtual void | openRandomSegment () |
| SharedSegment | createLinearDeviceSegment (DeviceId deviceId, uint nPages) |
| void | closeLinearSegment () |
| void | closeRandomSegment () |
| void | closeVersionedRandomSegment () |
| void | closeSnapshotRandomSegment () |
| Cache & | getCache () |
| virtual SharedCache | newCache () |
| SharedRandomAccessDevice | openDevice (std::string devName, DeviceMode openMode, uint nDevicePages, DeviceId deviceId) |
| virtual void | testCaseTearDown () |
| Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked. | |
| void | closeDevice (DeviceId deviceId, SharedRandomAccessDevice &pDevice) |
| TestSuite * | releaseTestSuite () |
| void | beforeTestCase (std::string testCaseName) |
| void | afterTestCase (std::string testCaseName) |
| virtual void | notifyTrace (std::string source, TraceLevel level, std::string message) |
| Receives notification when a trace event occurs. | |
| virtual TraceLevel | getSourceTraceLevel (std::string source) |
| Gets the level at which a particular source should be traced. | |
| bool | testOp (OpType opType, uint iPage, bool bNice) |
| Carries out one operation on a page. | |
| char const * | getOpName (OpType opType) |
| Makes up an operation name based on an OpType. | |
| LockMode | getLockMode (OpType opType) |
| Gets the LockMode corresponding to an OpType. | |
| void | testSequentialOp (OpType opType) |
| Carries out an operation on each disk page in order from 0 to nDiskPages-1. | |
| void | testRandomOp (OpType opType) |
| Carries out an operation on nRandomOps pages selected at random. | |
| void | testSkipOp (OpType opType, uint n) |
| Carries out an operation on every "n" pages, starting at page 0. | |
| void | testScratch () |
| Performs nRandomOps scratch operations. | |
| void | testPrefetch () |
| Performs a limited number of prefetch operations. | |
| void | testPrefetchBatch () |
| Performs a limited number of batch prefetch operations. | |
| void | testSequentialRead () |
| Carries out one sequential read pass over the entire device. | |
| void | testSequentialWrite () |
| Carries out one sequential write pass over the entire device. | |
| void | testRandomRead () |
| Carries out nRandomOps read operations on pages selected at random. | |
| void | testRandomWrite () |
| Carries out nRandomOps write operations on pages selected at random. | |
| void | testSkipWrite (uint n) |
| Carries out write operations every n pages. | |
| void | testCheckpointGuarded () |
| void | testCacheResize () |
| void | testMultipleThreads () |
| Carries out specified tests in multi-threaded mode. | |
| virtual void | threadInit () |
| virtual void | threadTerminate () |
| virtual bool | testThreadedOp (int iOp) |
| Test implementation must be supplied by derived test class. | |
| Static Public Member Functions | |
| static void | readParams (int argc, char **argv) |
| Parses the command line. | |
| Static Public Attributes | |
| static ParamName | paramTestSuiteName |
| static ParamName | paramTraceFileName |
| static ParamName | paramDictionaryFileName |
| static ParamName | paramTraceLevel |
| static ParamName | paramStatsFileName |
| static ParamName | paramTraceStdout |
| static ParamName | paramDegreeOfParallelism |
| static ConfigMap | configMap |
| Configuration parameters. | |
| Protected Types | |
| enum | VictimPolicy { victimTwoQ, victimLRU, victimRandom } |
| The available victim policy implementations. More... | |
| Protected Member Functions | |
| void | setForceCacheUnmap (SharedSegment pSegment) |
| Forces the underlying snapshot segment to always execute its checkpoints during a cache flush and unmap. | |
| void | commitChanges (TxnId commitCsn) |
| Commits transactions associated with a specified csn. | |
| void | snooze (uint nSeconds) |
| uint | generateRandomNumber (uint iMax) |
| void | runThreadedTestCase () |
| Executes specified test threads. | |
| Protected Attributes | |
| uint | nDiskPagesTotal |
| PageId | firstPageId |
| DeviceId | tempDeviceId |
| SharedRandomAccessDevice | pTempDevice |
| SharedSegment | pTempSegment |
| TxnId | currCsn |
| std::vector< TxnId > | updatedCsns |
| bool | commit |
| SharedSegment | pSnapshotRandomSegment2 |
| std::vector< PageId > | freeablePages |
| Queue of allocated pages waiting to be freed. | |
| StrictMutex | freeablePagesMutex |
| Mutex protecting freeablePages. | |
| PageOwnerId | objId |
| PageOwnerId to use when allocating pages. | |
| SharedSegmentFactory | pSegmentFactory |
| SharedSegment | pLinearSegment |
| Segment supporting linear page allocation. | |
| SharedSegment | pRandomSegment |
| (Optional) segment supporting random page allocation. | |
| SharedSegment | pVersionedRandomSegment |
| (Optional) segment supporting versioned random page allocation. | |
| SharedSegment | pSnapshotRandomSegment |
| (Optional) segment supporting snapshot random page allocation. | |
| VictimPolicy | victimPolicy |
| VictimPolicy to instantiate. | |
| CacheParams | cacheParams |
| Parameters for cache initialization. | |
| SharedCache | pCache |
| Cache instance being tested. | |
| SharedRandomAccessDevice | pRandomAccessDevice |
| The default cached device. | |
| uint | nMemPages |
| Size of cache in memory pages. | |
| uint | nDiskPages |
| Size of device in disk pages. | |
| uint | cbPageFull |
| Disk page size. | |
| DeviceId | dataDeviceId |
| Fixed ID to assign to data device. | |
| TestSuite * | pTestSuite |
| Boost test suite. | |
| boost::shared_ptr< TestBase > | pTestObj |
| std::ofstream | traceStream |
| Output file stream for tracing. | |
| StrictMutex | traceMutex |
| Protects traceStream. | |
| std::string | testName |
| Name of test. | |
| TraceLevel | traceLevel |
| Level at which to trace test execution. | |
| FileStatsTarget | statsTarget |
| Output for stats. | |
| StatsTimer | statsTimer |
| Timer for stats collection. | |
| bool | traceStdout |
| Copy trace output to stdout. | |
| bool | traceFile |
| Copy trace output to file. | |
| TestCaseGroup | defaultTests |
| TestCaseGroup | extraTests |
| uint | cbPageUsable |
| Portion of each page that should be scribbled on. | |
| uint | nRandomOps |
| Number of random access operations to run per pass. | |
| uint | nSecondsBetweenCheckpoints |
| Checkpoint interval during multi-threaded test. | |
| StrictMutex | logMutex |
| Protects output stream. | |
| SXMutex | checkpointMutex |
| SXMutex used to synchronize checkpoints with write actions. | |
| bool | bTestResize |
| Flag indicating that the cache should be dynamically resized during the multi-threaded portion of the test. | |
| uint | nSeconds |
| Duration of multi-threaded test. | |
| std::vector< int > | threadCounts |
| Number of threads to run for each type of operation. | |
| Static Protected Attributes | |
| static bool | runAll |
| Run all test cases, including the extra tests. | |
| static std::string | runSingle |
| Run only the test case of this name. |
Detailed Description
Definition at line 33 of file SnapshotSegmentTest.cpp.
Member Enumeration Documentation
The available victim policy implementations.
Enumerator:
| victimTwoQ | | | -------------- | | | victimLRU | | | victimRandom | |
Definition at line 44 of file CacheTestBase.h.
The various operations that can be run in the multi-threaded test.
Enumerator:
| OP_READ_SEQ | | | --------------------- | | | OP_WRITE_SEQ | | | OP_READ_RAND | | | OP_WRITE_RAND | | | OP_READ_NOWAIT | | | OP_WRITE_NOWAIT | | | OP_WRITE_SKIP | | | OP_SCRATCH | | | OP_PREFETCH | | | OP_PREFETCH_BATCH | | | OP_ALLOCATE | | | OP_DEALLOCATE | | | OP_CHECKPOINT | | | OP_RESIZE_CACHE | | | OP_MAX | |
Definition at line 83 of file PagingTestBase.h.
00083 { 00084 OP_READ_SEQ, 00085 OP_WRITE_SEQ, 00086 OP_READ_RAND, 00087 OP_WRITE_RAND, 00088 OP_READ_NOWAIT, 00089 OP_WRITE_NOWAIT, 00090 OP_WRITE_SKIP, 00091 OP_SCRATCH, 00092 OP_PREFETCH, 00093 OP_PREFETCH_BATCH, 00094 OP_ALLOCATE, 00095 OP_DEALLOCATE, 00096 OP_CHECKPOINT, 00097 OP_RESIZE_CACHE, 00098 OP_MAX 00099 };
Constructor & Destructor Documentation
| SnapshotSegmentTest::SnapshotSegmentTest | ( | | ) | [inline, explicit] | | ---------------------------------------- | - | | - | -------------------- |
Member Function Documentation
| void SnapshotSegmentTest::testSnapshotReads | ( | | ) | [inline] | | ------------------------------------------- | - | | - | ---------- |
| void SnapshotSegmentTest::testRollback | ( | | ) | [inline] | | -------------------------------------- | - | | - | ---------- |
Definition at line 78 of file SnapshotSegmentTest.cpp.
References SnapshotSegmentTestBase::closeStorage(), SnapshotSegmentTestBase::commit, DeviceMode::createNew, SnapshotSegmentTestBase::currCsn, DeviceMode::load, CacheTestBase::nDiskPages, SegmentTestBase::openStorage(), SegStorageTestBase::pVersionedRandomSegment, SnapshotSegmentTestBase::testAllocateAll(), PagingTestBase::testSequentialRead(), and PagingTestBase::testSkipWrite().
Referenced by SnapshotSegmentTest().
| void SnapshotSegmentTest::testUncommittedReads | ( | | ) | [inline] | | ---------------------------------------------- | - | | - | ---------- |
Definition at line 108 of file SnapshotSegmentTest.cpp.
References SegStorageTestBase::closeLinearSegment(), SnapshotSegmentTestBase::closeStorage(), DeviceMode::createNew, SnapshotSegmentTestBase::currCsn, SnapshotSegmentTestBase::firstPageId, DeviceMode::load, SegmentTestBase::openStorage(), SegStorageTestBase::pLinearSegment, SegStorageTestBase::pSegmentFactory, SnapshotSegmentTestBase::pSnapshotRandomSegment2, SegStorageTestBase::pVersionedRandomSegment, SnapshotSegmentTestBase::setForceCacheUnmap(), SnapshotSegmentTestBase::testAllocateAll(), PagingTestBase::testSequentialRead(), PagingTestBase::testSkipWrite(), and SnapshotSegmentTestBase::updatedCsns.
Referenced by SnapshotSegmentTest().
| void SnapshotSegmentTest::testDeallocateOld | ( | | ) | [inline] | | ------------------------------------------- | - | | - | ---------- |
Definition at line 173 of file SnapshotSegmentTest.cpp.
References SnapshotSegmentTestBase::closeStorage(), DeviceMode::createNew, SnapshotSegmentTestBase::currCsn, deallocateOldPages(), SnapshotSegmentTestBase::firstPageId, DeviceMode::load, CacheTestBase::nDiskPages, CacheStats::nMemPagesUnused, opaqueToInt(), SegmentTestBase::openStorage(), CacheTestBase::pCache, SegStorageTestBase::pSnapshotRandomSegment, SnapshotSegmentTestBase::testAllocateAll(), PagingTestBase::testSequentialRead(), PagingTestBase::testSkipWrite(), and SnapshotSegmentTestBase::updatedCsns.
Referenced by SnapshotSegmentTest().
00174 {
00175
00176
00177 currCsn = TxnId(0);
00178 openStorage(DeviceMode::createNew);
00179 testAllocateAll();
00180 closeStorage();
00181
00182
00183 updatedCsns.push_back(TxnId(3));
00184 currCsn = TxnId(3);
00185 openStorage(DeviceMode::load);
00186 testSkipWrite(3);
00187 closeStorage();
00188
00189
00190 updatedCsns.push_back(TxnId(5));
00191 currCsn = TxnId(5);
00192 openStorage(DeviceMode::load);
00193 testSkipWrite(5);
00194 closeStorage();
00195
00196
00197 updatedCsns.push_back(TxnId(7));
00198 currCsn = TxnId(7);
00199 openStorage(DeviceMode::load);
00200 testSkipWrite(7);
00201 closeStorage();
00202
00203 uint totalPages =
00204 nDiskPages +
00205 nDiskPages / 3 + ((nDiskPages % 3) ? 1 : 0) +
00206 nDiskPages / 5 + ((nDiskPages % 5) ? 1 : 0) +
00207 nDiskPages / 7 + ((nDiskPages % 7) ? 1 : 0);
00208
00209
00210
00211 deallocateOldPages(TxnId(3), totalPages, totalPages, 3, 8);
00212
00213
00214
00215 deallocateOldPages(TxnId(4), totalPages, totalPages, 4, 8);
00216
00217
00218
00219
00220 uint nPages =
00221 totalPages - (nDiskPages/(35) + ((nDiskPages % (35)) ? 1 : 0));
00222 deallocateOldPages(TxnId(6), totalPages, nPages, 6, 8);
00223
00224
00225
00226
00227 totalPages = nPages;
00228 nPages =
00229 totalPages -
00230 (nDiskPages/(57) + ((nDiskPages % (57)) ? 1 : 0)) -
00231 (nDiskPages/(37) + ((nDiskPages % (37)) ? 1 : 0)) +
00232 (nDiskPages/(357) + ((nDiskPages % (357)) ? 1 : 0));
00233 deallocateOldPages(TxnId(8), totalPages, nPages, 8, 8);
00234
00235
00236
00237 currCsn = TxnId(9);
00238 openStorage(DeviceMode::load);
00239
00240
00241 testSequentialRead();
00242
00243
00244 CacheStats statsBefore;
00245 pCache->collectStats(statsBefore);
00246
00247 for (int i = opaqueToInt(firstPageId);
00248 i < 100 + opaqueToInt(firstPageId); i++)
00249 {
00250 pSnapshotRandomSegment->deallocatePageRange(PageId(i), PageId(i));
00251 }
00252
00253
00254 CacheStats statsAfter;
00255 pCache->collectStats(statsAfter);
00256
00257
00258
00259 BOOST_CHECK(statsAfter.nMemPagesUnused <= statsBefore.nMemPagesUnused);
00260
00261 closeStorage();
00262
00263
00264
00265 deallocateOldPages(TxnId(0), nPages, nPages, 8, 8);
00266
00267
00268
00269
00270
00271 int nPagesFreed =
00272 100 + 100/3 + 100/5 + 100/7 - 100/(35) - 100/(37) - 100/(57)
00273 - 100/(35*7);
00274 deallocateOldPages(TxnId(10), nPages, nPages - nPagesFreed, 1, 0);
00275 }
| void SnapshotSegmentTest::deallocateOldPages | ( | TxnId | oldestActiveTxnId, |
|---|---|---|---|
| uint | numPagesBefore, | ||
| uint | numPagesAfter, | ||
| uint | readStart, | ||
| uint | readEnd | ||
| ) | [inline] |
| void SnapshotSegmentTestBase::setForceCacheUnmap | ( | SharedSegment | pSegment | ) | [protected, inherited] |
|---|
| void SnapshotSegmentTestBase::commitChanges | ( | TxnId | commitCsn | ) | [protected, inherited] |
|---|
| void SnapshotSegmentTestBase::testCaseSetUp | ( | | ) | [virtual, inherited] | | ------------------------------------------- | - | | - | ---------------------- |
| void SnapshotSegmentTestBase::openSegmentStorage | ( | DeviceMode | openMode | ) | [virtual, inherited] |
|---|
Reimplemented from SegStorageTestBase.
Definition at line 47 of file SnapshotSegmentTestBase.cpp.
References DeviceMode::create, SegStorageTestBase::createLinearDeviceSegment(), SnapshotSegmentTestBase::currCsn, CacheTestBase::dataDeviceId, SnapshotSegmentTestBase::firstPageId, CacheTestBase::nDiskPages, SnapshotSegmentTestBase::nDiskPagesTotal, NULL_PAGE_ID, CacheTestBase::openDevice(), SegStorageTestBase::pLinearSegment, SegStorageTestBase::pRandomSegment, SegStorageTestBase::pSegmentFactory, SegStorageTestBase::pSnapshotRandomSegment, SnapshotSegmentTestBase::pTempDevice, SnapshotSegmentTestBase::pTempSegment, SegStorageTestBase::pVersionedRandomSegment, SnapshotSegmentTestBase::setForceCacheUnmap(), and SnapshotSegmentTestBase::tempDeviceId.
00048 { 00049 nDiskPages = nDiskPagesTotal; 00050 if (openMode.create) { 00051 firstPageId = NULL_PAGE_ID; 00052 } 00053 00054 pTempDevice = 00055 openDevice("temp.dat", openMode, nDiskPages / 50, tempDeviceId); 00056 SharedSegment pTempDeviceSegment = 00057 createLinearDeviceSegment(tempDeviceId, nDiskPages / 50); 00058 pTempSegment = 00059 pSegmentFactory->newRandomAllocationSegment( 00060 pTempDeviceSegment, 00061 openMode.create); 00062 00063 SharedSegment pDeviceSegment = 00064 createLinearDeviceSegment(dataDeviceId, nDiskPages); 00065 pVersionedRandomSegment = 00066 pSegmentFactory->newVersionedRandomAllocationSegment( 00067 pDeviceSegment, 00068 pTempSegment, 00069 openMode.create); 00070 pSnapshotRandomSegment = 00071 pSegmentFactory->newSnapshotRandomAllocationSegment( 00072 pVersionedRandomSegment, 00073 pVersionedRandomSegment, 00074 currCsn); 00075 setForceCacheUnmap(pSnapshotRandomSegment); 00076 00077 pRandomSegment = pSnapshotRandomSegment; 00078 00079 nDiskPages /= 2; 00080 SharedSegment pLinearViewSegment = 00081 pSegmentFactory->newLinearViewSegment( 00082 pSnapshotRandomSegment, 00083 firstPageId); 00084 pLinearSegment = pLinearViewSegment; 00085 }
| void SnapshotSegmentTestBase::closeStorage | ( | | ) | [virtual, inherited] | | ------------------------------------------ | - | | - | ---------------------- |
Reimplemented from SegStorageTestBase.
Definition at line 99 of file SnapshotSegmentTestBase.cpp.
References CacheTestBase::closeDevice(), SegStorageTestBase::closeLinearSegment(), SegStorageTestBase::closeSnapshotRandomSegment(), SegStorageTestBase::closeStorage(), SegStorageTestBase::closeVersionedRandomSegment(), SnapshotSegmentTestBase::commitChanges(), SnapshotSegmentTestBase::currCsn, VersionedRandomAllocationSegment::freeTempPages(), SegStorageTestBase::pRandomSegment, SnapshotSegmentTestBase::pSnapshotRandomSegment2, SnapshotSegmentTestBase::pTempDevice, SnapshotSegmentTestBase::pTempSegment, SegStorageTestBase::pVersionedRandomSegment, and SnapshotSegmentTestBase::tempDeviceId.
Referenced by BackupRestoreTest::backup(), deallocateOldPages(), BackupRestoreTest::restore(), BackupRestoreTest::testBackupRestore(), testDeallocateOld(), testRollback(), testSnapshotReads(), testUncommittedReads(), and BackupRestoreTest::verifyData().
| void SnapshotSegmentTestBase::testAllocateAll | ( | | ) | [virtual, inherited] | | --------------------------------------------- | - | | - | ---------------------- |
| void SnapshotSegmentTestBase::verifyPage | ( | CachePage & | page, |
|---|---|---|---|
| uint | x | ||
| ) | [virtual, inherited] |
| void SnapshotSegmentTestBase::fillPage | ( | CachePage & | page, |
|---|---|---|---|
| uint | x | ||
| ) | [virtual, inherited] |
| void SegmentTestBase::openStorage | ( | DeviceMode | openMode | ) | [virtual, inherited] |
|---|
Reimplemented from SegStorageTestBase.
Definition at line 37 of file SegmentTestBase.cpp.
References PagingTestBase::cbPageUsable, PagingTestBase::OP_ALLOCATE, PagingTestBase::OP_DEALLOCATE, SegStorageTestBase::openStorage(), SegStorageTestBase::pLinearSegment, SegStorageTestBase::pRandomSegment, and ThreadedTestBase::threadCounts.
Referenced by BackupRestoreTest::backup(), deallocateOldPages(), BackupRestoreTest::restore(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), BackupRestoreTest::testBackupRestore(), testDeallocateOld(), VersionedSegmentTest::testRecovery(), testRollback(), SegmentTestBase::testSingleThread(), testSnapshotReads(), testUncommittedReads(), and BackupRestoreTest::verifyData().
Implements PagingTestBase.
Definition at line 47 of file SegmentTestBase.cpp.
References SegPageLock::allocatePage(), SegPageLock::dontUnlock(), PagingTestBase::fillPage(), Segment::getLinearBlockNum(), Segment::getLinearPageId(), PagingTestBase::getLockMode(), SegPageLock::getPage(), SegPageLock::isLocked(), SegPageLock::lockPage(), SegmentTestBase::objId, PagingTestBase::OP_ALLOCATE, PagingTestBase::OP_WRITE_RAND, PagingTestBase::OP_WRITE_SEQ, PagingTestBase::OP_WRITE_SKIP, CacheTestBase::pCache, and SegStorageTestBase::pLinearSegment.
| void SegmentTestBase::unlockPage | ( | CachePage & | page, |
|---|---|---|---|
| LockMode | lockMode | ||
| ) | [virtual, inherited] |
| void SegmentTestBase::prefetchPage | ( | uint | iPage | ) | [virtual, inherited] |
|---|
| void SegmentTestBase::prefetchBatch | ( | uint | , |
|---|---|---|---|
| uint | |||
| ) | [virtual, inherited] |
| void SegmentTestBase::testAllocate | ( | | ) | [virtual, inherited] | | ---------------------------------- | - | | - | ---------------------- |
| void SegmentTestBase::testDeallocate | ( | | ) | [virtual, inherited] | | ------------------------------------ | - | | - | ---------------------- |
| void SegmentTestBase::testCheckpoint | ( | | ) | [virtual, inherited] | | ------------------------------------ | - | | - | ---------------------- |
| void SegmentTestBase::testSingleThread | ( | | ) | [inherited] | | -------------------------------------- | - | | - | ------------- |
Definition at line 161 of file SegmentTestBase.cpp.
References SegStorageTestBase::closeStorage(), DeviceMode::createNew, SegmentTestBase::freeablePages, DeviceMode::load, SegmentTestBase::openStorage(), PagingTestBase::testAllocateAll(), PagingTestBase::testRandomRead(), PagingTestBase::testRandomWrite(), PagingTestBase::testSequentialRead(), and PagingTestBase::testSequentialWrite().
Referenced by LinearDeviceSegmentTest::LinearDeviceSegmentTest(), LinearViewSegmentTest::LinearViewSegmentTest(), SnapshotSegmentTest(), and VersionedSegmentTest::VersionedSegmentTest().
| void SegStorageTestBase::openRandomSegment | ( | | ) | [virtual, inherited] | | ------------------------------------------ | - | | - | ---------------------- |
| SharedSegment SegStorageTestBase::createLinearDeviceSegment | ( | DeviceId | deviceId, |
|---|---|---|---|
| uint | nPages | ||
| ) | [inherited] |
| void SegStorageTestBase::closeLinearSegment | ( | | ) | [inherited] | | ------------------------------------------- | - | | - | ------------- |
| void SegStorageTestBase::closeRandomSegment | ( | | ) | [inherited] | | ------------------------------------------- | - | | - | ------------- |
| void SegStorageTestBase::closeVersionedRandomSegment | ( | | ) | [inherited] | | ---------------------------------------------------- | - | | - | ------------- |
| void SegStorageTestBase::closeSnapshotRandomSegment | ( | | ) | [inherited] | | --------------------------------------------------- | - | | - | ------------- |
| Cache & CacheTestBase::getCache | ( | | ) | [inherited] | | -------------------------------------------------- | - | | - | ------------- |
| SharedCache CacheTestBase::newCache | ( | | ) | [virtual, inherited] | | --------------------------------------------------------------------------------------------- | - | | - | ---------------------- |
| void CacheTestBase::testCaseTearDown | ( | | ) | [virtual, inherited] | | ------------------------------------ | - | | - | ---------------------- |
Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.
Default is no-op.
Reimplemented from TestBase.
Reimplemented in LbmEntryTest, LbmLoadBitmapTest, LbmSearchTest, LcsClusterAppendExecStreamTest, LcsClusterReplaceExecStreamTest, LcsMultiClusterAppendTest, LcsRowScanExecStreamTest, BTreeReadersTest, BTreeTest, ExecStreamTestBase, and LhxHashTableTest.
Definition at line 125 of file CacheTestBase.cpp.
References CacheTestBase::closeStorage().
Referenced by LhxHashTableTest::testCaseTearDown(), ExecStreamTestBase::testCaseTearDown(), BTreeTest::testCaseTearDown(), BTreeReadersTest::testCaseTearDown(), and LbmEntryTest::testCaseTearDown().
| void TestBase::snooze | ( | uint | nSeconds | ) | [protected, inherited] |
|---|
| void TestBase::readParams | ( | int | argc, |
|---|---|---|---|
| char ** | argv | ||
| ) | [static, inherited] |
Parses the command line.
format: [-v] [-t TEST | -all] {param=val}* [CONFIGFILE | -] Normally, the test program runs the default test cases. With the option "-all", runs the extra test cases as well. With the option "-t TEST", runs only the single test case named TEST. CONFIGFILE is read to load configuration parameters. Configuration parameters can also be set ad hoc, from the command line, as pairs name=val. These take precedence.
Definition at line 108 of file TestBase.cpp.
References TestBase::configMap, ConfigMap::dumpParams(), ConfigMap::isParamSet(), ConfigMap::mergeFrom(), TestBase::paramDictionaryFileName, ConfigMap::readParams(), TestBase::runAll, TestBase::runSingle, ConfigMap::setStringParam(), and verbose.
00109 {
00110 bool verbose = false;
00111 ConfigMap adhocMap;
00112
00113 for (int i = 1; i < argc; ++i) {
00114 std::string arg = argv[i];
00115 if (argv[i][0] == '-') {
00116 if (arg == "-v") {
00117 verbose = true;
00118 } else if (arg == "-") {
00119 configMap.readParams(std::cin);
00120 } else if (arg == "-all") {
00121 runAll = true;
00122 } else if (arg == "-t") {
00123 permAssert(i + 1 < argc);
00124 runSingle = argv[++i];
00125 } else if (arg[1] == 't') {
00126 runSingle = arg.substr(2);
00127 }
00128 } else {
00129 int i = arg.find("=");
00130 if ((0 < i) && (i < arg.size())) {
00131
00132 std::string key = arg.substr(0,i);
00133 std::string val = arg.substr(i + 1);
00134 adhocMap.setStringParam(key,val);
00135 } else {
00136
00137 std::ifstream configFile(arg.c_str());
00138 assert(configFile.good());
00139 configMap.readParams(configFile);
00140 }
00141 }
00142 }
00143 configMap.mergeFrom(adhocMap);
00144
00145
00146
00147 if (.isParamSet(paramDictionaryFileName)) {
00148 std::string dictFileName = "dictWords";
00149 configMap.setStringParam(paramDictionaryFileName,dictFileName);
00150 }
00151
00152 if (verbose) {
00153 configMap.dumpParams(std::cout);
00154 }
00155 }
| TestSuite * TestBase::releaseTestSuite | ( | | ) | [inherited] | | ---------------------------------------------------------------------------------------------- | - | | - | ------------- |
| void TestBase::beforeTestCase | ( | std::string | testCaseName | ) | [inherited] |
|---|
| void TestBase::afterTestCase | ( | std::string | testCaseName | ) | [inherited] |
|---|
| void TestBase::notifyTrace | ( | std::string | source, |
|---|---|---|---|
| TraceLevel | level, | ||
| std::string | message | ||
| ) | [virtual, inherited] |
| TraceLevel TestBase::getSourceTraceLevel | ( | std::string | source | ) | [virtual, inherited] |
|---|
| uint PagingTestBase::generateRandomNumber | ( | uint | iMax | ) | [protected, inherited] |
|---|
| bool PagingTestBase::testOp | ( | OpType | opType, |
|---|---|---|---|
| uint | iPage, | ||
| bool | bNice | ||
| ) | [inherited] |
Carries out one operation on a page.
This involves locking the page, calling verifyPage or fillPage, and then unlocking the page.
Parameters:
| opType | operation which will be attempted |
|---|---|
| iPage | block number of page |
| bNice | true if page should be marked as nice as part of access |
Returns:
true if the operation was successfully carried out; false if NoWait locking was requested and the page lock could not be acquired
Definition at line 85 of file PagingTestBase.cpp.
References PagingTestBase::fillPage(), CacheTestBase::getCache(), PagingTestBase::getLockMode(), LOCKMODE_S, LOCKMODE_S_NOWAIT, LOCKMODE_X, LOCKMODE_X_NOWAIT, PagingTestBase::lockPage(), CacheAccessor::nicePage(), PagingTestBase::unlockPage(), and PagingTestBase::verifyPage().
Referenced by PagingTestBase::testRandomOp(), PagingTestBase::testSequentialOp(), and PagingTestBase::testSkipOp().
| char const * PagingTestBase::getOpName | ( | OpType | opType | ) | [inherited] |
|---|
Gets the LockMode corresponding to an OpType.
Definition at line 143 of file PagingTestBase.cpp.
References LOCKMODE_S, LOCKMODE_S_NOWAIT, LOCKMODE_X, LOCKMODE_X_NOWAIT, PagingTestBase::OP_ALLOCATE, PagingTestBase::OP_READ_NOWAIT, PagingTestBase::OP_READ_RAND, PagingTestBase::OP_READ_SEQ, PagingTestBase::OP_WRITE_NOWAIT, PagingTestBase::OP_WRITE_RAND, PagingTestBase::OP_WRITE_SEQ, and PagingTestBase::OP_WRITE_SKIP.
Referenced by SegmentTestBase::lockPage(), CacheTest::lockPage(), and PagingTestBase::testOp().
| void PagingTestBase::testSequentialOp | ( | OpType | opType | ) | [inherited] |
|---|
| void PagingTestBase::testRandomOp | ( | OpType | opType | ) | [inherited] |
|---|
| void PagingTestBase::testSkipOp | ( | OpType | opType, |
|---|---|---|---|
| uint | n | ||
| ) | [inherited] |
| void PagingTestBase::testScratch | ( | | ) | [inherited] | | -------------------------------- | - | | - | ------------- |
| void PagingTestBase::testPrefetch | ( | | ) | [inherited] | | --------------------------------- | - | | - | ------------- |
| void PagingTestBase::testPrefetchBatch | ( | | ) | [inherited] | | -------------------------------------- | - | | - | ------------- |
| void PagingTestBase::testSequentialRead | ( | | ) | [inherited] | | --------------------------------------- | - | | - | ------------- |
| void PagingTestBase::testSequentialWrite | ( | | ) | [inherited] | | ---------------------------------------- | - | | - | ------------- |
| void PagingTestBase::testRandomRead | ( | | ) | [inherited] | | ----------------------------------- | - | | - | ------------- |
| void PagingTestBase::testRandomWrite | ( | | ) | [inherited] | | ------------------------------------ | - | | - | ------------- |
| void PagingTestBase::testSkipWrite | ( | uint | n | ) | [inherited] |
|---|
| void PagingTestBase::testCheckpointGuarded | ( | | ) | [inherited] | | ------------------------------------------ | - | | - | ------------- |
| void PagingTestBase::testCacheResize | ( | | ) | [inherited] | | ------------------------------------ | - | | - | ------------- |
| void PagingTestBase::testMultipleThreads | ( | | ) | [inherited] | | ---------------------------------------- | - | | - | ------------- |
| void PagingTestBase::threadInit | ( | | ) | [virtual, inherited] | | ------------------------------- | - | | - | ---------------------- |
| void PagingTestBase::threadTerminate | ( | | ) | [virtual, inherited] | | ------------------------------------ | - | | - | ---------------------- |
| bool PagingTestBase::testThreadedOp | ( | int | iOp | ) | [virtual, inherited] |
|---|
Test implementation must be supplied by derived test class.
Parameters:
| iOp | operation type to test |
|---|
Returns:
true if test should run again
Implements ThreadedTestBase.
Definition at line 378 of file PagingTestBase.cpp.
References PagingTestBase::checkpointMutex, SXMutexGuard< lockMode >::lock(), PagingTestBase::OP_ALLOCATE, PagingTestBase::OP_CHECKPOINT, PagingTestBase::OP_DEALLOCATE, PagingTestBase::OP_MAX, PagingTestBase::OP_PREFETCH, PagingTestBase::OP_PREFETCH_BATCH, PagingTestBase::OP_READ_NOWAIT, PagingTestBase::OP_READ_RAND, PagingTestBase::OP_READ_SEQ, PagingTestBase::OP_RESIZE_CACHE, PagingTestBase::OP_SCRATCH, PagingTestBase::OP_WRITE_NOWAIT, PagingTestBase::OP_WRITE_RAND, PagingTestBase::OP_WRITE_SEQ, PagingTestBase::OP_WRITE_SKIP, PagingTestBase::testAllocate(), PagingTestBase::testCacheResize(), PagingTestBase::testCheckpointGuarded(), PagingTestBase::testDeallocate(), PagingTestBase::testPrefetch(), PagingTestBase::testPrefetchBatch(), PagingTestBase::testRandomOp(), PagingTestBase::testScratch(), PagingTestBase::testSequentialOp(), and PagingTestBase::testSkipOp().
| void ThreadedTestBase::runThreadedTestCase | ( | | ) | [protected, inherited] | | ------------------------------------------ | - | | - | ------------------------ |
Member Data Documentation
Definition at line 44 of file SnapshotSegmentTestBase.h.
Referenced by SnapshotSegmentTestBase::closeStorage(), deallocateOldPages(), SnapshotSegmentTestBase::fillPage(), SnapshotSegmentTestBase::openSegmentStorage(), BackupRestoreTest::testBackupRestore(), SnapshotSegmentTestBase::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), testDeallocateOld(), testRollback(), testSnapshotReads(), testUncommittedReads(), and SnapshotSegmentTestBase::verifyPage().
Definition at line 40 of file SegStorageTestBase.h.
Referenced by BackupRestoreTest::backup(), SegStorageTestBase::createLinearDeviceSegment(), LogicalTxnTest::createRecoveryLog(), LbmSearchTest::initBTreeExecStreamParam(), LbmLoadBitmapTest::initBTreeExecStreamParam(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), LbmMinusExecStreamTest::newMinusStream(), ExecStreamTestBase::newStreamGraphEmbryo(), SegStorageTestBase::openRandomSegment(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), BackupRestoreTest::restore(), SegStorageTestBase::SegStorageTestBase(), LbmSplicerExecStreamTest::spliceInput(), ExecStreamTestSuite::testBTreeInsertExecStream(), LhxHashTableTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LhxAggExecStreamTest::testCountImpl(), ExecStreamTestSuite::testDoubleBufferExecStream(), ExecStreamGovernorTest::testGovernor(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmIntersectExecStreamTest::testIntersect(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), LbmEntryTest::testMergeEntry(), BTreeTest::testMultiKeySearches(), BTreeTest::testScan(), ExecStreamTestSuite::testScratchBufferExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), FlatFileExecStreamTest::testStream(), LhxAggExecStreamTest::testSumImpl(), LogicalTxnTest::testTxn(), testUncommittedReads(), LbmUnionExecStreamTest::testUnion(), SegStreamTest::testWriteSpillAndRead(), and LbmEntryTest::testZeroBytes().
Segment supporting linear page allocation.
Definition at line 45 of file SegStorageTestBase.h.
Referenced by SegStorageTestBase::closeLinearSegment(), LogicalTxnTest::createRecoveryLog(), SegmentTestBase::lockPage(), SegStorageTestBase::openRandomSegment(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), SegmentTestBase::openStorage(), SegmentTestBase::prefetchPage(), SnapshotSegmentTestBase::testAllocateAll(), LinearViewSegmentTest::testAllocateAll(), VersionedSegmentTest::testCheckpoint(), SegmentTestBase::testCheckpoint(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), VersionedSegmentTest::testRecovery(), LogicalTxnTest::testTxn(), testUncommittedReads(), SegStreamTest::testWriteSeg(), and VersionedSegmentTest::verifyPage().
(Optional) segment supporting random page allocation.
Definition at line 50 of file SegStorageTestBase.h.
Referenced by SegStorageTestBase::closeRandomSegment(), SnapshotSegmentTestBase::closeStorage(), LbmSplicerExecStreamTest::createBTree(), LbmSplicerExecStreamTest::initBTreeParam(), LbmSearchTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeTupleDesc(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), SegStorageTestBase::openRandomSegment(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), SegmentTestBase::openStorage(), SegmentTestBase::testAllocate(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), ExecStreamTestSuite::testBTreeInsertExecStream(), BTreeTest::testBulkLoad(), LhxHashTableTest::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LcsRowScanExecStreamTest::testCaseSetUp(), LcsMultiClusterAppendTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testCaseSetUp(), LcsClusterAppendExecStreamTest::testCaseSetUp(), LbmExecStreamTestBase::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LhxAggExecStreamTest::testCountImpl(), SegmentTestBase::testDeallocate(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), ExecStreamTestSuite::testMergeImplicitPullInputs(), BTreeTest::testMultiKeySearches(), BTreeReadersTest::testReaders(), LcsRowScanExecStreamTest::testScanOnEmptyCluster(), ExecStreamTestSuite::testSegBufferExecStream(), ExecStreamTestSuite::testSegBufferReaderWriterExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LhxAggExecStreamTest::testSumImpl(), and LbmUnionExecStreamTest::testUnion().
Cache instance being tested.
Definition at line 63 of file CacheTestBase.h.
Referenced by BackupRestoreTest::backup(), CacheTestBase::closeDevice(), CacheTestBase::closeStorage(), LbmSplicerExecStreamTest::createBTree(), SegStorageTestBase::createLinearDeviceSegment(), LogicalTxnTest::createRecoveryLog(), BackupRestoreTest::createSnapshotData(), BackupRestoreTest::executeSnapshotTxn(), CacheTestBase::getCache(), LbmSearchTest::initBTreeExecStreamParam(), LbmLoadBitmapTest::initBTreeExecStreamParam(), LbmSearchTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeParam(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), SegmentTestBase::lockPage(), LbmMinusExecStreamTest::newMinusStream(), ExecStreamTestBase::newStreamGraphEmbryo(), CacheTestBase::openDevice(), CacheTestBase::openStorage(), LcsClusterReplaceExecStreamTest::replaceCluster(), BackupRestoreTest::restore(), LbmSplicerExecStreamTest::spliceInput(), SegmentTestBase::testAllocate(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), BackupRestoreTest::testBackupCleanup(), ExecStreamTestSuite::testBTreeInsertExecStream(), BTreeTest::testBulkLoad(), LhxHashTableTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LhxAggExecStreamTest::testCountImpl(), SegmentTestBase::testDeallocate(), testDeallocateOld(), ExecStreamTestSuite::testDoubleBufferExecStream(), ExecStreamGovernorTest::testGovernor(), LhxAggExecStreamTest::testGroupCountImpl(), BackupRestoreTest::testHeaderBackupRestore(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmIntersectExecStreamTest::testIntersect(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), CacheTest::testLargeCacheInit(), CacheTest::testLargeCacheRequest(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), SegStreamTest::testMarkReset(), LbmEntryTest::testMergeEntry(), BTreeTest::testMultiKeySearches(), CacheTest::testQuotaCacheAccessor(), BTreeReadersTest::testReaders(), SegStreamTest::testReadSeg(), BTreeTest::testScan(), LcsRowScanExecStreamTest::testScanOnEmptyCluster(), ExecStreamTestSuite::testScratchBufferExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), FlatFileExecStreamTest::testStream(), LhxAggExecStreamTest::testSumImpl(), LogicalTxnTest::testTxn(), LogicalTxnTest::testTxnIdSequence(), LbmUnionExecStreamTest::testUnion(), SegStreamTest::testWriteSeg(), SegStreamTest::testWriteSpillAndRead(), LbmEntryTest::testZeroBytes(), and BackupRestoreTest::verifySnapshotData().
Size of device in disk pages.
Definition at line 78 of file CacheTestBase.h.
Referenced by CacheTestBase::CacheTestBase(), LinearViewSegmentTest::LinearViewSegmentTest(), CacheTest::makeBlockId(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), CacheTestBase::openStorage(), SegStreamTest::SegStreamTest(), SnapshotSegmentTestBase::SnapshotSegmentTestBase(), testDeallocateOld(), PagingTestBase::testPrefetch(), PagingTestBase::testPrefetchBatch(), PagingTestBase::testRandomOp(), testRollback(), PagingTestBase::testSequentialOp(), and PagingTestBase::testSkipOp().
Configuration parameters.
The reason this is static is so that no constructor parameters (which burden virtual bases) are needed.
Definition at line 155 of file TestBase.h.
Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), BTreeTxnTest::BTreeTxnTest(), CacheTestBase::CacheTestBase(), BackupRestoreTest::createSnapshotData(), DatabaseTest::DatabaseTest(), TestOptionsTest::extra(), DatabaseTest::loadDatabase(), SparseBitmapTest::openStorage(), PagingTestBase::PagingTestBase(), ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest(), RandomAccessFileDeviceTest::RandomAccessFileDeviceTest(), TestBase::readParams(), SegStorageTestBase::SegStorageTestBase(), TestOptionsTest::test1(), TestOptionsTest::test2(), BackupRestoreTest::testBackupCleanup(), TestBase::TestBase(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCheckpoint(), DatabaseTest::testCreateEmpty(), DatabaseTest::testForceTxns(), BackupRestoreTest::testHeaderBackupRestore(), SegPageEntryIterTest::testIter(), SegStreamTest::testRead(), BTreeTxnTest::testTxns(), SegStreamTest::testWrite(), ThreadedTestBase::ThreadedTestBase(), and TestBase::~TestBase().
The documentation for this class was generated from the following file:
- /home/pub/open/dev/fennel/test/SnapshotSegmentTest.cpp
