use of org.apache.cassandra.utils.IntegerInterval in project cassandra by apache.
the class CommitLogSegment method removeCleanFromDirty.
private void removeCleanFromDirty() {
// if we're still allocating from this segment, don't touch anything since it can't be done thread-safely
if (isStillAllocating())
return;
Iterator<Map.Entry<TableId, IntegerInterval.Set>> iter = tableClean.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<TableId, IntegerInterval.Set> clean = iter.next();
TableId tableId = clean.getKey();
IntegerInterval.Set cleanSet = clean.getValue();
IntegerInterval dirtyInterval = tableDirty.get(tableId);
if (dirtyInterval != null && cleanSet.covers(dirtyInterval)) {
tableDirty.remove(tableId);
iter.remove();
}
}
}
use of org.apache.cassandra.utils.IntegerInterval in project cassandra by apache.
the class CommitLogSegment method getDirtyTableIds.
/**
* @return a collection of dirty CFIDs for this segment file.
*/
public synchronized Collection<TableId> getDirtyTableIds() {
if (tableClean.isEmpty() || tableDirty.isEmpty())
return tableDirty.keySet();
List<TableId> r = new ArrayList<>(tableDirty.size());
for (Map.Entry<TableId, IntegerInterval> dirty : tableDirty.entrySet()) {
TableId tableId = dirty.getKey();
IntegerInterval dirtyInterval = dirty.getValue();
IntegerInterval.Set cleanSet = tableClean.get(tableId);
if (cleanSet == null || !cleanSet.covers(dirtyInterval))
r.add(dirty.getKey());
}
return r;
}
use of org.apache.cassandra.utils.IntegerInterval in project cassandra by apache.
the class CommitLogSegment method coverInMap.
public static <K> void coverInMap(ConcurrentMap<K, IntegerInterval> map, K key, int value) {
IntegerInterval i = map.get(key);
if (i == null) {
i = map.putIfAbsent(key, new IntegerInterval(value, value));
if (i == null)
// success
return;
}
i.expandToCover(value);
}
Aggregations