Java Doc for SecondaryDirtyReadTest.java in  » JMX » je » com » sleepycat » je » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » je » com.sleepycat.je.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sleepycat.je.test.TxnTestCase
   com.sleepycat.je.test.MultiKeyTxnTestCase
      com.sleepycat.je.test.SecondaryDirtyReadTest

SecondaryDirtyReadTest
public class SecondaryDirtyReadTest extends MultiKeyTxnTestCase (Code)
Tests for multithreading problems when using read-uncommitted with secondaries. If a primary record is updated while performing a read-uncommitted (in between reading the secondary and the primary), we need to be sure that we don't return inconsistent results to the user. For example, we should not return a primary data value that no longer contains the secondary key. We also need to ensure that deleting a primary record in the middle of a secondary read does not appear as a corrupt secondary. In both of these cases it should appear that the record does not exist, from the viewpoint of an application using a cursor.

These tests create two threads, one reading and the other deleting or updating. The intention is for reading thread and the delete/update thread to race in operating on the same key (nextKey). If the reading thread reads the secondary, then the other thread deletes the primary, then the reading thread tries to read the primary, we've accomplished our goal. Prior to when we handled that case in SecondaryCursor, that situation would cause a "secondary corrupt" exception.





Method Summary
public  voiddoTest(String method1, String method2)
     Runs two threads for the given method names, after populating the database.
public  voidrunPrimaryDelete()
     Deletes the key that is being read by the other thread.
public  voidrunPrimaryUpdate()
     Updates the record for the key that is being read by the other thread, changing the datum to -1 so it will cause the secondary key record to be deleted.
public  voidrunReadUncommittedByKey()
     Does a read-uncommitted by key, retrying until it is deleted by the delete/update thread, then moves to the next key.
public  voidrunReadUncommittedScan()
     Does a read-uncommitted scan through the whole key range, but moves forward only after the key is deleted by the delete/update thread.
public static  Testsuite()
    
public  voidtearDown()
     Closes databases, then calls the super.tearDown to close the env.
public  voidtestDeleteWhileReadingByKey()
     Tests that deleting primary records does not cause secondary read-uncommitted to throw a "secondary corrupt" exception.
public  voidtestDeleteWhileScanning()
     Same as testDeleteWhileReadingByKey but does a scan.
public  voidtestUpdateWhileReadingByKey()
     Tests that updating primary records, to cause deletion of the secondary key record, does not cause secondary read-uncommitted to return inconsistent data (a primary datum without a secondary key value).
public  voidtestUpdateWhileScanning()
     Same as testUpdateWhileReadingByKey but does a scan.



Method Detail
doTest
public void doTest(String method1, String method2) throws Throwable(Code)
Runs two threads for the given method names, after populating the database.



runPrimaryDelete
public void runPrimaryDelete() throws DatabaseException(Code)
Deletes the key that is being read by the other thread.



runPrimaryUpdate
public void runPrimaryUpdate() throws DatabaseException(Code)
Updates the record for the key that is being read by the other thread, changing the datum to -1 so it will cause the secondary key record to be deleted.



runReadUncommittedByKey
public void runReadUncommittedByKey() throws DatabaseException(Code)
Does a read-uncommitted by key, retrying until it is deleted by the delete/update thread, then moves to the next key. We shouldn't get an exception, just a NOTFOUND when it is deleted.



runReadUncommittedScan
public void runReadUncommittedScan() throws DatabaseException(Code)
Does a read-uncommitted scan through the whole key range, but moves forward only after the key is deleted by the delete/update thread. We shouldn't get an exception or a NOTFOUND, but we may skip values when a key is deleted.



suite
public static Test suite()(Code)



tearDown
public void tearDown() throws Exception(Code)
Closes databases, then calls the super.tearDown to close the env.



testDeleteWhileReadingByKey
public void testDeleteWhileReadingByKey() throws Throwable(Code)
Tests that deleting primary records does not cause secondary read-uncommitted to throw a "secondary corrupt" exception.



testDeleteWhileScanning
public void testDeleteWhileScanning() throws Throwable(Code)
Same as testDeleteWhileReadingByKey but does a scan. Read-uncommitted for scan and keyed reads are implemented differently, since scanning moves to the next record when a deletion is detected while a keyed read returns NOTFOUND.



testUpdateWhileReadingByKey
public void testUpdateWhileReadingByKey() throws Throwable(Code)
Tests that updating primary records, to cause deletion of the secondary key record, does not cause secondary read-uncommitted to return inconsistent data (a primary datum without a secondary key value).



testUpdateWhileScanning
public void testUpdateWhileScanning() throws Throwable(Code)
Same as testUpdateWhileReadingByKey but does a scan.



Fields inherited from com.sleepycat.je.test.MultiKeyTxnTestCase
boolean useMultiKey(Code)(Java Doc)

Methods inherited from com.sleepycat.je.test.MultiKeyTxnTestCase
static TestSuite multiKeyTxnTestSuite(Class testCaseClass, EnvironmentConfig envConfig, String[] txnTypes)(Code)(Java Doc)
public void tearDown() throws Exception(Code)(Java Doc)

Fields inherited from com.sleepycat.je.test.TxnTestCase
final public static String TXN_AUTO(Code)(Java Doc)
final public static String TXN_NULL(Code)(Java Doc)
final public static String TXN_USER(Code)(Java Doc)
protected Environment env(Code)(Java Doc)
protected EnvironmentConfig envConfig(Code)(Java Doc)
protected File envHome(Code)(Java Doc)
protected boolean isTransactional(Code)(Java Doc)
protected String txnType(Code)(Java Doc)

Methods inherited from com.sleepycat.je.test.TxnTestCase
public void closeEnv() throws DatabaseException(Code)(Java Doc)
public void openEnv() throws DatabaseException(Code)(Java Doc)
public void runTest() throws Throwable(Code)(Java Doc)
public void setUp() throws Exception(Code)(Java Doc)
public void tearDown() throws Exception(Code)(Java Doc)
protected void txnAbort(Transaction txn) throws DatabaseException(Code)(Java Doc)
protected Transaction txnBegin() throws DatabaseException(Code)(Java Doc)
protected Transaction txnBegin(Transaction parentTxn, TransactionConfig config) throws DatabaseException(Code)(Java Doc)
protected Transaction txnBeginCursor() throws DatabaseException(Code)(Java Doc)
protected Transaction txnBeginCursor(Transaction parentTxn, TransactionConfig config) throws DatabaseException(Code)(Java Doc)
protected void txnCommit(Transaction txn) throws DatabaseException(Code)(Java Doc)
public static TestSuite txnTestSuite(Class testCaseClass, EnvironmentConfig envConfig, String[] txnTypes)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.