use of org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.RowData.KEY_ONLY in project ignite by apache.
the class SchemaIndexCachePartitionWorker method processPartition.
/**
* Process partition.
*
* @throws IgniteCheckedException If failed.
*/
private void processPartition() throws IgniteCheckedException {
if (stop())
return;
checkCancelled();
boolean reserved = false;
GridDhtPartitionState partState = locPart.state();
if (partState != EVICTED)
reserved = (partState == OWNING || partState == MOVING || partState == LOST) && locPart.reserve();
if (!reserved)
return;
try {
GridCursor<? extends CacheDataRow> cursor = locPart.dataStore().cursor(cctx.cacheId(), null, null, KEY_ONLY);
boolean locked = false;
try {
int cntr = 0;
while (!stop() && cursor.next()) {
KeyCacheObject key = cursor.get().key();
if (!locked) {
cctx.shared().database().checkpointReadLock();
locked = true;
}
processKey(key);
if (++cntr % batchSize == 0) {
cctx.shared().database().checkpointReadUnlock();
locked = false;
}
cctx.cache().metrics0().addIndexRebuildKeyProcessed(1);
if (locPart.state() == RENTING)
break;
}
wrappedClo.addNumberProcessedKeys(cntr);
} finally {
if (locked)
cctx.shared().database().checkpointReadUnlock();
}
} finally {
locPart.release();
if (partsCnt.getAndUpdate(v -> v > 0 ? v - 1 : 0) > 0)
cctx.group().metrics().decrementIndexBuildCountPartitionsLeft();
}
}
Aggregations