Class BTreeFileVerifier
java.lang.Object
edu.caltech.nanodb.storage.btreefile.BTreeFileVerifier
This class provides some simple verification operations for B+
tree tuple files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classThis helper class is used to keep track of details of pages within the B+ tree file.private static classThis runtime exception class is used to abort the verification scan. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DBFileThe actualDBFileobject backing the tuple-file, since it is used so frequently in the verification.The collection of errors found during the verification process.private static org.apache.logging.log4j.LoggerA logging object for reporting anything interesting that happens.private HashMap<Integer, BTreeFileVerifier.PageInfo> This collection maps individual B+ tree pages to the details that the verifier collects for each page.private StorageManagerA reference to the storage manager since we use it so much.private BTreeTupleFileThe B+ tree tuple file to verify. -
Constructor Summary
ConstructorsConstructorDescriptionBTreeFileVerifier(StorageManager storageManager, BTreeTupleFile tupleFile) Initialize a verifier object to verify a specific B+ tree tuple file. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidThis method implements pass 1 of the verification process: scanning through all pages in the tuple file, collecting basic details about each page.private voidThis method implements pass 2 of the verification process: performing a tree-scan through the entire tuple file, starting with the root page of the file.private voidprivate voidprivate voidprivate voidThis helper function traverses the B+ tree structure, verifying various invariants that should hold on the file structure.verify()This method is the entry-point for the verification process.
-
Field Details
-
logger
private static org.apache.logging.log4j.Logger loggerA logging object for reporting anything interesting that happens. -
storageManager
A reference to the storage manager since we use it so much. -
tupleFile
The B+ tree tuple file to verify. -
dbFile
The actualDBFileobject backing the tuple-file, since it is used so frequently in the verification. -
pages
This collection maps individual B+ tree pages to the details that the verifier collects for each page. -
errors
The collection of errors found during the verification process.
-
-
Constructor Details
-
BTreeFileVerifier
Initialize a verifier object to verify a specific B+ tree tuple file.
-
-
Method Details
-
verify
This method is the entry-point for the verification process. It performs multiple passes through the file structure to identify various issues. Any errors that are identified are returned in the collection of error messages.- Returns:
- a list of error messages describing issues found with the
tuple file's structure. If no errors are detected, this will
be an empty list, not
null.
-
pass1ScanThruAllPages
private void pass1ScanThruAllPages()This method implements pass 1 of the verification process: scanning through all pages in the tuple file, collecting basic details about each page. -
pass2TreeScanThruFile
private void pass2TreeScanThruFile()This method implements pass 2 of the verification process: performing a tree-scan through the entire tuple file, starting with the root page of the file. -
scanTree
This helper function traverses the B+ tree structure, verifying various invariants that should hold on the file structure. -
pass3ScanThruLeafList
private void pass3ScanThruLeafList() -
pass4ScanThruEmptyList
private void pass4ScanThruEmptyList() -
pass5ExaminePageReachability
private void pass5ExaminePageReachability()
-