Search in sources :

Example 1 with DbConsistencyChecker

use of com.emc.storageos.db.client.impl.DbConsistencyChecker in project coprhd-controller by CoprHD.

the class DBClient method checkDB.

/**
 * This db consistency check is for the whole database and we could detect,
 * 1. The data object record exists but related indices are missing, the scope is the whole db, it will scan all the CFs, from one to
 * next.
 * 2. The index exists but related data object records are missing, the scope is the whole db too, it will scan from one index to next.
 *
 * The indices here means all the indices of each filed of the data object record. If inconsistency found, it will generate several
 * files to do the cleanup work, including rebuilding index.
 */
public void checkDB() {
    try {
        DbConsistencyCheckerHelper helper = new DbConsistencyCheckerHelper(_dbClient);
        DbConsistencyChecker checker = new DbConsistencyChecker(helper, true);
        int corruptedCount = checker.check();
        String msg = generateSummaryForDBChecker(corruptedCount != 0);
        System.out.println(msg);
        log.info(msg);
    } catch (ConnectionException e) {
        log.error("Database connection exception happens, fail to connect: ", e);
        System.err.println("The checker has been stopped by database connection exception. " + "Please see the log for more information.");
    } finally {
        DbCheckerFileWriter.close();
    }
}
Also used : DbConsistencyCheckerHelper(com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper) DbConsistencyChecker(com.emc.storageos.db.client.impl.DbConsistencyChecker) ConnectionException(com.netflix.astyanax.connectionpool.exceptions.ConnectionException)

Aggregations

DbConsistencyChecker (com.emc.storageos.db.client.impl.DbConsistencyChecker)1 DbConsistencyCheckerHelper (com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper)1 ConnectionException (com.netflix.astyanax.connectionpool.exceptions.ConnectionException)1