use of com.emc.storageos.db.client.upgrade.InternalDbClient in project coprhd-controller by CoprHD.
the class NetworkVarrayIndexMigration method process.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback#process()
*/
@Override
public void process() throws MigrationCallbackException {
InternalDbClient internalDbClient;
if (InternalDbClient.class.isAssignableFrom(dbClient.getClass())) {
internalDbClient = (InternalDbClient) dbClient;
} else {
throw new IllegalStateException("Migration callback " + name + " needs InternalDbClient");
}
MigrateIndexHelper.migrateRemovedIndex(internalDbClient, Network.class, "assignedVirtualArrays", "RelationIndex", "RelationIndex");
MigrateIndexHelper.migrateRemovedIndex(internalDbClient, Network.class, "connectedVirtualArrays", "RelationIndex", "RelationIndex");
MigrateIndexHelper.migrateAddedIndex(internalDbClient, Network.class, "assignedVirtualArrays", "RelationIndex");
MigrateIndexHelper.migrateAddedIndex(internalDbClient, Network.class, "connectedVirtualArrays", "RelationIndex");
}
use of com.emc.storageos.db.client.upgrade.InternalDbClient in project coprhd-controller by CoprHD.
the class FieldValueTimeUUIDPair method handleDataObjectClass.
public void handleDataObjectClass(Class<? extends DataObject> clazz) throws Exception {
log.info("proccess model class {}", clazz);
InternalDbClient dbClient = (InternalDbClient) getDbClient();
DataObjectType doType = TypeMap.getDoType(clazz);
Keyspace keyspace = dbClient.getLocalContext().getKeyspace();
ColumnFamilyQuery<String, CompositeColumnName> query = keyspace.prepareQuery(doType.getCF());
OperationResult<Rows<String, CompositeColumnName>> result = query.getAllRows().setRowLimit(100).execute();
int totalCount = 0;
List<Row<String, CompositeColumnName>> rows = new ArrayList<Row<String, CompositeColumnName>>();
for (Row<String, CompositeColumnName> objRow : result.getResult()) {
boolean inactiveObject = false;
totalCount++;
for (Column<CompositeColumnName> column : objRow.getColumns()) {
if (DataObject.INACTIVE_FIELD_NAME.equals(column.getName().getOne()) && column.getBooleanValue()) {
inactiveObject = true;
break;
}
}
if (inactiveObject) {
continue;
}
rows.add(objRow);
if (rows.size() > REBUILD_INDEX_BATCH_SIZE) {
try {
executor.submit(new RebuildIndexTask(doType, rows, keyspace));
rows = new ArrayList<Row<String, CompositeColumnName>>();
} catch (Exception e) {
log.warn("Failed to submit rebuild index task, this may be caused by thread pool is full, try in next round", e);
}
}
}
executor.submit(new RebuildIndexTask(doType, rows, keyspace));
log.info("Total data object count is {} for model {}", totalCount, clazz.getName());
return;
}
use of com.emc.storageos.db.client.upgrade.InternalDbClient in project coprhd-controller by CoprHD.
the class StoragePortNetworkIndexMigration method process.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback#process()
*/
@Override
public void process() throws MigrationCallbackException {
InternalDbClient internalDbClient;
if (InternalDbClient.class.isAssignableFrom(dbClient.getClass())) {
internalDbClient = (InternalDbClient) dbClient;
} else {
throw new IllegalStateException("Migration callback " + name + " needs InternalDbClient");
}
MigrateIndexHelper.migrateRemovedIndex(internalDbClient, StoragePort.class, "network", "AlternateId", "AltIdIndex");
MigrateIndexHelper.migrateAddedIndex(internalDbClient, StoragePort.class, "network", "AltIdIndex");
}
use of com.emc.storageos.db.client.upgrade.InternalDbClient in project coprhd-controller by CoprHD.
the class AggregationIndexTimeUUIDMigration method removeOldAggregationIndex.
private void removeOldAggregationIndex() {
InternalDbClient internalDbClient = getInternalDbClient();
internalDbClient.rebuildCf("AggregatedIndex");
}
use of com.emc.storageos.db.client.upgrade.InternalDbClient in project coprhd-controller by CoprHD.
the class VirtualPoolVarrayIndexFix method process.
/* (non-Javadoc)
* @see com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback#process()
*/
@Override
public void process() throws MigrationCallbackException {
log.info("Fix virtual arrays index for all vpools");
InternalDbClient internalDbClient;
if (InternalDbClient.class.isAssignableFrom(dbClient.getClass())) {
internalDbClient = (InternalDbClient) dbClient;
} else {
throw new IllegalStateException("Migration callback " + name + " needs InternalDbClient");
}
// removes the entries from RelationIndex (old) index table
MigrateIndexHelper.migrateRemovedIndex(internalDbClient, VirtualPool.class, "protectionVarraySettings", "RelationIndex", "RelationIndex");
// adds entries to the new index table (framework knows the new index table)
MigrateIndexHelper.migrateAddedIndex(internalDbClient, VirtualPool.class, "protectionVarraySettings", "RelationIndex");
}
Aggregations