code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public boolean releaseIfHolds(T referenced)
{
Ref ref = references.remove(referenced);
if (ref != null)
ref.release();
return ref != null;
} | java |
public void release(Collection<T> release)
{
List<Ref<T>> refs = new ArrayList<>();
List<T> notPresent = null;
for (T obj : release)
{
Ref<T> ref = references.remove(obj);
if (ref == null)
{
if (notPresent == null)
... | java |
public boolean tryRef(T t)
{
Ref<T> ref = t.tryRef();
if (ref == null)
return false;
ref = references.put(t, ref);
if (ref != null)
ref.release(); // release dup
return true;
} | java |
public Refs<T> addAll(Refs<T> add)
{
List<Ref<T>> overlap = new ArrayList<>();
for (Map.Entry<T, Ref<T>> e : add.references.entrySet())
{
if (this.references.containsKey(e.getKey()))
overlap.add(e.getValue());
else
this.references.put(e... | java |
public static <T extends RefCounted<T>> Refs<T> tryRef(Iterable<T> reference)
{
HashMap<T, Ref<T>> refs = new HashMap<>();
for (T rc : reference)
{
Ref<T> ref = rc.tryRef();
if (ref == null)
{
release(refs.values());
return ... | java |
public Allocation allocate(Mutation mutation, int size)
{
CommitLogSegment segment = allocatingFrom();
Allocation alloc;
while ( null == (alloc = segment.allocate(mutation, size)) )
{
// failed to allocate, so move to a new segment with enough room
advanceAll... | java |
CommitLogSegment allocatingFrom()
{
CommitLogSegment r = allocatingFrom;
if (r == null)
{
advanceAllocatingFrom(null);
r = allocatingFrom;
}
return r;
} | java |
private void advanceAllocatingFrom(CommitLogSegment old)
{
while (true)
{
CommitLogSegment next;
synchronized (this)
{
// do this in a critical section so we can atomically remove from availableSegments and add to allocatingFrom/activeSegments
... | java |
void forceRecycleAll(Iterable<UUID> droppedCfs)
{
List<CommitLogSegment> segmentsToRecycle = new ArrayList<>(activeSegments);
CommitLogSegment last = segmentsToRecycle.get(segmentsToRecycle.size() - 1);
advanceAllocatingFrom(last);
// wait for the commit log modifications
la... | java |
void recycleSegment(final CommitLogSegment segment)
{
boolean archiveSuccess = CommitLog.instance.archiver.maybeWaitForArchiving(segment.getName());
activeSegments.remove(segment);
if (!archiveSuccess)
{
// if archiving (command) was not successful then leave the file alo... | java |
void recycleSegment(final File file)
{
if (isCapExceeded()
|| CommitLogDescriptor.fromFileName(file.getName()).getMessagingVersion() != MessagingService.current_version)
{
// (don't decrease managed size, since this was never a "live" segment)
logger.debug("(Unope... | java |
private void discardSegment(final CommitLogSegment segment, final boolean deleteFile)
{
logger.debug("Segment {} is no longer active and will be deleted {}", segment, deleteFile ? "now" : "by the archive script");
size.addAndGet(-DatabaseDescriptor.getCommitLogSegmentSize());
segmentManagem... | java |
public void resetUnsafe()
{
logger.debug("Closing and clearing existing commit log segments...");
while (!segmentManagementTasks.isEmpty())
Thread.yield();
for (CommitLogSegment segment : activeSegments)
segment.close();
activeSegments.clear();
for ... | java |
public static BloomSpecification computeBloomSpec(int bucketsPerElement)
{
assert bucketsPerElement >= 1;
assert bucketsPerElement <= probs.length - 1;
return new BloomSpecification(optKPerBuckets[bucketsPerElement], bucketsPerElement);
} | java |
public static int maxBucketsPerElement(long numElements)
{
numElements = Math.max(1, numElements);
double v = (Long.MAX_VALUE - EXCESS) / (double)numElements;
if (v < 1.0)
{
throw new UnsupportedOperationException("Cannot compute probabilities for " + numElements + " elem... | java |
public Boolean getBoolean(String key, Boolean defaultValue) throws SyntaxException
{
String value = getSimple(key);
return (value == null) ? defaultValue : value.toLowerCase().matches("(1|true|yes)");
} | java |
public Double getDouble(String key, Double defaultValue) throws SyntaxException
{
String value = getSimple(key);
if (value == null)
{
return defaultValue;
}
else
{
try
{
return Double.valueOf(value);
}
... | java |
public Integer getInt(String key, Integer defaultValue) throws SyntaxException
{
String value = getSimple(key);
return toInt(key, value, defaultValue);
} | java |
public static ReplayPosition getReplayPosition(Iterable<? extends SSTableReader> sstables)
{
if (Iterables.isEmpty(sstables))
return NONE;
Function<SSTableReader, ReplayPosition> f = new Function<SSTableReader, ReplayPosition>()
{
public ReplayPosition apply(SSTableR... | java |
public void setDiscarding()
{
state = state.transition(LifeCycle.DISCARDING);
// mark the memory owned by this allocator as reclaiming
onHeap.markAllReclaiming();
offHeap.markAllReclaiming();
} | java |
private <T extends Number> Gauge<Long> createKeyspaceGauge(String name, final MetricValue extractor)
{
allMetrics.add(name);
return Metrics.newGauge(factory.createMetricName(name), new Gauge<Long>()
{
public Long value()
{
long sum = 0;
... | java |
public LongToken getToken(ByteBuffer key)
{
if (key.remaining() == 0)
return MINIMUM;
long[] hash = new long[2];
MurmurHash.hash3_x64_128(key, key.position(), key.remaining(), 0, hash);
return new LongToken(normalize(hash[0]));
} | java |
private static BigInteger bigForString(String str, int sigchars)
{
assert str.length() <= sigchars;
BigInteger big = BigInteger.ZERO;
for (int i = 0; i < str.length(); i++)
{
int charpos = 16 * (sigchars - (i + 1));
BigInteger charbig = BigInteger.valueOf(str... | java |
private void setupDefaultUser()
{
try
{
// insert the default superuser if AUTH_KS.CREDENTIALS_CF is empty.
if (!hasExistingUsers())
{
process(String.format("INSERT INTO %s.%s (username, salted_hash) VALUES ('%s', '%s') USING TIMESTAMP 0",
... | java |
public synchronized void received(SSTableWriter sstable)
{
if (done)
return;
assert cfId.equals(sstable.metadata.cfId);
sstables.add(sstable);
if (sstables.size() == totalFiles)
{
done = true;
executor.submit(new OnCompletionRunnable(this... | java |
<V> void find(Object[] node, Comparator<V> comparator, Object target, Op mode, boolean forwards)
{
// TODO : should not require parameter 'forwards' - consider modifying index to represent both
// child and key position, as opposed to just key position (which necessitates a different value depending... | java |
void successor()
{
Object[] node = currentNode();
int i = currentIndex();
if (!isLeaf(node))
{
// if we're on a key in a branch, we MUST have a descendant either side of us,
// so we always go down the left-most child until we hit a leaf
node = (O... | java |
protected Tuple composeComposite(AbstractCompositeType comparator, ByteBuffer name) throws IOException
{
List<CompositeComponent> result = comparator.deconstruct(name);
Tuple t = TupleFactory.getInstance().newTuple(result.size());
for (int i=0; i<result.size(); i++)
setTupleValue... | java |
protected Tuple columnToTuple(Cell col, CfInfo cfInfo, AbstractType comparator) throws IOException
{
CfDef cfDef = cfInfo.cfDef;
Tuple pair = TupleFactory.getInstance().newTuple(2);
ByteBuffer colName = col.name().toByteBuffer();
// name
if(comparator instanceof AbstractCom... | java |
protected CfInfo getCfInfo(String signature) throws IOException
{
UDFContext context = UDFContext.getUDFContext();
Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
String prop = property.getProperty(signature);
CfInfo cfInfo = new CfInfo();
cfIn... | java |
protected Map<MarshallerType, AbstractType> getDefaultMarshallers(CfDef cfDef) throws IOException
{
Map<MarshallerType, AbstractType> marshallers = new EnumMap<MarshallerType, AbstractType>(MarshallerType.class);
AbstractType comparator;
AbstractType subcomparator;
AbstractType defau... | java |
protected Map<ByteBuffer, AbstractType> getValidatorMap(CfDef cfDef) throws IOException
{
Map<ByteBuffer, AbstractType> validators = new HashMap<ByteBuffer, AbstractType>();
for (ColumnDef cd : cfDef.getColumn_metadata())
{
if (cd.getValidation_class() != null && !cd.getValidatio... | java |
protected AbstractType parseType(String type) throws IOException
{
try
{
// always treat counters like longs, specifically CCT.compose is not what we need
if (type != null && type.equals("org.apache.cassandra.db.marshal.CounterColumnType"))
return LongType... | java |
public static Map<String, String> getQueryMap(String query) throws UnsupportedEncodingException
{
String[] params = query.split("&");
Map<String, String> map = new HashMap<String, String>();
for (String param : params)
{
String[] keyValue = param.split("=");
... | java |
protected byte getPigType(AbstractType type)
{
if (type instanceof LongType || type instanceof DateType || type instanceof TimestampType) // DateType is bad and it should feel bad
return DataType.LONG;
else if (type instanceof IntegerType || type instanceof Int32Type) // IntegerType will... | java |
protected ByteBuffer objToBB(Object o)
{
if (o == null)
return nullToBB();
if (o instanceof java.lang.String)
return ByteBuffer.wrap(new DataByteArray((String)o).get());
if (o instanceof Integer)
return Int32Type.instance.decompose((Integer)o);
if ... | java |
protected void initSchema(String signature) throws IOException
{
Properties properties = UDFContext.getUDFContext().getUDFProperties(AbstractCassandraStorage.class);
// Only get the schema if we haven't already gotten it
if (!properties.containsKey(signature))
{
try
... | java |
protected static String cfdefToString(CfDef cfDef) throws IOException
{
assert cfDef != null;
// this is so awful it's kind of cool!
TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
try
{
return Hex.bytesToHex(serializer.serialize(cfDef));
... | java |
protected static CfDef cfdefFromString(String st) throws IOException
{
assert st != null;
TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
CfDef cfDef = new CfDef();
try
{
deserializer.deserialize(cfDef, Hex.hexToBytes(st));
}... | java |
protected CfInfo getCfInfo(Cassandra.Client client)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException,
NotFoundException,
org.apach... | java |
protected List<ColumnDef> getColumnMeta(Cassandra.Client client, boolean cassandraStorage, boolean includeCompactValueColumn)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException,
Characte... | java |
protected IndexType getIndexType(String type)
{
type = type.toLowerCase();
if ("keys".equals(type))
return IndexType.KEYS;
else if("custom".equals(type))
return IndexType.CUSTOM;
else if("composites".equals(type))
return IndexType.COMPOSITES;
... | java |
public String[] getPartitionKeys(String location, Job job) throws IOException
{
if (!usePartitionFilter)
return null;
List<ColumnDef> indexes = getIndexes();
String[] partitionKeys = new String[indexes.size()];
for (int i = 0; i < indexes.size(); i++)
{
... | java |
protected List<ColumnDef> getIndexes() throws IOException
{
CfDef cfdef = getCfInfo(loadSignature).cfDef;
List<ColumnDef> indexes = new ArrayList<ColumnDef>();
for (ColumnDef cdef : cfdef.column_metadata)
{
if (cdef.index_type != null)
indexes.add(cdef);
... | java |
protected CFMetaData getCFMetaData(String ks, String cf, Cassandra.Client client)
throws NotFoundException,
InvalidRequestException,
TException,
org.apache.cassandra.exceptions.InvalidRequestException,
ConfigurationException
{
KsDef ksDef = client.... | java |
public void commit() {
Log.info("Committing");
try {
indexWriter.commit();
} catch (IOException e) {
Log.error(e, "Error while committing");
throw new RuntimeException(e);
}
} | java |
public void close() {
Log.info("Closing index");
try {
Log.info("Closing");
searcherReopener.interrupt();
searcherManager.close();
indexWriter.close();
directory.close();
} catch (IOException e) {
Log.error(e, "Error while c... | java |
public void optimize() {
Log.debug("Optimizing index");
try {
indexWriter.forceMerge(1, true);
indexWriter.commit();
} catch (IOException e) {
Log.error(e, "Error while optimizing index");
throw new RuntimeException(e);
}
} | java |
private long beforeAppend(DecoratedKey decoratedKey)
{
assert decoratedKey != null : "Keys must not be null"; // empty keys ARE allowed b/c of indexed column values
if (lastWrittenKey != null && lastWrittenKey.compareTo(decoratedKey) >= 0)
throw new RuntimeException("Last written key " +... | java |
public void abort()
{
assert descriptor.type.isTemporary;
if (iwriter == null && dataFile == null)
return;
if (iwriter != null)
iwriter.abort();
if (dataFile!= null)
dataFile.abort();
Set<Component> components = SSTable.componentsFor(des... | java |
public void reset(Object[] btree, boolean forwards)
{
_reset(btree, null, NEGATIVE_INFINITY, false, POSITIVE_INFINITY, false, forwards);
} | java |
public Pair<Long, Long> addAllWithSizeDelta(final ColumnFamily cm, MemtableAllocator allocator, OpOrder.Group writeOp, Updater indexer)
{
ColumnUpdater updater = new ColumnUpdater(this, cm.metadata, allocator, writeOp, indexer);
DeletionInfo inputDeletionInfoCopy = null;
boolean monitorOwne... | java |
private boolean updateWastedAllocationTracker(long wastedBytes) {
// Early check for huge allocation that exceeds the limit
if (wastedBytes < EXCESS_WASTE_BYTES)
{
// We round up to ensure work < granularity are still accounted for
int wastedAllocation = ((int) (wastedByt... | java |
public ByteBuffer getElement(ByteBuffer serializedList, int index)
{
try
{
ByteBuffer input = serializedList.duplicate();
int n = readCollectionSize(input, Server.VERSION_3);
if (n <= index)
return null;
for (int i = 0; i < index; i++)... | java |
private void releaseReferences()
{
for (SSTableReader sstable : sstables)
{
sstable.selfRef().release();
assert sstable.selfRef().globalCount() == 0;
}
} | java |
public TimeCounter start() {
switch (state) {
case UNSTARTED:
watch.start();
break;
case RUNNING:
throw new IllegalStateException("Already started. ");
case STOPPED:
watch.resume();
}
state = Stat... | java |
public TimeCounter stop() {
switch (state) {
case UNSTARTED:
throw new IllegalStateException("Not started. ");
case STOPPED:
throw new IllegalStateException("Already stopped. ");
case RUNNING:
watch.suspend();
}
... | java |
public static List<TriggerDefinition> fromSchema(Row serializedTriggers)
{
List<TriggerDefinition> triggers = new ArrayList<>();
String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF);
for (UntypedResultSet.Row row : QueryProcessor.resultif... | java |
public void toSchema(Mutation mutation, String cfName, long timestamp)
{
ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF);
CFMetaData cfm = CFMetaData.SchemaTriggersCf;
Composite prefix = cfm.comparator.make(cfName, name);
CFRowAdder adder = new CFRowAdder(cf, ... | java |
public void deleteFromSchema(Mutation mutation, String cfName, long timestamp)
{
ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF);
int ldt = (int) (System.currentTimeMillis() / 1000);
Composite prefix = CFMetaData.SchemaTriggersCf.comparator.make(cfName, name);
... | java |
void clear()
{
NodeBuilder current = this;
while (current != null && current.upperBound != null)
{
current.clearSelf();
current = current.child;
}
current = parent;
while (current != null && current.upperBound != null)
{
cur... | java |
NodeBuilder update(Object key)
{
assert copyFrom != null;
int copyFromKeyEnd = getKeyEnd(copyFrom);
int i = copyFromKeyPosition;
boolean found; // exact key match?
boolean owns = true; // true iff this node (or a child) should contain the key
if (i == copyFromKeyEnd)... | java |
NodeBuilder ascendToRoot()
{
NodeBuilder current = this;
while (!current.isRoot())
current = current.ascend();
return current;
} | java |
Object[] toNode()
{
assert buildKeyPosition <= FAN_FACTOR && (buildKeyPosition > 0 || copyFrom.length > 0) : buildKeyPosition;
return buildFromRange(0, buildKeyPosition, isLeaf(copyFrom), false);
} | java |
private NodeBuilder ascend()
{
ensureParent();
boolean isLeaf = isLeaf(copyFrom);
if (buildKeyPosition > FAN_FACTOR)
{
// split current node and move the midpoint into parent, with the two halves as children
int mid = buildKeyPosition / 2;
parent.a... | java |
void addNewKey(Object key)
{
ensureRoom(buildKeyPosition + 1);
buildKeys[buildKeyPosition++] = updateFunction.apply(key);
} | java |
private void addExtraChild(Object[] child, Object upperBound)
{
ensureRoom(buildKeyPosition + 1);
buildKeys[buildKeyPosition++] = upperBound;
buildChildren[buildChildPosition++] = child;
} | java |
private void ensureRoom(int nextBuildKeyPosition)
{
if (nextBuildKeyPosition < MAX_KEYS)
return;
// flush even number of items so we don't waste leaf space repeatedly
Object[] flushUp = buildFromRange(0, FAN_FACTOR, isLeaf(copyFrom), true);
ensureParent().addExtraChild(f... | java |
private Object[] buildFromRange(int offset, int keyLength, boolean isLeaf, boolean isExtra)
{
// if keyLength is 0, we didn't copy anything from the original, which means we didn't
// modify any of the range owned by it, so can simply return it as is
if (keyLength == 0)
return co... | java |
private NodeBuilder ensureParent()
{
if (parent == null)
{
parent = new NodeBuilder();
parent.child = this;
}
if (parent.upperBound == null)
parent.reset(EMPTY_BRANCH, upperBound, updateFunction, comparator);
return parent;
} | java |
private List<Pair<Long, Long>> getTransferSections(CompressionMetadata.Chunk[] chunks)
{
List<Pair<Long, Long>> transferSections = new ArrayList<>();
Pair<Long, Long> lastSection = null;
for (CompressionMetadata.Chunk chunk : chunks)
{
if (lastSection != null)
... | java |
@Override
public CellName copy(CFMetaData cfm, AbstractAllocator allocator)
{
return new SimpleDenseCellName(allocator.clone(element));
} | java |
private long getNow()
{
return Collections.max(cfs.getSSTables(), new Comparator<SSTableReader>()
{
public int compare(SSTableReader o1, SSTableReader o2)
{
return Long.compare(o1.getMaxTimestamp(), o2.getMaxTimestamp());
}
}).getMaxTimesta... | java |
@VisibleForTesting
static Iterable<SSTableReader> filterOldSSTables(List<SSTableReader> sstables, long maxSSTableAge, long now)
{
if (maxSSTableAge == 0)
return sstables;
final long cutoff = now - maxSSTableAge;
return Iterables.filter(sstables, new Predicate<SSTableReader>()... | java |
@VisibleForTesting
static <T> List<List<T>> getBuckets(Collection<Pair<T, Long>> files, long timeUnit, int base, long now)
{
// Sort files by age. Newest first.
final List<Pair<T, Long>> sortedFiles = Lists.newArrayList(files);
Collections.sort(sortedFiles, Collections.reverseOrder(new C... | java |
@Override
public void write(Object key, List<ByteBuffer> values) throws IOException
{
prepareWriter();
try
{
((CQLSSTableWriter) writer).rawAddRow(values);
if (null != progress)
progress.progress();
if (null != context)
... | java |
private static long discard(ByteBuf buffer, long remainingToDiscard)
{
int availableToDiscard = (int) Math.min(remainingToDiscard, buffer.readableBytes());
buffer.skipBytes(availableToDiscard);
return remainingToDiscard - availableToDiscard;
} | java |
public static boolean delete(Descriptor desc, Set<Component> components)
{
// remove the DATA component first if it exists
if (components.contains(Component.DATA))
FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA));
for (Component component : components)
{
... | java |
public static DecoratedKey getMinimalKey(DecoratedKey key)
{
return key.getKey().position() > 0 || key.getKey().hasRemaining() || !key.getKey().hasArray()
? new BufferDecoratedKey(key.getToken(), HeapAllocator.instance.clone(key.getKey()))
... | java |
protected static Set<Component> readTOC(Descriptor descriptor) throws IOException
{
File tocFile = new File(descriptor.filenameFor(Component.TOC));
List<String> componentNames = Files.readLines(tocFile, Charset.defaultCharset());
Set<Component> components = Sets.newHashSetWithExpectedSize(co... | java |
protected static void appendTOC(Descriptor descriptor, Collection<Component> components)
{
File tocFile = new File(descriptor.filenameFor(Component.TOC));
PrintWriter w = null;
try
{
w = new PrintWriter(new FileWriter(tocFile, true));
for (Component component ... | java |
public synchronized void addComponents(Collection<Component> newComponents)
{
Collection<Component> componentsToAdd = Collections2.filter(newComponents, Predicates.not(Predicates.in(components)));
appendTOC(descriptor, componentsToAdd);
components.addAll(componentsToAdd);
} | java |
@Override
public void serialize(Map<MetadataType, MetadataComponent> components, DataOutputPlus out) throws IOException
{
ValidationMetadata validation = (ValidationMetadata) components.get(MetadataType.VALIDATION);
StatsMetadata stats = (StatsMetadata) components.get(MetadataType.STATS);
... | java |
@Override
public Map<MetadataType, MetadataComponent> deserialize(Descriptor descriptor, EnumSet<MetadataType> types) throws IOException
{
Map<MetadataType, MetadataComponent> components = Maps.newHashMap();
File statsFile = new File(descriptor.filenameFor(Component.STATS));
if (!statsF... | java |
public void initiate() throws IOException
{
logger.debug("[Stream #{}] Sending stream init for incoming stream", session.planId());
Socket incomingSocket = session.createConnection();
incoming.start(incomingSocket, StreamMessage.CURRENT_VERSION);
incoming.sendInitMessage(incomingSock... | java |
public void initiateOnReceivingSide(Socket socket, boolean isForOutgoing, int version) throws IOException
{
if (isForOutgoing)
outgoing.start(socket, version);
else
incoming.start(socket, version);
} | java |
private void setNextSamplePosition(long position)
{
tryAgain: while (true)
{
position += minIndexInterval;
long test = indexIntervalMatches++;
for (int start : startPoints)
if ((test - start) % BASE_SAMPLING_LEVEL == 0)
continue... | java |
public IndexSummary build(IPartitioner partitioner, ReadableBoundary boundary)
{
assert entries.length() > 0;
int count = (int) (offsets.length() / 4);
long entriesLength = entries.length();
if (boundary != null)
{
count = boundary.summaryCount;
entri... | java |
public static IndexSummary downsample(IndexSummary existing, int newSamplingLevel, int minIndexInterval, IPartitioner partitioner)
{
// To downsample the old index summary, we'll go through (potentially) several rounds of downsampling.
// Conceptually, each round starts at position X and then remove... | java |
public void update(double p, long m)
{
Long mi = bin.get(p);
if (mi != null)
{
// we found the same p so increment that counter
bin.put(p, mi + m);
}
else
{
bin.put(p, m);
// if bin size exceeds maximum bin size then tri... | java |
public RateLimiter getRateLimiter()
{
double currentThroughput = DatabaseDescriptor.getCompactionThroughputMbPerSec() * 1024.0 * 1024.0;
// if throughput is set to 0, throttling is disabled
if (currentThroughput == 0 || StorageService.instance.isBootstrapMode())
currentThroughput... | java |
private SSTableReader lookupSSTable(final ColumnFamilyStore cfs, Descriptor descriptor)
{
for (SSTableReader sstable : cfs.getSSTables())
{
if (sstable.descriptor.equals(descriptor))
return sstable;
}
return null;
} | java |
public Future<Object> submitValidation(final ColumnFamilyStore cfStore, final Validator validator)
{
Callable<Object> callable = new Callable<Object>()
{
public Object call() throws IOException
{
try
{
doValidationCompaction... | java |
static boolean needsCleanup(SSTableReader sstable, Collection<Range<Token>> ownedRanges)
{
assert !ownedRanges.isEmpty(); // cleanup checks for this
// unwrap and sort the ranges by LHS token
List<Range<Token>> sortedRanges = Range.normalize(ownedRanges);
// see if there are any ke... | java |
public Future<?> submitIndexBuild(final SecondaryIndexBuilder builder)
{
Runnable runnable = new Runnable()
{
public void run()
{
metrics.beginCompaction(builder);
try
{
builder.build();
}
... | java |
public void interruptCompactionFor(Iterable<CFMetaData> columnFamilies, boolean interruptValidation)
{
assert columnFamilies != null;
// interrupt in-progress compactions
for (Holder compactionHolder : CompactionMetrics.getCompactions())
{
CompactionInfo info = compactio... | java |
private void fastAddAll(ArrayBackedSortedColumns other)
{
if (other.isInsertReversed() == isInsertReversed())
{
cells = Arrays.copyOf(other.cells, other.cells.length);
size = other.size;
sortedSize = other.sortedSize;
isSorted = other.isSorted;
... | java |
private void internalRemove(int index)
{
int moving = size - index - 1;
if (moving > 0)
System.arraycopy(cells, index + 1, cells, index, moving);
cells[--size] = null;
} | java |
private void reconcileWith(int i, Cell cell)
{
cells[i] = cell.reconcile(cells[i]);
} | java |
private Region getRegion()
{
while (true)
{
// Try to get the region
Region region = currentRegion.get();
if (region != null)
return region;
// No current region, so we want to allocate one. We race
// against other allocat... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.