Due to the large variety of operating systems and Java platforms typically used with LmdbJava, this class provides a convenient verification of correct operating behavior through a potentially long duration set of tests that carefully verify correct storage and retrieval of successively larger database entries.
The verifier currently operates by incrementing a long
identifier that deterministically maps to a given Dbi and value size.
The key is simply the long identifier. The value commences with
a CRC that includes the identifier and the random bytes of the value. Each
entry is written out, and then the prior entry is retrieved using its key.
The prior entry's value is evaluated for accuracy and then deleted.
Transactions are committed in batches to ensure successive transactions
correctly retrieve the results of earlier transactions.
Please note the verification approach may be modified in the future.
If an exception is raised by this class, please:
- Ensure the
Envpassed at construction time complies with the requirements specified atVerifier(org.lmdbjava.Env) - Attempt to use a different file system to store the database (be especially careful to not use network file systems, remote file systems, read-only file systems etc)
- Record the full exception message and stack trace, then run the verifier again to see if it fails at the same or a different point
- Raise a ticket on the LmdbJava Issue Tracker that confirms the above details along with the failing operating system and Java version
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of DBIs the created environment should allow. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DBI_COUNT
public static final int DBI_COUNTNumber of DBIs the created environment should allow.- See Also:
-
-
Constructor Details
-
Verifier
Create an instance of the verifier.The caller must provide an
Envconfigured with a suitable local storage location, maximum DBIs equal toDBI_COUNT, and a map size large enough to accommodate the intended verification duration.ALL EXISTING DATA IN THE DATABASE WILL BE DELETED. The caller must not interact with the
Envin any way (eg querying, transactions etc) while the verifier is executing.- Parameters:
env- target that complies with the above requirements (required)
-
-
Method Details
-
call
Run the verifier untilstop()is called or an exception occurs.Successful return of this method indicates no faults were detected. If any fault was detected the exception message will detail the exact point that the fault was encountered.
-
runFor
Execute the verifier for the given duration.This provides a simple way to execute the verifier for those applications which do not wish to manage threads directly.
- Parameters:
duration- amount of time to executeunit- units used to express the duration- Returns:
- number of database rows successfully verified
-