_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q20600 | AbstractCassandraStorage.getIndexes | train | 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 | {
"resource": ""
} |
q20601 | AbstractCassandraStorage.getCFMetaData | train | protected CFMetaData getCFMetaData(String ks, String cf, Cassandra.Client client)
throws NotFoundException,
InvalidRequestException,
TException,
org.apache.cassandra.exceptions.InvalidRequestException,
ConfigurationException
{
KsDef ksDef = client.... | java | {
"resource": ""
} |
q20602 | LuceneIndex.commit | train | public void commit() {
Log.info("Committing");
try {
indexWriter.commit();
} catch (IOException e) {
Log.error(e, "Error while committing");
throw new RuntimeException(e);
}
} | java | {
"resource": ""
} |
q20603 | LuceneIndex.close | train | 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 | {
"resource": ""
} |
q20604 | LuceneIndex.optimize | train | 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 | {
"resource": ""
} |
q20605 | SSTableWriter.beforeAppend | train | 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 | {
"resource": ""
} |
q20606 | SSTableWriter.abort | train | 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 | {
"resource": ""
} |
q20607 | Cursor.reset | train | public void reset(Object[] btree, boolean forwards)
{
_reset(btree, null, NEGATIVE_INFINITY, false, POSITIVE_INFINITY, false, forwards);
} | java | {
"resource": ""
} |
q20608 | AtomicBTreeColumns.addAllWithSizeDelta | train | 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 | {
"resource": ""
} |
q20609 | AtomicBTreeColumns.updateWastedAllocationTracker | train | 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 | {
"resource": ""
} |
q20610 | ListSerializer.getElement | train | 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 | {
"resource": ""
} |
q20611 | SSTableLoader.releaseReferences | train | private void releaseReferences()
{
for (SSTableReader sstable : sstables)
{
sstable.selfRef().release();
assert sstable.selfRef().globalCount() == 0;
}
} | java | {
"resource": ""
} |
q20612 | TimeCounter.start | train | public TimeCounter start() {
switch (state) {
case UNSTARTED:
watch.start();
break;
case RUNNING:
throw new IllegalStateException("Already started. ");
case STOPPED:
watch.resume();
}
state = Stat... | java | {
"resource": ""
} |
q20613 | TimeCounter.stop | train | public TimeCounter stop() {
switch (state) {
case UNSTARTED:
throw new IllegalStateException("Not started. ");
case STOPPED:
throw new IllegalStateException("Already stopped. ");
case RUNNING:
watch.suspend();
}
... | java | {
"resource": ""
} |
q20614 | TriggerDefinition.fromSchema | train | 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 | {
"resource": ""
} |
q20615 | TriggerDefinition.toSchema | train | 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 | {
"resource": ""
} |
q20616 | TriggerDefinition.deleteFromSchema | train | 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 | {
"resource": ""
} |
q20617 | NodeBuilder.clear | train | 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 | {
"resource": ""
} |
q20618 | NodeBuilder.update | train | 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 | {
"resource": ""
} |
q20619 | NodeBuilder.ascendToRoot | train | NodeBuilder ascendToRoot()
{
NodeBuilder current = this;
while (!current.isRoot())
current = current.ascend();
return current;
} | java | {
"resource": ""
} |
q20620 | NodeBuilder.toNode | train | Object[] toNode()
{
assert buildKeyPosition <= FAN_FACTOR && (buildKeyPosition > 0 || copyFrom.length > 0) : buildKeyPosition;
return buildFromRange(0, buildKeyPosition, isLeaf(copyFrom), false);
} | java | {
"resource": ""
} |
q20621 | NodeBuilder.ascend | train | 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 | {
"resource": ""
} |
q20622 | NodeBuilder.addNewKey | train | void addNewKey(Object key)
{
ensureRoom(buildKeyPosition + 1);
buildKeys[buildKeyPosition++] = updateFunction.apply(key);
} | java | {
"resource": ""
} |
q20623 | NodeBuilder.addExtraChild | train | private void addExtraChild(Object[] child, Object upperBound)
{
ensureRoom(buildKeyPosition + 1);
buildKeys[buildKeyPosition++] = upperBound;
buildChildren[buildChildPosition++] = child;
} | java | {
"resource": ""
} |
q20624 | NodeBuilder.ensureRoom | train | 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 | {
"resource": ""
} |
q20625 | NodeBuilder.buildFromRange | train | 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 | {
"resource": ""
} |
q20626 | NodeBuilder.ensureParent | train | 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 | {
"resource": ""
} |
q20627 | CompressedStreamWriter.getTransferSections | train | 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 | {
"resource": ""
} |
q20628 | SimpleDenseCellName.copy | train | @Override
public CellName copy(CFMetaData cfm, AbstractAllocator allocator)
{
return new SimpleDenseCellName(allocator.clone(element));
} | java | {
"resource": ""
} |
q20629 | DateTieredCompactionStrategy.getNow | train | 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 | {
"resource": ""
} |
q20630 | DateTieredCompactionStrategy.filterOldSSTables | train | @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 | {
"resource": ""
} |
q20631 | DateTieredCompactionStrategy.getBuckets | train | @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 | {
"resource": ""
} |
q20632 | CqlBulkRecordWriter.write | train | @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 | {
"resource": ""
} |
q20633 | Frame.discard | train | private static long discard(ByteBuf buffer, long remainingToDiscard)
{
int availableToDiscard = (int) Math.min(remainingToDiscard, buffer.readableBytes());
buffer.skipBytes(availableToDiscard);
return remainingToDiscard - availableToDiscard;
} | java | {
"resource": ""
} |
q20634 | SSTable.delete | train | 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 | {
"resource": ""
} |
q20635 | SSTable.getMinimalKey | train | 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 | {
"resource": ""
} |
q20636 | SSTable.readTOC | train | 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 | {
"resource": ""
} |
q20637 | SSTable.appendTOC | train | 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 | {
"resource": ""
} |
q20638 | SSTable.addComponents | train | 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 | {
"resource": ""
} |
q20639 | LegacyMetadataSerializer.serialize | train | @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 | {
"resource": ""
} |
q20640 | LegacyMetadataSerializer.deserialize | train | @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 | {
"resource": ""
} |
q20641 | ConnectionHandler.initiate | train | 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 | {
"resource": ""
} |
q20642 | ConnectionHandler.initiateOnReceivingSide | train | public void initiateOnReceivingSide(Socket socket, boolean isForOutgoing, int version) throws IOException
{
if (isForOutgoing)
outgoing.start(socket, version);
else
incoming.start(socket, version);
} | java | {
"resource": ""
} |
q20643 | IndexSummaryBuilder.setNextSamplePosition | train | 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 | {
"resource": ""
} |
q20644 | IndexSummaryBuilder.build | train | 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 | {
"resource": ""
} |
q20645 | IndexSummaryBuilder.downsample | train | 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 | {
"resource": ""
} |
q20646 | StreamingHistogram.update | train | 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 | {
"resource": ""
} |
q20647 | CompactionManager.getRateLimiter | train | 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 | {
"resource": ""
} |
q20648 | CompactionManager.lookupSSTable | train | private SSTableReader lookupSSTable(final ColumnFamilyStore cfs, Descriptor descriptor)
{
for (SSTableReader sstable : cfs.getSSTables())
{
if (sstable.descriptor.equals(descriptor))
return sstable;
}
return null;
} | java | {
"resource": ""
} |
q20649 | CompactionManager.submitValidation | train | public Future<Object> submitValidation(final ColumnFamilyStore cfStore, final Validator validator)
{
Callable<Object> callable = new Callable<Object>()
{
public Object call() throws IOException
{
try
{
doValidationCompaction... | java | {
"resource": ""
} |
q20650 | CompactionManager.needsCleanup | train | 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 | {
"resource": ""
} |
q20651 | CompactionManager.submitIndexBuild | train | public Future<?> submitIndexBuild(final SecondaryIndexBuilder builder)
{
Runnable runnable = new Runnable()
{
public void run()
{
metrics.beginCompaction(builder);
try
{
builder.build();
}
... | java | {
"resource": ""
} |
q20652 | CompactionManager.interruptCompactionFor | train | public void interruptCompactionFor(Iterable<CFMetaData> columnFamilies, boolean interruptValidation)
{
assert columnFamilies != null;
// interrupt in-progress compactions
for (Holder compactionHolder : CompactionMetrics.getCompactions())
{
CompactionInfo info = compactio... | java | {
"resource": ""
} |
q20653 | ArrayBackedSortedColumns.fastAddAll | train | 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 | {
"resource": ""
} |
q20654 | ArrayBackedSortedColumns.internalRemove | train | 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 | {
"resource": ""
} |
q20655 | ArrayBackedSortedColumns.reconcileWith | train | private void reconcileWith(int i, Cell cell)
{
cells[i] = cell.reconcile(cells[i]);
} | java | {
"resource": ""
} |
q20656 | SlabAllocator.getRegion | train | 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 | {
"resource": ""
} |
q20657 | IndexHelper.skipIndex | train | public static void skipIndex(DataInput in) throws IOException
{
/* read only the column index list */
int columnIndexSize = in.readInt();
/* skip the column index data */
if (in instanceof FileDataInput)
{
FileUtils.skipBytesFully(in, columnIndexSize);
}
... | java | {
"resource": ""
} |
q20658 | IndexHelper.deserializeIndex | train | public static List<IndexInfo> deserializeIndex(FileDataInput in, CType type) throws IOException
{
int columnIndexSize = in.readInt();
if (columnIndexSize == 0)
return Collections.<IndexInfo>emptyList();
ArrayList<IndexInfo> indexList = new ArrayList<IndexInfo>();
FileMark... | java | {
"resource": ""
} |
q20659 | Timing.newTimer | train | public Timer newTimer(String opType, int sampleCount)
{
final Timer timer = new Timer(sampleCount);
if (!timers.containsKey(opType))
timers.put(opType, new ArrayList<Timer>());
timers.get(opType).add(timer);
return timer;
} | java | {
"resource": ""
} |
q20660 | AbstractBulkRecordWriter.close | train | @Deprecated
public void close(org.apache.hadoop.mapred.Reporter reporter) throws IOException
{
close();
} | java | {
"resource": ""
} |
q20661 | SelectStatement.forSelection | train | static SelectStatement forSelection(CFMetaData cfm, Selection selection)
{
return new SelectStatement(cfm, 0, defaultParameters, selection, null);
} | java | {
"resource": ""
} |
q20662 | SelectStatement.selectACollection | train | private boolean selectACollection()
{
if (!cfm.comparator.hasCollections())
return false;
for (ColumnDefinition def : selection.getColumns())
{
if (def.type.isCollection() && def.type.isMultiCell())
return true;
}
return false;
} | java | {
"resource": ""
} |
q20663 | SelectStatement.addEOC | train | private static Composite addEOC(Composite composite, Bound eocBound)
{
return eocBound == Bound.END ? composite.end() : composite.start();
} | java | {
"resource": ""
} |
q20664 | SelectStatement.addValue | train | private static void addValue(CBuilder builder, ColumnDefinition def, ByteBuffer value) throws InvalidRequestException
{
if (value == null)
throw new InvalidRequestException(String.format("Invalid null value in condition for column %s", def.name));
builder.add(value);
} | java | {
"resource": ""
} |
q20665 | SelectStatement.processColumnFamily | train | void processColumnFamily(ByteBuffer key, ColumnFamily cf, QueryOptions options, long now, Selection.ResultSetBuilder result)
throws InvalidRequestException
{
CFMetaData cfm = cf.metadata();
ByteBuffer[] keyComponents = null;
if (cfm.getKeyValidator() instanceof CompositeType)
{
... | java | {
"resource": ""
} |
q20666 | SelectStatement.isRestrictedByMultipleContains | train | private boolean isRestrictedByMultipleContains(ColumnDefinition columnDef)
{
if (!columnDef.type.isCollection())
return false;
Restriction restriction = metadataRestrictions.get(columnDef.name);
if (!(restriction instanceof Contains))
return false;
Contains... | java | {
"resource": ""
} |
q20667 | Timer.requestReport | train | synchronized void requestReport(CountDownLatch signal)
{
if (finalReport != null)
{
report = finalReport;
finalReport = new TimingInterval(0);
signal.countDown();
}
else
reportRequest = signal;
} | java | {
"resource": ""
} |
q20668 | Timer.close | train | public synchronized void close()
{
if (reportRequest == null)
finalReport = buildReport();
else
{
finalReport = new TimingInterval(0);
report = buildReport();
reportRequest.countDown();
reportRequest = null;
}
} | java | {
"resource": ""
} |
q20669 | StreamWriter.write | train | public void write(WritableByteChannel channel) throws IOException
{
long totalSize = totalSize();
RandomAccessReader file = sstable.openDataReader();
ChecksumValidator validator = new File(sstable.descriptor.filenameFor(Component.CRC)).exists()
? DataInteg... | java | {
"resource": ""
} |
q20670 | StreamWriter.write | train | protected long write(RandomAccessReader reader, ChecksumValidator validator, int start, long length, long bytesTransferred) throws IOException
{
int toTransfer = (int) Math.min(transferBuffer.length, length - bytesTransferred);
int minReadable = (int) Math.min(transferBuffer.length, reader.length() ... | java | {
"resource": ""
} |
q20671 | ObjectSizes.sizeOnHeapOf | train | public static long sizeOnHeapOf(ByteBuffer[] array)
{
long allElementsSize = 0;
for (int i = 0; i < array.length; i++)
if (array[i] != null)
allElementsSize += sizeOnHeapOf(array[i]);
return allElementsSize + sizeOfArray(array);
} | java | {
"resource": ""
} |
q20672 | ObjectSizes.sizeOnHeapOf | train | public static long sizeOnHeapOf(ByteBuffer buffer)
{
if (buffer.isDirect())
return BUFFER_EMPTY_SIZE;
// if we're only referencing a sub-portion of the ByteBuffer, don't count the array overhead (assume it's slab
// allocated, so amortized over all the allocations the overhead is... | java | {
"resource": ""
} |
q20673 | DebuggableThreadPoolExecutor.createWithMaximumPoolSize | train | public static DebuggableThreadPoolExecutor createWithMaximumPoolSize(String threadPoolName, int size, int keepAliveTime, TimeUnit unit)
{
return new DebuggableThreadPoolExecutor(size, Integer.MAX_VALUE, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(threadPoolName));
} | java | {
"resource": ""
} |
q20674 | DebuggableThreadPoolExecutor.execute | train | @Override
public void execute(Runnable command)
{
super.execute(isTracing() && !(command instanceof TraceSessionWrapper)
? new TraceSessionWrapper<Object>(Executors.callable(command, null))
: command);
} | java | {
"resource": ""
} |
q20675 | CliClient.executeCLIStatement | train | public void executeCLIStatement(String statement) throws CharacterCodingException, TException, TimedOutException, NotFoundException, NoSuchFieldException, InvalidRequestException, UnavailableException, InstantiationException, IllegalAccessException
{
Tree tree = CliCompiler.compileQuery(statement);
... | java | {
"resource": ""
} |
q20676 | CliClient.executeSet | train | private void executeSet(Tree statement)
throws TException, InvalidRequestException, UnavailableException, TimedOutException
{
if (!CliMain.isConnected() || !hasKeySpace())
return;
long startTime = System.nanoTime();
// ^(NODE_COLUMN_ACCESS <cf> <key> <column>)
Tr... | java | {
"resource": ""
} |
q20677 | CliClient.executeIncr | train | private void executeIncr(Tree statement, long multiplier)
throws TException, NotFoundException, InvalidRequestException, UnavailableException, TimedOutException
{
if (!CliMain.isConnected() || !hasKeySpace())
return;
Tree columnFamilySpec = statement.getChild(0);
St... | java | {
"resource": ""
} |
q20678 | CliClient.executeAddKeySpace | train | private void executeAddKeySpace(Tree statement)
{
if (!CliMain.isConnected())
return;
// first value is the keyspace name, after that it is all key=value
String keyspaceName = CliUtils.unescapeSQLString(statement.getChild(0).getText());
KsDef ksDef = new KsDef(keyspaceN... | java | {
"resource": ""
} |
q20679 | CliClient.executeAddColumnFamily | train | private void executeAddColumnFamily(Tree statement)
{
if (!CliMain.isConnected() || !hasKeySpace())
return;
// first value is the column family name, after that it is all key=value
CfDef cfDef = new CfDef(keySpace, CliUtils.unescapeSQLString(statement.getChild(0).getText()));
... | java | {
"resource": ""
} |
q20680 | CliClient.executeUpdateKeySpace | train | private void executeUpdateKeySpace(Tree statement)
{
if (!CliMain.isConnected())
return;
try
{
String keyspaceName = CliCompiler.getKeySpace(statement, thriftClient.describe_keyspaces());
KsDef currentKsDef = getKSMetaData(keyspaceName);
KsDe... | java | {
"resource": ""
} |
q20681 | CliClient.executeUpdateColumnFamily | train | private void executeUpdateColumnFamily(Tree statement)
{
if (!CliMain.isConnected() || !hasKeySpace())
return;
String cfName = CliCompiler.getColumnFamily(statement, currentCfDefs());
try
{
// request correct cfDef from the server (we let that call include C... | java | {
"resource": ""
} |
q20682 | CliClient.updateKsDefAttributes | train | private KsDef updateKsDefAttributes(Tree statement, KsDef ksDefToUpdate)
{
KsDef ksDef = new KsDef(ksDefToUpdate);
// removing all column definitions - thrift system_update_keyspace method requires that
ksDef.setCf_defs(new LinkedList<CfDef>());
for(int i = 1; i < statement.getChil... | java | {
"resource": ""
} |
q20683 | CliClient.executeDelKeySpace | train | private void executeDelKeySpace(Tree statement)
throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException
{
if (!CliMain.isConnected())
return;
String keyspaceName = CliCompiler.getKeySpace(statement, thriftClient.describe_keyspaces());
... | java | {
"resource": ""
} |
q20684 | CliClient.executeDelColumnFamily | train | private void executeDelColumnFamily(Tree statement)
throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException
{
if (!CliMain.isConnected() || !hasKeySpace())
return;
String cfName = CliCompiler.getColumnFamily(statement, currentCfDefs());
... | java | {
"resource": ""
} |
q20685 | CliClient.showKeyspace | train | private void showKeyspace(PrintStream output, KsDef ksDef)
{
output.append("create keyspace ").append(CliUtils.maybeEscapeName(ksDef.name));
writeAttr(output, true, "placement_strategy", normaliseType(ksDef.strategy_class, "org.apache.cassandra.locator"));
if (ksDef.strategy_options != nul... | java | {
"resource": ""
} |
q20686 | CliClient.showColumnMeta | train | private void showColumnMeta(PrintStream output, CfDef cfDef, ColumnDef colDef)
{
output.append(NEWLINE + TAB + TAB + "{");
final AbstractType<?> comparator = getFormatType(cfDef.column_type.equals("Super")
? cfDef.subcomparator_type
... | java | {
"resource": ""
} |
q20687 | CliClient.hasKeySpace | train | private boolean hasKeySpace(boolean printError)
{
boolean hasKeyspace = keySpace != null;
if (!hasKeyspace && printError)
sessionState.err.println("Not authorized to a working keyspace.");
return hasKeyspace;
} | java | {
"resource": ""
} |
q20688 | CliClient.getIndexTypeFromString | train | private IndexType getIndexTypeFromString(String indexTypeAsString)
{
IndexType indexType;
try
{
indexType = IndexType.findByValue(new Integer(indexTypeAsString));
}
catch (NumberFormatException e)
{
try
{
// if this... | java | {
"resource": ""
} |
q20689 | CliClient.subColumnNameAsBytes | train | private ByteBuffer subColumnNameAsBytes(String superColumn, String columnFamily)
{
CfDef columnFamilyDef = getCfDef(columnFamily);
return subColumnNameAsBytes(superColumn, columnFamilyDef);
} | java | {
"resource": ""
} |
q20690 | CliClient.subColumnNameAsBytes | train | private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef)
{
String comparatorClass = columnFamilyDef.subcomparator_type;
if (comparatorClass == null)
{
sessionState.out.println(String.format("Notice: defaulting to BytesType subcomparator for '%s'", colum... | java | {
"resource": ""
} |
q20691 | CliClient.getValidatorForValue | train | private AbstractType<?> getValidatorForValue(CfDef cfDef, byte[] columnNameInBytes)
{
String defaultValidator = cfDef.default_validation_class;
for (ColumnDef columnDefinition : cfDef.getColumn_metadata())
{
byte[] nameInBytes = columnDefinition.getName();
if (Array... | java | {
"resource": ""
} |
q20692 | CliClient.getTypeByFunction | train | public static AbstractType<?> getTypeByFunction(String functionName)
{
Function function;
try
{
function = Function.valueOf(functionName.toUpperCase());
}
catch (IllegalArgumentException e)
{
String message = String.format("Function '%s' not f... | java | {
"resource": ""
} |
q20693 | CliClient.updateColumnMetaData | train | private void updateColumnMetaData(CfDef columnFamily, ByteBuffer columnName, String validationClass)
{
ColumnDef column = getColumnDefByName(columnFamily, columnName);
if (column != null)
{
// if validation class is the same - no need to modify it
if (column.getValid... | java | {
"resource": ""
} |
q20694 | CliClient.getColumnDefByName | train | private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName)
{
for (ColumnDef columnDef : columnFamily.getColumn_metadata())
{
byte[] currName = columnDef.getName();
if (ByteBufferUtil.compare(currName, columnName) == 0)
{
retur... | java | {
"resource": ""
} |
q20695 | CliClient.formatSubcolumnName | train | private String formatSubcolumnName(String keyspace, String columnFamily, ByteBuffer name)
{
return getFormatType(getCfDef(keyspace, columnFamily).subcomparator_type).getString(name);
} | java | {
"resource": ""
} |
q20696 | CliClient.formatColumnName | train | private String formatColumnName(String keyspace, String columnFamily, ByteBuffer name)
{
return getFormatType(getCfDef(keyspace, columnFamily).comparator_type).getString(name);
} | java | {
"resource": ""
} |
q20697 | CliClient.elapsedTime | train | private void elapsedTime(long startTime)
{
/** time elapsed in nanoseconds */
long eta = System.nanoTime() - startTime;
sessionState.out.print("Elapsed time: ");
if (eta < 10000000)
{
sessionState.out.print(Math.round(eta/10000.0)/100.0);
}
else
... | java | {
"resource": ""
} |
q20698 | MappedFileDataInput.seek | train | public void seek(long pos) throws IOException
{
long inSegmentPos = pos - segmentOffset;
if (inSegmentPos < 0 || inSegmentPos > buffer.capacity())
throw new IOException(String.format("Seek position %d is not within mmap segment (seg offs: %d, length: %d)", pos, segmentOffset, buffer.capa... | java | {
"resource": ""
} |
q20699 | RowIndex.index | train | @Override
public void index(ByteBuffer key, ColumnFamily columnFamily) {
Log.debug("Indexing row %s in index %s ", key, logName);
lock.readLock().lock();
try {
if (rowService != null) {
long timestamp = System.currentTimeMillis();
rowService.index(... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.