Search in sources :

Example 1 with DbConsistencyStatus

use of com.emc.storageos.coordinator.client.model.DbConsistencyStatus in project coprhd-controller by CoprHD.

the class DbConsistencyChecker method checkObjectIndices.

/**
 * Scan all the data object records, to find out the object record is existing
 * but the related index is missing.
 *
 * @return The number of corrupted data
 * @throws ConnectionException
 */
private int checkObjectIndices() throws ConnectionException {
    CheckType checkType = CheckType.OBJECT_INDICES;
    helper.logMessage(DbConsistencyCheckerHelper.MSG_OBJECT_INDICES_START, false, toConsole);
    DbConsistencyStatus status = getStatusFromZk();
    Collection<DataObjectType> resumeDataCfs = resumeFromWorkingPoint(checkType, status.getWorkingPoint());
    CheckResult checkResult = new CheckResult();
    for (DataObjectType dataCf : resumeDataCfs) {
        helper.checkCFIndices(dataCf, toConsole, checkResult);
        status = getStatusFromZk();
        if (!toConsole && isCancelled(status)) {
            cancel(status);
        }
        if (!toConsole) {
            status.update(this.totalCount, checkType.name(), dataCf.getCF().getName(), checkResult.getTotal());
            persistStatus(status);
        }
    }
    String msg = String.format(DbConsistencyCheckerHelper.MSG_OBJECT_INDICES_END, resumeDataCfs.size(), checkResult.getTotal());
    helper.logMessage(checkResult.toString(), false, toConsole);
    helper.logMessage(msg, false, toConsole);
    return checkResult.getTotal();
}
Also used : DbConsistencyStatus(com.emc.storageos.coordinator.client.model.DbConsistencyStatus) CheckResult(com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper.CheckResult)

Example 2 with DbConsistencyStatus

use of com.emc.storageos.coordinator.client.model.DbConsistencyStatus in project coprhd-controller by CoprHD.

the class DbConsistencyChecker method checkIndexObjects.

/**
 * Scan all the indices and related data object records, to find out
 * the index record is existing but the related data object records is missing.
 *
 * @return the number of the corrupted rows in the index CFs
 * @throws ConnectionException
 */
private int checkIndexObjects() throws ConnectionException {
    CheckType checkType = CheckType.INDEX_OBJECTS;
    helper.logMessage(DbConsistencyCheckerHelper.MSG_INDEX_OBJECTS_START, false, toConsole);
    DbConsistencyStatus status = getStatusFromZk();
    Collection<IndexAndCf> resumeIdxCfs = resumeFromWorkingPoint(checkType, status.getWorkingPoint());
    CheckResult checkResult = new CheckResult();
    for (IndexAndCf indexAndCf : resumeIdxCfs) {
        helper.checkIndexingCF(indexAndCf, toConsole, checkResult);
        status = getStatusFromZk();
        if (!toConsole && isCancelled(status)) {
            cancel(status);
        }
        if (!toConsole) {
            status.update(this.totalCount, checkType.name(), indexAndCf.generateKey(), checkResult.getTotal());
            persistStatus(status);
        }
    }
    String msg = String.format(DbConsistencyCheckerHelper.MSG_INDEX_OBJECTS_END, resumeIdxCfs.size(), checkResult.getTotal());
    helper.logMessage(checkResult.toString(), false, toConsole);
    helper.logMessage(msg, false, toConsole);
    return checkResult.getTotal();
}
Also used : DbConsistencyStatus(com.emc.storageos.coordinator.client.model.DbConsistencyStatus) CheckResult(com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper.CheckResult) IndexAndCf(com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper.IndexAndCf)

Example 3 with DbConsistencyStatus

use of com.emc.storageos.coordinator.client.model.DbConsistencyStatus in project coprhd-controller by CoprHD.

the class DbConsistencyChecker method checkObjectId.

/**
 * Find out all rows in DataObject CFs that can't be deserialized,
 * such as such as object id cannot be converted to URI.
 *
 * @return number of the corrupted rows in data CFs
 */
private int checkObjectId() {
    CheckType checkType = CheckType.OBJECT_ID;
    helper.logMessage(DbConsistencyCheckerHelper.MSG_OBJECT_ID_START, false, toConsole);
    DbConsistencyStatus status = getStatusFromZk();
    Collection<DataObjectType> resumeDataCfs = resumeFromWorkingPoint(checkType, status.getWorkingPoint());
    int totalIllegalCount = 0;
    for (DataObjectType dataCf : resumeDataCfs) {
        int illegalCount = helper.checkDataObject(dataCf, toConsole);
        status = getStatusFromZk();
        if (!toConsole && isCancelled(status)) {
            cancel(status);
        }
        if (!toConsole) {
            status.update(this.totalCount, checkType.name(), dataCf.getCF().getName(), illegalCount);
            persistStatus(status);
        }
        totalIllegalCount += illegalCount;
    }
    String msg = String.format(DbConsistencyCheckerHelper.MSG_OBJECT_ID_END, resumeDataCfs.size(), totalIllegalCount);
    helper.logMessage(msg, false, toConsole);
    return totalIllegalCount;
}
Also used : DbConsistencyStatus(com.emc.storageos.coordinator.client.model.DbConsistencyStatus)

Example 4 with DbConsistencyStatus

use of com.emc.storageos.coordinator.client.model.DbConsistencyStatus in project coprhd-controller by CoprHD.

the class DbConsistencyService method getDbConsistencyStatus.

/**
 * Get the status of db consistency check
 * @brief Get the status of db consistency check
 * @return DbConsistencyStatusRestRep the status of db consistency check
 */
@GET
@Path("consistency")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public DbConsistencyStatusRestRep getDbConsistencyStatus() {
    DbConsistencyStatus status = getStatusFromZk();
    log.info("db consistency check status {}", status);
    return toStatusRestRep(status);
}
Also used : DbConsistencyStatus(com.emc.storageos.coordinator.client.model.DbConsistencyStatus) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 5 with DbConsistencyStatus

use of com.emc.storageos.coordinator.client.model.DbConsistencyStatus in project coprhd-controller by CoprHD.

the class DbConsistencyJobConsumer method createStatusInZk.

private DbConsistencyStatus createStatusInZk() {
    DbConsistencyStatus status = new DbConsistencyStatus();
    status.init();
    return status;
}
Also used : DbConsistencyStatus(com.emc.storageos.coordinator.client.model.DbConsistencyStatus)

Aggregations

DbConsistencyStatus (com.emc.storageos.coordinator.client.model.DbConsistencyStatus)11 CheckResult (com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper.CheckResult)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 ConnectionException (com.netflix.astyanax.connectionpool.exceptions.ConnectionException)2 CancellationException (java.util.concurrent.CancellationException)2 Path (javax.ws.rs.Path)2 IndexAndCf (com.emc.storageos.db.client.impl.DbConsistencyCheckerHelper.IndexAndCf)1 GET (javax.ws.rs.GET)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1