JBoss.orgCommunity Documentation

Chapter 40. Checking repository integrity and consistency

40.1. Recommendations on how to fix corrupted JCR

Production and any other system may have faults some day. They may be caused by hardware problems, human faults, software errors during updates and many other circumstances. It is important to check integrity and consistency of the system if there is no backup or it is stale, or recovery process takes much. Exo JCR implementation offers an innovative JMX-based complex checking tool. Running inspection, tool check every major JCR component, such as persistent data layer and index. Persistent layer includes JDBC Data Container and Value-Storages if they are configured. Database verified using the set of complex specialized domain-specific queries. Value Storage tool checks existence and access to each file. Index verification contains two-way pass cycle, existence of each node in index checks on persistent layer along with opposite direction, when each node from Data Container validated in index. Access to check tool is exposed via JMX interface, with the following operation available:

Table 40.1. Check methods

checkAll()Inspect full repository data (db, value storage and search index)
checkDataBase()Inspect only DB
checkValueStorage()Inspect only ValueStorage
checkIndex()Inspect only SearchIndex

Also tools provides abilities to repair possible inconsistencies:

  • Item has no parent node - properties will be removed and root UUID will be assigned in case of nodes

  • Node has a single valued property with nothing declared in the VALUE table - property will be removed if it is not required by primary type of its node

  • Node has no primary type property - node and whole subtree will be removed if node is not required by primary type of its parent

  • Value record has no related property record - value record will be removed from database

  • Item is its own parent - properties will be removed and root UUID will be assigned in case of nodes

  • Several versions of same item - all earler records with earler versions will be removed from ITEM table

  • Reference properties without reference records - property will be removed if it is not required by primary type of its node

  • Node is marked as locked in the lockmanager's table but is not in the ITEM table or the opposite - all lock inconsistencies will be removed from both tables

  • Property's value is stored in the File System but content is missing - new empty file corresponding to value will be created

Table 40.2. Repair methods

repairDataBase()repair DB
repairValueStorage()repair ValueStorage

All tool activities are stored in file, which can be found in app directory by name report-<repository name>-dd-MMM-yy-HH-mm.txt.

Please, before applying the next recommendations, don't forget to backup your data first. To get the JCR back to normal mode you may require to remove potentially valuable data. It is also recommended to keep the results of queries that check data consistency. This may be needed for the support team in case of deeper restoration process.

Here are listed the examples of corruptions and ways to eliminate them:

  1. Item has no parent node

  2. Node has a single valued properties with no declaration in VALUE table

  3. Node has no primary type property

  4. All value records have no related property record

  5. Corrupted VALUE records. Both STORAGE_DESC and DATA fields contain not null value

  6. Item is its own parent

  7. Several versions of same item

  8. Reference properties without reference records

  9. Node, considered to be locked in the lockmanager data, is not locked according to the jcr data or the opposite situation

  10. A property's value is stored in the file system, but its content is missing

    This cannot be checked via simple SQL queries