id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
36,100
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
ColumnFamilyRecordReader.getLocation
private String getLocation() { Collection<InetAddress> localAddresses = FBUtilities.getAllLocalAddresses(); for (InetAddress address : localAddresses) { for (String location : split.getLocations()) { InetAddress locationAddress = null; try { locationAddress = InetAddress.getByName(location); } catch (UnknownHostException e) { throw new AssertionError(e); } if (address.equals(locationAddress)) { return location; } } } return split.getLocations()[0]; }
java
private String getLocation() { Collection<InetAddress> localAddresses = FBUtilities.getAllLocalAddresses(); for (InetAddress address : localAddresses) { for (String location : split.getLocations()) { InetAddress locationAddress = null; try { locationAddress = InetAddress.getByName(location); } catch (UnknownHostException e) { throw new AssertionError(e); } if (address.equals(locationAddress)) { return location; } } } return split.getLocations()[0]; }
[ "private", "String", "getLocation", "(", ")", "{", "Collection", "<", "InetAddress", ">", "localAddresses", "=", "FBUtilities", ".", "getAllLocalAddresses", "(", ")", ";", "for", "(", "InetAddress", "address", ":", "localAddresses", ")", "{", "for", "(", "Stri...
not necessarily on Cassandra machines, too. This should be adequate for single-DC clusters, at least.
[ "not", "necessarily", "on", "Cassandra", "machines", "too", ".", "This", "should", "be", "adequate", "for", "single", "-", "DC", "clusters", "at", "least", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java#L189-L213
36,101
Stratio/stratio-cassandra
src/java/org/apache/cassandra/thrift/ThriftConversion.java
ThriftConversion.rethrow
public static RuntimeException rethrow(RequestExecutionException e) throws UnavailableException, TimedOutException { if (e instanceof RequestTimeoutException) throw toThrift((RequestTimeoutException)e); else throw new UnavailableException(); }
java
public static RuntimeException rethrow(RequestExecutionException e) throws UnavailableException, TimedOutException { if (e instanceof RequestTimeoutException) throw toThrift((RequestTimeoutException)e); else throw new UnavailableException(); }
[ "public", "static", "RuntimeException", "rethrow", "(", "RequestExecutionException", "e", ")", "throws", "UnavailableException", ",", "TimedOutException", "{", "if", "(", "e", "instanceof", "RequestTimeoutException", ")", "throw", "toThrift", "(", "(", "RequestTimeoutEx...
for methods that have a return value.
[ "for", "methods", "that", "have", "a", "return", "value", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/thrift/ThriftConversion.java#L76-L82
36,102
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
OutboundTcpConnectionPool.getConnection
OutboundTcpConnection getConnection(MessageOut msg) { Stage stage = msg.getStage(); return stage == Stage.REQUEST_RESPONSE || stage == Stage.INTERNAL_RESPONSE || stage == Stage.GOSSIP ? ackCon : cmdCon; }
java
OutboundTcpConnection getConnection(MessageOut msg) { Stage stage = msg.getStage(); return stage == Stage.REQUEST_RESPONSE || stage == Stage.INTERNAL_RESPONSE || stage == Stage.GOSSIP ? ackCon : cmdCon; }
[ "OutboundTcpConnection", "getConnection", "(", "MessageOut", "msg", ")", "{", "Stage", "stage", "=", "msg", ".", "getStage", "(", ")", ";", "return", "stage", "==", "Stage", ".", "REQUEST_RESPONSE", "||", "stage", "==", "Stage", ".", "INTERNAL_RESPONSE", "||",...
returns the appropriate connection based on message type. returns null if a connection could not be established.
[ "returns", "the", "appropriate", "connection", "based", "on", "message", "type", ".", "returns", "null", "if", "a", "connection", "could", "not", "be", "established", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java#L62-L68
36,103
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/contrib/NotifyingBlockingThreadPoolExecutor.java
NotifyingBlockingThreadPoolExecutor.execute
@Override public void execute(Runnable task) { // count a new task in process tasksInProcess.incrementAndGet(); try { super.execute(task); } catch (RuntimeException e) { // specifically handle RejectedExecutionException tasksInProcess.decrementAndGet(); throw e; } catch (Error e) { tasksInProcess.decrementAndGet(); throw e; } }
java
@Override public void execute(Runnable task) { // count a new task in process tasksInProcess.incrementAndGet(); try { super.execute(task); } catch (RuntimeException e) { // specifically handle RejectedExecutionException tasksInProcess.decrementAndGet(); throw e; } catch (Error e) { tasksInProcess.decrementAndGet(); throw e; } }
[ "@", "Override", "public", "void", "execute", "(", "Runnable", "task", ")", "{", "// count a new task in process", "tasksInProcess", ".", "incrementAndGet", "(", ")", ";", "try", "{", "super", ".", "execute", "(", "task", ")", ";", "}", "catch", "(", "Runtim...
Before calling super's version of this method, the amount of tasks which are currently in process is first incremented. @see java.util.concurrent.ThreadPoolExecutor#execute(Runnable)
[ "Before", "calling", "super", "s", "version", "of", "this", "method", "the", "amount", "of", "tasks", "which", "are", "currently", "in", "process", "is", "first", "incremented", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/NotifyingBlockingThreadPoolExecutor.java#L123-L136
36,104
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/Downsampling.java
Downsampling.getEffectiveIndexIntervalAfterIndex
public static int getEffectiveIndexIntervalAfterIndex(int index, int samplingLevel, int minIndexInterval) { assert index >= 0; index %= samplingLevel; List<Integer> originalIndexes = getOriginalIndexes(samplingLevel); int nextEntryOriginalIndex = (index == originalIndexes.size() - 1) ? BASE_SAMPLING_LEVEL : originalIndexes.get(index + 1); return (nextEntryOriginalIndex - originalIndexes.get(index)) * minIndexInterval; }
java
public static int getEffectiveIndexIntervalAfterIndex(int index, int samplingLevel, int minIndexInterval) { assert index >= 0; index %= samplingLevel; List<Integer> originalIndexes = getOriginalIndexes(samplingLevel); int nextEntryOriginalIndex = (index == originalIndexes.size() - 1) ? BASE_SAMPLING_LEVEL : originalIndexes.get(index + 1); return (nextEntryOriginalIndex - originalIndexes.get(index)) * minIndexInterval; }
[ "public", "static", "int", "getEffectiveIndexIntervalAfterIndex", "(", "int", "index", ",", "int", "samplingLevel", ",", "int", "minIndexInterval", ")", "{", "assert", "index", ">=", "0", ";", "index", "%=", "samplingLevel", ";", "List", "<", "Integer", ">", "...
Calculates the effective index interval after the entry at `index` in an IndexSummary. In other words, this returns the number of partitions in the primary on-disk index before the next partition that has an entry in the index summary. If samplingLevel == BASE_SAMPLING_LEVEL, this will be equal to the index interval. @param index an index into an IndexSummary @param samplingLevel the current sampling level for that IndexSummary @param minIndexInterval the min index interval (effective index interval at full sampling) @return the number of partitions before the next index summary entry, inclusive on one end
[ "Calculates", "the", "effective", "index", "interval", "after", "the", "entry", "at", "index", "in", "an", "IndexSummary", ".", "In", "other", "words", "this", "returns", "the", "number", "of", "partitions", "in", "the", "primary", "on", "-", "disk", "index"...
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/Downsampling.java#L116-L123
36,105
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.allocate
Allocation allocate(Mutation mutation, int size) { final OpOrder.Group opGroup = appendOrder.start(); try { int position = allocate(size); if (position < 0) { opGroup.close(); return null; } markDirty(mutation, position); return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size)); } catch (Throwable t) { opGroup.close(); throw t; } }
java
Allocation allocate(Mutation mutation, int size) { final OpOrder.Group opGroup = appendOrder.start(); try { int position = allocate(size); if (position < 0) { opGroup.close(); return null; } markDirty(mutation, position); return new Allocation(this, opGroup, position, (ByteBuffer) buffer.duplicate().position(position).limit(position + size)); } catch (Throwable t) { opGroup.close(); throw t; } }
[ "Allocation", "allocate", "(", "Mutation", "mutation", ",", "int", "size", ")", "{", "final", "OpOrder", ".", "Group", "opGroup", "=", "appendOrder", ".", "start", "(", ")", ";", "try", "{", "int", "position", "=", "allocate", "(", "size", ")", ";", "i...
Allocate space in this buffer for the provided mutation, and return the allocated Allocation object. Returns null if there is not enough space in this segment, and a new segment is needed.
[ "Allocate", "space", "in", "this", "buffer", "for", "the", "provided", "mutation", "and", "return", "the", "allocated", "Allocation", "object", ".", "Returns", "null", "if", "there", "is", "not", "enough", "space", "in", "this", "segment", "and", "a", "new",...
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L185-L204
36,106
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.allocate
private int allocate(int size) { while (true) { int prev = allocatePosition.get(); int next = prev + size; if (next >= buffer.capacity()) return -1; if (allocatePosition.compareAndSet(prev, next)) return prev; } }
java
private int allocate(int size) { while (true) { int prev = allocatePosition.get(); int next = prev + size; if (next >= buffer.capacity()) return -1; if (allocatePosition.compareAndSet(prev, next)) return prev; } }
[ "private", "int", "allocate", "(", "int", "size", ")", "{", "while", "(", "true", ")", "{", "int", "prev", "=", "allocatePosition", ".", "get", "(", ")", ";", "int", "next", "=", "prev", "+", "size", ";", "if", "(", "next", ">=", "buffer", ".", "...
allocate bytes in the segment, or return -1 if not enough space
[ "allocate", "bytes", "in", "the", "segment", "or", "return", "-", "1", "if", "not", "enough", "space" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L207-L218
36,107
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.discardUnusedTail
void discardUnusedTail() { // we guard this with the OpOrdering instead of synchronised due to potential dead-lock with CLSM.advanceAllocatingFrom() // this actually isn't strictly necessary, as currently all calls to discardUnusedTail occur within a block // already protected by this OpOrdering, but to prevent future potential mistakes, we duplicate the protection here // so that the contract between discardUnusedTail() and sync() is more explicit. try (OpOrder.Group group = appendOrder.start()) { while (true) { int prev = allocatePosition.get(); // we set allocatePosition past buffer.capacity() to make sure we always set discardedTailFrom int next = buffer.capacity() + 1; if (prev == next) return; if (allocatePosition.compareAndSet(prev, next)) { discardedTailFrom = prev; return; } } } }
java
void discardUnusedTail() { // we guard this with the OpOrdering instead of synchronised due to potential dead-lock with CLSM.advanceAllocatingFrom() // this actually isn't strictly necessary, as currently all calls to discardUnusedTail occur within a block // already protected by this OpOrdering, but to prevent future potential mistakes, we duplicate the protection here // so that the contract between discardUnusedTail() and sync() is more explicit. try (OpOrder.Group group = appendOrder.start()) { while (true) { int prev = allocatePosition.get(); // we set allocatePosition past buffer.capacity() to make sure we always set discardedTailFrom int next = buffer.capacity() + 1; if (prev == next) return; if (allocatePosition.compareAndSet(prev, next)) { discardedTailFrom = prev; return; } } } }
[ "void", "discardUnusedTail", "(", ")", "{", "// we guard this with the OpOrdering instead of synchronised due to potential dead-lock with CLSM.advanceAllocatingFrom()", "// this actually isn't strictly necessary, as currently all calls to discardUnusedTail occur within a block", "// already protected ...
ensures no more of this segment is writeable, by allocating any unused section at the end and marking it discarded
[ "ensures", "no", "more", "of", "this", "segment", "is", "writeable", "by", "allocating", "any", "unused", "section", "at", "the", "end", "and", "marking", "it", "discarded" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L221-L243
36,108
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.sync
synchronized void sync() { try { // check we have more work to do if (allocatePosition.get() <= lastSyncedOffset + SYNC_MARKER_SIZE) return; // allocate a new sync marker; this is both necessary in itself, but also serves to demarcate // the point at which we can safely consider records to have been completely written to int nextMarker; nextMarker = allocate(SYNC_MARKER_SIZE); boolean close = false; if (nextMarker < 0) { // ensure no more of this CLS is writeable, and mark ourselves for closing discardUnusedTail(); close = true; // wait for modifications guards both discardedTailFrom, and any outstanding appends waitForModifications(); if (discardedTailFrom < buffer.capacity() - SYNC_MARKER_SIZE) { // if there's room in the discard section to write an empty header, use that as the nextMarker nextMarker = discardedTailFrom; } else { // not enough space left in the buffer, so mark the next sync marker as the EOF position nextMarker = buffer.capacity(); } } else { waitForModifications(); } assert nextMarker > lastSyncedOffset; // write previous sync marker to point to next sync marker // we don't chain the crcs here to ensure this method is idempotent if it fails int offset = lastSyncedOffset; final PureJavaCrc32 crc = new PureJavaCrc32(); crc.updateInt((int) (id & 0xFFFFFFFFL)); crc.updateInt((int) (id >>> 32)); crc.updateInt(offset); buffer.putInt(offset, nextMarker); buffer.putInt(offset + 4, crc.getCrc()); // zero out the next sync marker so replayer can cleanly exit if (nextMarker < buffer.capacity()) { buffer.putInt(nextMarker, 0); buffer.putInt(nextMarker + 4, 0); } // actually perform the sync and signal those waiting for it buffer.force(); if (close) nextMarker = buffer.capacity(); lastSyncedOffset = nextMarker; syncComplete.signalAll(); CLibrary.trySkipCache(fd, offset, nextMarker); if (close) internalClose(); } catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it { throw new FSWriteError(e, getPath()); } }
java
synchronized void sync() { try { // check we have more work to do if (allocatePosition.get() <= lastSyncedOffset + SYNC_MARKER_SIZE) return; // allocate a new sync marker; this is both necessary in itself, but also serves to demarcate // the point at which we can safely consider records to have been completely written to int nextMarker; nextMarker = allocate(SYNC_MARKER_SIZE); boolean close = false; if (nextMarker < 0) { // ensure no more of this CLS is writeable, and mark ourselves for closing discardUnusedTail(); close = true; // wait for modifications guards both discardedTailFrom, and any outstanding appends waitForModifications(); if (discardedTailFrom < buffer.capacity() - SYNC_MARKER_SIZE) { // if there's room in the discard section to write an empty header, use that as the nextMarker nextMarker = discardedTailFrom; } else { // not enough space left in the buffer, so mark the next sync marker as the EOF position nextMarker = buffer.capacity(); } } else { waitForModifications(); } assert nextMarker > lastSyncedOffset; // write previous sync marker to point to next sync marker // we don't chain the crcs here to ensure this method is idempotent if it fails int offset = lastSyncedOffset; final PureJavaCrc32 crc = new PureJavaCrc32(); crc.updateInt((int) (id & 0xFFFFFFFFL)); crc.updateInt((int) (id >>> 32)); crc.updateInt(offset); buffer.putInt(offset, nextMarker); buffer.putInt(offset + 4, crc.getCrc()); // zero out the next sync marker so replayer can cleanly exit if (nextMarker < buffer.capacity()) { buffer.putInt(nextMarker, 0); buffer.putInt(nextMarker + 4, 0); } // actually perform the sync and signal those waiting for it buffer.force(); if (close) nextMarker = buffer.capacity(); lastSyncedOffset = nextMarker; syncComplete.signalAll(); CLibrary.trySkipCache(fd, offset, nextMarker); if (close) internalClose(); } catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it { throw new FSWriteError(e, getPath()); } }
[ "synchronized", "void", "sync", "(", ")", "{", "try", "{", "// check we have more work to do", "if", "(", "allocatePosition", ".", "get", "(", ")", "<=", "lastSyncedOffset", "+", "SYNC_MARKER_SIZE", ")", "return", ";", "// allocate a new sync marker; this is both necess...
Forces a disk flush for this segment file.
[ "Forces", "a", "disk", "flush", "for", "this", "segment", "file", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L257-L331
36,109
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.recycle
CommitLogSegment recycle() { try { sync(); } catch (FSWriteError e) { logger.error("I/O error flushing {} {}", this, e.getMessage()); throw e; } close(); return new CommitLogSegment(getPath()); }
java
CommitLogSegment recycle() { try { sync(); } catch (FSWriteError e) { logger.error("I/O error flushing {} {}", this, e.getMessage()); throw e; } close(); return new CommitLogSegment(getPath()); }
[ "CommitLogSegment", "recycle", "(", ")", "{", "try", "{", "sync", "(", ")", ";", "}", "catch", "(", "FSWriteError", "e", ")", "{", "logger", ".", "error", "(", "\"I/O error flushing {} {}\"", ",", "this", ",", "e", ".", "getMessage", "(", ")", ")", ";"...
Recycle processes an unneeded segment file for reuse. @return a new CommitLogSegment representing the newly reusable segment.
[ "Recycle", "processes", "an", "unneeded", "segment", "file", "for", "reuse", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L351-L366
36,110
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.markClean
public synchronized void markClean(UUID cfId, ReplayPosition context) { if (!cfDirty.containsKey(cfId)) return; if (context.segment == id) markClean(cfId, context.position); else if (context.segment > id) markClean(cfId, Integer.MAX_VALUE); }
java
public synchronized void markClean(UUID cfId, ReplayPosition context) { if (!cfDirty.containsKey(cfId)) return; if (context.segment == id) markClean(cfId, context.position); else if (context.segment > id) markClean(cfId, Integer.MAX_VALUE); }
[ "public", "synchronized", "void", "markClean", "(", "UUID", "cfId", ",", "ReplayPosition", "context", ")", "{", "if", "(", "!", "cfDirty", ".", "containsKey", "(", "cfId", ")", ")", "return", ";", "if", "(", "context", ".", "segment", "==", "id", ")", ...
Marks the ColumnFamily specified by cfId as clean for this log segment. If the given context argument is contained in this file, it will only mark the CF as clean if no newer writes have taken place. @param cfId the column family ID that is now clean @param context the optional clean offset
[ "Marks", "the", "ColumnFamily", "specified", "by", "cfId", "as", "clean", "for", "this", "log", "segment", ".", "If", "the", "given", "context", "argument", "is", "contained", "in", "this", "file", "it", "will", "only", "mark", "the", "CF", "as", "clean", ...
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L455-L463
36,111
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.dirtyString
public String dirtyString() { StringBuilder sb = new StringBuilder(); for (UUID cfId : getDirtyCFIDs()) { CFMetaData m = Schema.instance.getCFMetaData(cfId); sb.append(m == null ? "<deleted>" : m.cfName).append(" (").append(cfId).append("), "); } return sb.toString(); }
java
public String dirtyString() { StringBuilder sb = new StringBuilder(); for (UUID cfId : getDirtyCFIDs()) { CFMetaData m = Schema.instance.getCFMetaData(cfId); sb.append(m == null ? "<deleted>" : m.cfName).append(" (").append(cfId).append("), "); } return sb.toString(); }
[ "public", "String", "dirtyString", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "UUID", "cfId", ":", "getDirtyCFIDs", "(", ")", ")", "{", "CFMetaData", "m", "=", "Schema", ".", "instance", ".", "getCFMetaD...
For debugging, not fast
[ "For", "debugging", "not", "fast" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L557-L566
36,112
Stratio/stratio-cassandra
src/java/org/apache/cassandra/streaming/StreamPlan.java
StreamPlan.transferFiles
public StreamPlan transferFiles(InetAddress to, Collection<StreamSession.SSTableStreamingSections> sstableDetails) { coordinator.transferFiles(to, sstableDetails); return this; }
java
public StreamPlan transferFiles(InetAddress to, Collection<StreamSession.SSTableStreamingSections> sstableDetails) { coordinator.transferFiles(to, sstableDetails); return this; }
[ "public", "StreamPlan", "transferFiles", "(", "InetAddress", "to", ",", "Collection", "<", "StreamSession", ".", "SSTableStreamingSections", ">", "sstableDetails", ")", "{", "coordinator", ".", "transferFiles", "(", "to", ",", "sstableDetails", ")", ";", "return", ...
Add transfer task to send given SSTable files. @param to endpoint address of receiver @param sstableDetails sstables with file positions and estimated key count. this collection will be modified to remove those files that are successfully handed off @return this object for chaining
[ "Add", "transfer", "task", "to", "send", "given", "SSTable", "files", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/StreamPlan.java#L142-L147
36,113
Stratio/stratio-cassandra
src/java/org/apache/cassandra/auth/CassandraAuthorizer.java
CassandraAuthorizer.list
public Set<PermissionDetails> list(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, String of) throws RequestValidationException, RequestExecutionException { if (!performer.isSuper() && !performer.getName().equals(of)) throw new UnauthorizedException(String.format("You are not authorized to view %s's permissions", of == null ? "everyone" : of)); Set<PermissionDetails> details = new HashSet<PermissionDetails>(); for (UntypedResultSet.Row row : process(buildListQuery(resource, of))) { if (row.has(PERMISSIONS)) { for (String p : row.getSet(PERMISSIONS, UTF8Type.instance)) { Permission permission = Permission.valueOf(p); if (permissions.contains(permission)) details.add(new PermissionDetails(row.getString(USERNAME), DataResource.fromName(row.getString(RESOURCE)), permission)); } } } return details; }
java
public Set<PermissionDetails> list(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, String of) throws RequestValidationException, RequestExecutionException { if (!performer.isSuper() && !performer.getName().equals(of)) throw new UnauthorizedException(String.format("You are not authorized to view %s's permissions", of == null ? "everyone" : of)); Set<PermissionDetails> details = new HashSet<PermissionDetails>(); for (UntypedResultSet.Row row : process(buildListQuery(resource, of))) { if (row.has(PERMISSIONS)) { for (String p : row.getSet(PERMISSIONS, UTF8Type.instance)) { Permission permission = Permission.valueOf(p); if (permissions.contains(permission)) details.add(new PermissionDetails(row.getString(USERNAME), DataResource.fromName(row.getString(RESOURCE)), permission)); } } } return details; }
[ "public", "Set", "<", "PermissionDetails", ">", "list", "(", "AuthenticatedUser", "performer", ",", "Set", "<", "Permission", ">", "permissions", ",", "IResource", "resource", ",", "String", "of", ")", "throws", "RequestValidationException", ",", "RequestExecutionEx...
allowed to see their own permissions.
[ "allowed", "to", "see", "their", "own", "permissions", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/auth/CassandraAuthorizer.java#L126-L151
36,114
Stratio/stratio-cassandra
src/java/org/apache/cassandra/auth/CassandraAuthorizer.java
CassandraAuthorizer.revokeAll
public void revokeAll(String droppedUser) { try { process(String.format("DELETE FROM %s.%s WHERE username = '%s'", Auth.AUTH_KS, PERMISSIONS_CF, escape(droppedUser))); } catch (RequestExecutionException e) { logger.warn("CassandraAuthorizer failed to revoke all permissions of {}: {}", droppedUser, e); } }
java
public void revokeAll(String droppedUser) { try { process(String.format("DELETE FROM %s.%s WHERE username = '%s'", Auth.AUTH_KS, PERMISSIONS_CF, escape(droppedUser))); } catch (RequestExecutionException e) { logger.warn("CassandraAuthorizer failed to revoke all permissions of {}: {}", droppedUser, e); } }
[ "public", "void", "revokeAll", "(", "String", "droppedUser", ")", "{", "try", "{", "process", "(", "String", ".", "format", "(", "\"DELETE FROM %s.%s WHERE username = '%s'\"", ",", "Auth", ".", "AUTH_KS", ",", "PERMISSIONS_CF", ",", "escape", "(", "droppedUser", ...
Called prior to deleting the user with DROP USER query. Internal hook, so no permission checks are needed here.
[ "Called", "prior", "to", "deleting", "the", "user", "with", "DROP", "USER", "query", ".", "Internal", "hook", "so", "no", "permission", "checks", "are", "needed", "here", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/auth/CassandraAuthorizer.java#L182-L192
36,115
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/util/TaskQueue.java
TaskQueue.submitSynchronous
public void submitSynchronous(Runnable task) { lock.writeLock().lock(); try { awaitInner(); task.run(); } catch (InterruptedException e) { Log.error(e, "Task queue isolated submission interrupted"); throw new RuntimeException(e); } catch (Exception e) { Log.error(e, "Task queue isolated submission failed"); throw new RuntimeException(e); } finally { lock.writeLock().unlock(); } }
java
public void submitSynchronous(Runnable task) { lock.writeLock().lock(); try { awaitInner(); task.run(); } catch (InterruptedException e) { Log.error(e, "Task queue isolated submission interrupted"); throw new RuntimeException(e); } catch (Exception e) { Log.error(e, "Task queue isolated submission failed"); throw new RuntimeException(e); } finally { lock.writeLock().unlock(); } }
[ "public", "void", "submitSynchronous", "(", "Runnable", "task", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "awaitInner", "(", ")", ";", "task", ".", "run", "(", ")", ";", "}", "catch", "(", "InterruptedExcep...
Submits a non value-returning task for synchronous execution. It waits for all synchronous tasks to be completed. @param task A task to be executed synchronously.
[ "Submits", "a", "non", "value", "-", "returning", "task", "for", "synchronous", "execution", ".", "It", "waits", "for", "all", "synchronous", "tasks", "to", "be", "completed", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/util/TaskQueue.java#L124-L138
36,116
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/CLibrary.java
CLibrary.getfd
public static int getfd(FileDescriptor descriptor) { Field field = FBUtilities.getProtectedField(descriptor.getClass(), "fd"); if (field == null) return -1; try { return field.getInt(descriptor); } catch (Exception e) { JVMStabilityInspector.inspectThrowable(e); logger.warn("unable to read fd field from FileDescriptor"); } return -1; }
java
public static int getfd(FileDescriptor descriptor) { Field field = FBUtilities.getProtectedField(descriptor.getClass(), "fd"); if (field == null) return -1; try { return field.getInt(descriptor); } catch (Exception e) { JVMStabilityInspector.inspectThrowable(e); logger.warn("unable to read fd field from FileDescriptor"); } return -1; }
[ "public", "static", "int", "getfd", "(", "FileDescriptor", "descriptor", ")", "{", "Field", "field", "=", "FBUtilities", ".", "getProtectedField", "(", "descriptor", ".", "getClass", "(", ")", ",", "\"fd\"", ")", ";", "if", "(", "field", "==", "null", ")",...
Get system file descriptor from FileDescriptor object. @param descriptor - FileDescriptor objec to get fd from @return file descriptor, -1 or error
[ "Get", "system", "file", "descriptor", "from", "FileDescriptor", "object", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/CLibrary.java#L286-L304
36,117
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Memtable.java
Memtable.accepts
public boolean accepts(OpOrder.Group opGroup, ReplayPosition replayPosition) { // if the barrier hasn't been set yet, then this memtable is still taking ALL writes OpOrder.Barrier barrier = this.writeBarrier; if (barrier == null) return true; // if the barrier has been set, but is in the past, we are definitely destined for a future memtable if (!barrier.isAfter(opGroup)) return false; // if we aren't durable we are directed only by the barrier if (replayPosition == null) return true; while (true) { // otherwise we check if we are in the past/future wrt the CL boundary; // if the boundary hasn't been finalised yet, we simply update it to the max of // its current value and ours; if it HAS been finalised, we simply accept its judgement // this permits us to coordinate a safe boundary, as the boundary choice is made // atomically wrt our max() maintenance, so an operation cannot sneak into the past ReplayPosition currentLast = lastReplayPosition.get(); if (currentLast instanceof LastReplayPosition) return currentLast.compareTo(replayPosition) >= 0; if (currentLast != null && currentLast.compareTo(replayPosition) >= 0) return true; if (lastReplayPosition.compareAndSet(currentLast, replayPosition)) return true; } }
java
public boolean accepts(OpOrder.Group opGroup, ReplayPosition replayPosition) { // if the barrier hasn't been set yet, then this memtable is still taking ALL writes OpOrder.Barrier barrier = this.writeBarrier; if (barrier == null) return true; // if the barrier has been set, but is in the past, we are definitely destined for a future memtable if (!barrier.isAfter(opGroup)) return false; // if we aren't durable we are directed only by the barrier if (replayPosition == null) return true; while (true) { // otherwise we check if we are in the past/future wrt the CL boundary; // if the boundary hasn't been finalised yet, we simply update it to the max of // its current value and ours; if it HAS been finalised, we simply accept its judgement // this permits us to coordinate a safe boundary, as the boundary choice is made // atomically wrt our max() maintenance, so an operation cannot sneak into the past ReplayPosition currentLast = lastReplayPosition.get(); if (currentLast instanceof LastReplayPosition) return currentLast.compareTo(replayPosition) >= 0; if (currentLast != null && currentLast.compareTo(replayPosition) >= 0) return true; if (lastReplayPosition.compareAndSet(currentLast, replayPosition)) return true; } }
[ "public", "boolean", "accepts", "(", "OpOrder", ".", "Group", "opGroup", ",", "ReplayPosition", "replayPosition", ")", "{", "// if the barrier hasn't been set yet, then this memtable is still taking ALL writes", "OpOrder", ".", "Barrier", "barrier", "=", "this", ".", "write...
decide if this memtable should take the write, or if it should go to the next memtable
[ "decide", "if", "this", "memtable", "should", "take", "the", "write", "or", "if", "it", "should", "go", "to", "the", "next", "memtable" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Memtable.java#L125-L152
36,118
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Memtable.java
Memtable.put
long put(DecoratedKey key, ColumnFamily cf, SecondaryIndexManager.Updater indexer, OpOrder.Group opGroup) { AtomicBTreeColumns previous = rows.get(key); if (previous == null) { AtomicBTreeColumns empty = cf.cloneMeShallow(AtomicBTreeColumns.factory, false); final DecoratedKey cloneKey = allocator.clone(key, opGroup); // We'll add the columns later. This avoids wasting works if we get beaten in the putIfAbsent previous = rows.putIfAbsent(cloneKey, empty); if (previous == null) { previous = empty; // allocate the row overhead after the fact; this saves over allocating and having to free after, but // means we can overshoot our declared limit. int overhead = (int) (cfs.partitioner.getHeapSizeOf(key.getToken()) + ROW_OVERHEAD_HEAP_SIZE); allocator.onHeap().allocate(overhead, opGroup); } else { allocator.reclaimer().reclaimImmediately(cloneKey); } } final Pair<Long, Long> pair = previous.addAllWithSizeDelta(cf, allocator, opGroup, indexer); liveDataSize.addAndGet(pair.left); currentOperations.addAndGet(cf.getColumnCount() + (cf.isMarkedForDelete() ? 1 : 0) + cf.deletionInfo().rangeCount()); return pair.right; }
java
long put(DecoratedKey key, ColumnFamily cf, SecondaryIndexManager.Updater indexer, OpOrder.Group opGroup) { AtomicBTreeColumns previous = rows.get(key); if (previous == null) { AtomicBTreeColumns empty = cf.cloneMeShallow(AtomicBTreeColumns.factory, false); final DecoratedKey cloneKey = allocator.clone(key, opGroup); // We'll add the columns later. This avoids wasting works if we get beaten in the putIfAbsent previous = rows.putIfAbsent(cloneKey, empty); if (previous == null) { previous = empty; // allocate the row overhead after the fact; this saves over allocating and having to free after, but // means we can overshoot our declared limit. int overhead = (int) (cfs.partitioner.getHeapSizeOf(key.getToken()) + ROW_OVERHEAD_HEAP_SIZE); allocator.onHeap().allocate(overhead, opGroup); } else { allocator.reclaimer().reclaimImmediately(cloneKey); } } final Pair<Long, Long> pair = previous.addAllWithSizeDelta(cf, allocator, opGroup, indexer); liveDataSize.addAndGet(pair.left); currentOperations.addAndGet(cf.getColumnCount() + (cf.isMarkedForDelete() ? 1 : 0) + cf.deletionInfo().rangeCount()); return pair.right; }
[ "long", "put", "(", "DecoratedKey", "key", ",", "ColumnFamily", "cf", ",", "SecondaryIndexManager", ".", "Updater", "indexer", ",", "OpOrder", ".", "Group", "opGroup", ")", "{", "AtomicBTreeColumns", "previous", "=", "rows", ".", "get", "(", "key", ")", ";",...
Should only be called by ColumnFamilyStore.apply via Keyspace.apply, which supplies the appropriate OpOrdering. replayPosition should only be null if this is a secondary index, in which case it is *expected* to be null
[ "Should", "only", "be", "called", "by", "ColumnFamilyStore", ".", "apply", "via", "Keyspace", ".", "apply", "which", "supplies", "the", "appropriate", "OpOrdering", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Memtable.java#L184-L212
36,119
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/DatabaseDescriptor.java
DatabaseDescriptor.loadSchemas
public static void loadSchemas(boolean updateVersion) { ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(SystemKeyspace.SCHEMA_KEYSPACES_CF); // if keyspace with definitions is empty try loading the old way if (schemaCFS.estimateKeys() == 0) { logger.info("Couldn't detect any schema definitions in local storage."); // peek around the data directories to see if anything is there. if (hasExistingNoSystemTables()) logger.info("Found keyspace data in data directories. Consider using cqlsh to define your schema."); else logger.info("To create keyspaces and column families, see 'help create' in cqlsh."); } else { Schema.instance.load(DefsTables.loadFromKeyspace()); } if (updateVersion) Schema.instance.updateVersion(); }
java
public static void loadSchemas(boolean updateVersion) { ColumnFamilyStore schemaCFS = SystemKeyspace.schemaCFS(SystemKeyspace.SCHEMA_KEYSPACES_CF); // if keyspace with definitions is empty try loading the old way if (schemaCFS.estimateKeys() == 0) { logger.info("Couldn't detect any schema definitions in local storage."); // peek around the data directories to see if anything is there. if (hasExistingNoSystemTables()) logger.info("Found keyspace data in data directories. Consider using cqlsh to define your schema."); else logger.info("To create keyspaces and column families, see 'help create' in cqlsh."); } else { Schema.instance.load(DefsTables.loadFromKeyspace()); } if (updateVersion) Schema.instance.updateVersion(); }
[ "public", "static", "void", "loadSchemas", "(", "boolean", "updateVersion", ")", "{", "ColumnFamilyStore", "schemaCFS", "=", "SystemKeyspace", ".", "schemaCFS", "(", "SystemKeyspace", ".", "SCHEMA_KEYSPACES_CF", ")", ";", "// if keyspace with definitions is empty try loadin...
Load schema definitions. @param updateVersion true if schema version needs to be updated
[ "Load", "schema", "definitions", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L678-L699
36,120
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/DatabaseDescriptor.java
DatabaseDescriptor.createAllDirectories
public static void createAllDirectories() { try { if (conf.data_file_directories.length == 0) throw new ConfigurationException("At least one DataFileDirectory must be specified"); for (String dataFileDirectory : conf.data_file_directories) { FileUtils.createDirectory(dataFileDirectory); } if (conf.commitlog_directory == null) throw new ConfigurationException("commitlog_directory must be specified"); FileUtils.createDirectory(conf.commitlog_directory); if (conf.saved_caches_directory == null) throw new ConfigurationException("saved_caches_directory must be specified"); FileUtils.createDirectory(conf.saved_caches_directory); } catch (ConfigurationException e) { logger.error("Fatal error: {}", e.getMessage()); System.err.println("Bad configuration; unable to start server"); System.exit(1); } catch (FSWriteError e) { logger.error("Fatal error: {}", e.getMessage()); System.err.println(e.getCause().getMessage() + "; unable to start server"); System.exit(1); } }
java
public static void createAllDirectories() { try { if (conf.data_file_directories.length == 0) throw new ConfigurationException("At least one DataFileDirectory must be specified"); for (String dataFileDirectory : conf.data_file_directories) { FileUtils.createDirectory(dataFileDirectory); } if (conf.commitlog_directory == null) throw new ConfigurationException("commitlog_directory must be specified"); FileUtils.createDirectory(conf.commitlog_directory); if (conf.saved_caches_directory == null) throw new ConfigurationException("saved_caches_directory must be specified"); FileUtils.createDirectory(conf.saved_caches_directory); } catch (ConfigurationException e) { logger.error("Fatal error: {}", e.getMessage()); System.err.println("Bad configuration; unable to start server"); System.exit(1); } catch (FSWriteError e) { logger.error("Fatal error: {}", e.getMessage()); System.err.println(e.getCause().getMessage() + "; unable to start server"); System.exit(1); } }
[ "public", "static", "void", "createAllDirectories", "(", ")", "{", "try", "{", "if", "(", "conf", ".", "data_file_directories", ".", "length", "==", "0", ")", "throw", "new", "ConfigurationException", "(", "\"At least one DataFileDirectory must be specified\"", ")", ...
Creates all storage-related directories.
[ "Creates", "all", "storage", "-", "related", "directories", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L770-L804
36,121
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/DatabaseDescriptor.java
DatabaseDescriptor.getTimeout
public static long getTimeout(MessagingService.Verb verb) { switch (verb) { case READ: return getReadRpcTimeout(); case RANGE_SLICE: return getRangeRpcTimeout(); case TRUNCATE: return getTruncateRpcTimeout(); case READ_REPAIR: case MUTATION: case PAXOS_COMMIT: case PAXOS_PREPARE: case PAXOS_PROPOSE: return getWriteRpcTimeout(); case COUNTER_MUTATION: return getCounterWriteRpcTimeout(); default: return getRpcTimeout(); } }
java
public static long getTimeout(MessagingService.Verb verb) { switch (verb) { case READ: return getReadRpcTimeout(); case RANGE_SLICE: return getRangeRpcTimeout(); case TRUNCATE: return getTruncateRpcTimeout(); case READ_REPAIR: case MUTATION: case PAXOS_COMMIT: case PAXOS_PREPARE: case PAXOS_PROPOSE: return getWriteRpcTimeout(); case COUNTER_MUTATION: return getCounterWriteRpcTimeout(); default: return getRpcTimeout(); } }
[ "public", "static", "long", "getTimeout", "(", "MessagingService", ".", "Verb", "verb", ")", "{", "switch", "(", "verb", ")", "{", "case", "READ", ":", "return", "getReadRpcTimeout", "(", ")", ";", "case", "RANGE_SLICE", ":", "return", "getRangeRpcTimeout", ...
not part of the Verb enum so we can change timeouts easily via JMX
[ "not", "part", "of", "the", "Verb", "enum", "so", "we", "can", "change", "timeouts", "easily", "via", "JMX" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1023-L1044
36,122
Stratio/stratio-cassandra
src/java/org/apache/cassandra/security/SSLFactory.java
SSLFactory.getSocket
public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException { SSLContext ctx = createSSLContext(options, true); SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port, localAddress, localPort); String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites); socket.setEnabledCipherSuites(suits); socket.setEnabledProtocols(ACCEPTED_PROTOCOLS); return socket; }
java
public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException { SSLContext ctx = createSSLContext(options, true); SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port, localAddress, localPort); String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites); socket.setEnabledCipherSuites(suits); socket.setEnabledProtocols(ACCEPTED_PROTOCOLS); return socket; }
[ "public", "static", "SSLSocket", "getSocket", "(", "EncryptionOptions", "options", ",", "InetAddress", "address", ",", "int", "port", ",", "InetAddress", "localAddress", ",", "int", "localPort", ")", "throws", "IOException", "{", "SSLContext", "ctx", "=", "createS...
Create a socket and connect
[ "Create", "a", "socket", "and", "connect" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/security/SSLFactory.java#L70-L78
36,123
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/filter/QueryFilter.java
QueryFilter.collateOnDiskAtom
public void collateOnDiskAtom(ColumnFamily returnCF, Iterator<? extends OnDiskAtom> toCollate, int gcBefore) { filter.collectReducedColumns(returnCF, gatherTombstones(returnCF, toCollate), gcBefore, timestamp); }
java
public void collateOnDiskAtom(ColumnFamily returnCF, Iterator<? extends OnDiskAtom> toCollate, int gcBefore) { filter.collectReducedColumns(returnCF, gatherTombstones(returnCF, toCollate), gcBefore, timestamp); }
[ "public", "void", "collateOnDiskAtom", "(", "ColumnFamily", "returnCF", ",", "Iterator", "<", "?", "extends", "OnDiskAtom", ">", "toCollate", ",", "int", "gcBefore", ")", "{", "filter", ".", "collectReducedColumns", "(", "returnCF", ",", "gatherTombstones", "(", ...
When there is only a single source of atoms, we can skip the collate step
[ "When", "there", "is", "only", "a", "single", "source", "of", "atoms", "we", "can", "skip", "the", "collate", "step" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/filter/QueryFilter.java#L85-L88
36,124
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/filter/QueryFilter.java
QueryFilter.getIdentityFilter
public static QueryFilter getIdentityFilter(DecoratedKey key, String cfName, long timestamp) { return new QueryFilter(key, cfName, new IdentityQueryFilter(), timestamp); }
java
public static QueryFilter getIdentityFilter(DecoratedKey key, String cfName, long timestamp) { return new QueryFilter(key, cfName, new IdentityQueryFilter(), timestamp); }
[ "public", "static", "QueryFilter", "getIdentityFilter", "(", "DecoratedKey", "key", ",", "String", "cfName", ",", "long", "timestamp", ")", "{", "return", "new", "QueryFilter", "(", "key", ",", "cfName", ",", "new", "IdentityQueryFilter", "(", ")", ",", "times...
return a QueryFilter object that includes every column in the row. This is dangerous on large rows; avoid except for test code.
[ "return", "a", "QueryFilter", "object", "that", "includes", "every", "column", "in", "the", "row", ".", "This", "is", "dangerous", "on", "large", "rows", ";", "avoid", "except", "for", "test", "code", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/filter/QueryFilter.java#L225-L228
36,125
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.getMemtableFor
public Memtable getMemtableFor(OpOrder.Group opGroup, ReplayPosition replayPosition) { // since any new memtables appended to the list after we fetch it will be for operations started // after us, we can safely assume that we will always find the memtable that 'accepts' us; // if the barrier for any memtable is set whilst we are reading the list, it must accept us. // there may be multiple memtables in the list that would 'accept' us, however we only ever choose // the oldest such memtable, as accepts() only prevents us falling behind (i.e. ensures we don't // assign operations to a memtable that was retired/queued before we started) for (Memtable memtable : view.get().liveMemtables) { if (memtable.accepts(opGroup, replayPosition)) return memtable; } throw new AssertionError(view.get().liveMemtables.toString()); }
java
public Memtable getMemtableFor(OpOrder.Group opGroup, ReplayPosition replayPosition) { // since any new memtables appended to the list after we fetch it will be for operations started // after us, we can safely assume that we will always find the memtable that 'accepts' us; // if the barrier for any memtable is set whilst we are reading the list, it must accept us. // there may be multiple memtables in the list that would 'accept' us, however we only ever choose // the oldest such memtable, as accepts() only prevents us falling behind (i.e. ensures we don't // assign operations to a memtable that was retired/queued before we started) for (Memtable memtable : view.get().liveMemtables) { if (memtable.accepts(opGroup, replayPosition)) return memtable; } throw new AssertionError(view.get().liveMemtables.toString()); }
[ "public", "Memtable", "getMemtableFor", "(", "OpOrder", ".", "Group", "opGroup", ",", "ReplayPosition", "replayPosition", ")", "{", "// since any new memtables appended to the list after we fetch it will be for operations started", "// after us, we can safely assume that we will always f...
get the Memtable that the ordered writeOp should be directed to
[ "get", "the", "Memtable", "that", "the", "ordered", "writeOp", "should", "be", "directed", "to" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L60-L75
36,126
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.replaceWithNewInstances
public void replaceWithNewInstances(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { replaceReaders(toReplace, replaceWith, true); }
java
public void replaceWithNewInstances(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { replaceReaders(toReplace, replaceWith, true); }
[ "public", "void", "replaceWithNewInstances", "(", "Collection", "<", "SSTableReader", ">", "toReplace", ",", "Collection", "<", "SSTableReader", ">", "replaceWith", ")", "{", "replaceReaders", "(", "toReplace", ",", "replaceWith", ",", "true", ")", ";", "}" ]
Replaces existing sstables with new instances, makes sure compaction strategies have the correct instance @param toReplace @param replaceWith
[ "Replaces", "existing", "sstables", "with", "new", "instances", "makes", "sure", "compaction", "strategies", "have", "the", "correct", "instance" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L305-L308
36,127
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.replaceEarlyOpenedFiles
public void replaceEarlyOpenedFiles(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { for (SSTableReader s : toReplace) assert s.openReason.equals(SSTableReader.OpenReason.EARLY); // note that we can replace an early opened file with a real one replaceReaders(toReplace, replaceWith, false); }
java
public void replaceEarlyOpenedFiles(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { for (SSTableReader s : toReplace) assert s.openReason.equals(SSTableReader.OpenReason.EARLY); // note that we can replace an early opened file with a real one replaceReaders(toReplace, replaceWith, false); }
[ "public", "void", "replaceEarlyOpenedFiles", "(", "Collection", "<", "SSTableReader", ">", "toReplace", ",", "Collection", "<", "SSTableReader", ">", "replaceWith", ")", "{", "for", "(", "SSTableReader", "s", ":", "toReplace", ")", "assert", "s", ".", "openReaso...
Adds the early opened files to the data tracker, but does not tell compaction strategies about it note that we dont track the live size of these sstables @param toReplace @param replaceWith
[ "Adds", "the", "early", "opened", "files", "to", "the", "data", "tracker", "but", "does", "not", "tell", "compaction", "strategies", "about", "it" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L317-L323
36,128
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.unreferenceSSTables
public void unreferenceSSTables() { Set<SSTableReader> notCompacting; View currentView, newView; do { currentView = view.get(); notCompacting = currentView.nonCompactingSStables(); newView = currentView.replace(notCompacting, Collections.<SSTableReader>emptySet()); } while (!view.compareAndSet(currentView, newView)); if (notCompacting.isEmpty()) { // notifySSTablesChanged -> LeveledManifest.promote doesn't like a no-op "promotion" return; } notifySSTablesChanged(notCompacting, Collections.<SSTableReader>emptySet(), OperationType.UNKNOWN); removeOldSSTablesSize(notCompacting); releaseReferences(notCompacting, true); }
java
public void unreferenceSSTables() { Set<SSTableReader> notCompacting; View currentView, newView; do { currentView = view.get(); notCompacting = currentView.nonCompactingSStables(); newView = currentView.replace(notCompacting, Collections.<SSTableReader>emptySet()); } while (!view.compareAndSet(currentView, newView)); if (notCompacting.isEmpty()) { // notifySSTablesChanged -> LeveledManifest.promote doesn't like a no-op "promotion" return; } notifySSTablesChanged(notCompacting, Collections.<SSTableReader>emptySet(), OperationType.UNKNOWN); removeOldSSTablesSize(notCompacting); releaseReferences(notCompacting, true); }
[ "public", "void", "unreferenceSSTables", "(", ")", "{", "Set", "<", "SSTableReader", ">", "notCompacting", ";", "View", "currentView", ",", "newView", ";", "do", "{", "currentView", "=", "view", ".", "get", "(", ")", ";", "notCompacting", "=", "currentView",...
removes all sstables that are not busy compacting.
[ "removes", "all", "sstables", "that", "are", "not", "busy", "compacting", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L328-L349
36,129
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.removeUnreadableSSTables
void removeUnreadableSSTables(File directory) { View currentView, newView; Set<SSTableReader> remaining = new HashSet<>(); do { currentView = view.get(); for (SSTableReader r : currentView.nonCompactingSStables()) if (!r.descriptor.directory.equals(directory)) remaining.add(r); if (remaining.size() == currentView.nonCompactingSStables().size()) return; newView = currentView.replace(currentView.sstables, remaining); } while (!view.compareAndSet(currentView, newView)); for (SSTableReader sstable : currentView.sstables) if (!remaining.contains(sstable)) sstable.selfRef().release(); notifySSTablesChanged(remaining, Collections.<SSTableReader>emptySet(), OperationType.UNKNOWN); }
java
void removeUnreadableSSTables(File directory) { View currentView, newView; Set<SSTableReader> remaining = new HashSet<>(); do { currentView = view.get(); for (SSTableReader r : currentView.nonCompactingSStables()) if (!r.descriptor.directory.equals(directory)) remaining.add(r); if (remaining.size() == currentView.nonCompactingSStables().size()) return; newView = currentView.replace(currentView.sstables, remaining); } while (!view.compareAndSet(currentView, newView)); for (SSTableReader sstable : currentView.sstables) if (!remaining.contains(sstable)) sstable.selfRef().release(); notifySSTablesChanged(remaining, Collections.<SSTableReader>emptySet(), OperationType.UNKNOWN); }
[ "void", "removeUnreadableSSTables", "(", "File", "directory", ")", "{", "View", "currentView", ",", "newView", ";", "Set", "<", "SSTableReader", ">", "remaining", "=", "new", "HashSet", "<>", "(", ")", ";", "do", "{", "currentView", "=", "view", ".", "get"...
Removes every SSTable in the directory from the DataTracker's view. @param directory the unreadable directory, possibly with SSTables in it, but not necessarily.
[ "Removes", "every", "SSTable", "in", "the", "directory", "from", "the", "DataTracker", "s", "view", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L355-L376
36,130
Stratio/stratio-cassandra
tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java
SettingsCommandUser.build
public static SettingsCommandUser build(String[] params) { GroupedOptions options = GroupedOptions.select(params, new Options(new Uncertainty()), new Options(new Duration()), new Options(new Count())); if (options == null) { printHelp(); System.out.println("Invalid USER options provided, see output for valid options"); System.exit(1); } return new SettingsCommandUser((Options) options); }
java
public static SettingsCommandUser build(String[] params) { GroupedOptions options = GroupedOptions.select(params, new Options(new Uncertainty()), new Options(new Duration()), new Options(new Count())); if (options == null) { printHelp(); System.out.println("Invalid USER options provided, see output for valid options"); System.exit(1); } return new SettingsCommandUser((Options) options); }
[ "public", "static", "SettingsCommandUser", "build", "(", "String", "[", "]", "params", ")", "{", "GroupedOptions", "options", "=", "GroupedOptions", ".", "select", "(", "params", ",", "new", "Options", "(", "new", "Uncertainty", "(", ")", ")", ",", "new", ...
CLI utility methods
[ "CLI", "utility", "methods" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java#L117-L130
36,131
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/contrib/ComparatorChain.java
ComparatorChain.addComparator
public void addComparator(Comparator<T> comparator, boolean reverse) { checkLocked(); comparatorChain.add(comparator); if (reverse == true) { orderingBits.set(comparatorChain.size() - 1); } }
java
public void addComparator(Comparator<T> comparator, boolean reverse) { checkLocked(); comparatorChain.add(comparator); if (reverse == true) { orderingBits.set(comparatorChain.size() - 1); } }
[ "public", "void", "addComparator", "(", "Comparator", "<", "T", ">", "comparator", ",", "boolean", "reverse", ")", "{", "checkLocked", "(", ")", ";", "comparatorChain", ".", "add", "(", "comparator", ")", ";", "if", "(", "reverse", "==", "true", ")", "{"...
Add a Comparator to the end of the chain using the given sortFields order @param comparator Comparator to add to the end of the chain @param reverse false = forward sortFields order; true = reverse sortFields order
[ "Add", "a", "Comparator", "to", "the", "end", "of", "the", "chain", "using", "the", "given", "sortFields", "order" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/ComparatorChain.java#L135-L142
36,132
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/contrib/ComparatorChain.java
ComparatorChain.setComparator
public void setComparator(int index, Comparator<T> comparator) throws IndexOutOfBoundsException { setComparator(index, comparator, false); }
java
public void setComparator(int index, Comparator<T> comparator) throws IndexOutOfBoundsException { setComparator(index, comparator, false); }
[ "public", "void", "setComparator", "(", "int", "index", ",", "Comparator", "<", "T", ">", "comparator", ")", "throws", "IndexOutOfBoundsException", "{", "setComparator", "(", "index", ",", "comparator", ",", "false", ")", ";", "}" ]
Replace the Comparator at the given index, maintaining the existing sortFields order. @param index index of the Comparator to replace @param comparator Comparator to place at the given index @throws IndexOutOfBoundsException if index &lt; 0 or index &gt;= size()
[ "Replace", "the", "Comparator", "at", "the", "given", "index", "maintaining", "the", "existing", "sortFields", "order", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/ComparatorChain.java#L151-L153
36,133
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/contrib/ComparatorChain.java
ComparatorChain.setComparator
public void setComparator(int index, Comparator<T> comparator, boolean reverse) { checkLocked(); comparatorChain.set(index, comparator); if (reverse == true) { orderingBits.set(index); } else { orderingBits.clear(index); } }
java
public void setComparator(int index, Comparator<T> comparator, boolean reverse) { checkLocked(); comparatorChain.set(index, comparator); if (reverse == true) { orderingBits.set(index); } else { orderingBits.clear(index); } }
[ "public", "void", "setComparator", "(", "int", "index", ",", "Comparator", "<", "T", ">", "comparator", ",", "boolean", "reverse", ")", "{", "checkLocked", "(", ")", ";", "comparatorChain", ".", "set", "(", "index", ",", "comparator", ")", ";", "if", "("...
Replace the Comparator at the given index in the ComparatorChain, using the given sortFields order @param index index of the Comparator to replace @param comparator Comparator to set @param reverse false = forward sortFields order; true = reverse sortFields order
[ "Replace", "the", "Comparator", "at", "the", "given", "index", "in", "the", "ComparatorChain", "using", "the", "given", "sortFields", "order" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/ComparatorChain.java#L162-L171
36,134
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/KSMetaData.java
KSMetaData.fromSchema
public static KSMetaData fromSchema(Row row, Iterable<CFMetaData> cfms, UTMetaData userTypes) { UntypedResultSet.Row result = QueryProcessor.resultify("SELECT * FROM system.schema_keyspaces", row).one(); try { return new KSMetaData(result.getString("keyspace_name"), AbstractReplicationStrategy.getClass(result.getString("strategy_class")), fromJsonMap(result.getString("strategy_options")), result.getBoolean("durable_writes"), cfms, userTypes); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
java
public static KSMetaData fromSchema(Row row, Iterable<CFMetaData> cfms, UTMetaData userTypes) { UntypedResultSet.Row result = QueryProcessor.resultify("SELECT * FROM system.schema_keyspaces", row).one(); try { return new KSMetaData(result.getString("keyspace_name"), AbstractReplicationStrategy.getClass(result.getString("strategy_class")), fromJsonMap(result.getString("strategy_options")), result.getBoolean("durable_writes"), cfms, userTypes); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
[ "public", "static", "KSMetaData", "fromSchema", "(", "Row", "row", ",", "Iterable", "<", "CFMetaData", ">", "cfms", ",", "UTMetaData", "userTypes", ")", "{", "UntypedResultSet", ".", "Row", "result", "=", "QueryProcessor", ".", "resultify", "(", "\"SELECT * FROM...
Deserialize only Keyspace attributes without nested ColumnFamilies @param row Keyspace attributes in serialized form @return deserialized keyspace without cf_defs
[ "Deserialize", "only", "Keyspace", "attributes", "without", "nested", "ColumnFamilies" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/KSMetaData.java#L274-L290
36,135
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/KSMetaData.java
KSMetaData.fromSchema
public static KSMetaData fromSchema(Row serializedKs, Row serializedCFs, Row serializedUserTypes) { Map<String, CFMetaData> cfs = deserializeColumnFamilies(serializedCFs); UTMetaData userTypes = new UTMetaData(UTMetaData.fromSchema(serializedUserTypes)); return fromSchema(serializedKs, cfs.values(), userTypes); }
java
public static KSMetaData fromSchema(Row serializedKs, Row serializedCFs, Row serializedUserTypes) { Map<String, CFMetaData> cfs = deserializeColumnFamilies(serializedCFs); UTMetaData userTypes = new UTMetaData(UTMetaData.fromSchema(serializedUserTypes)); return fromSchema(serializedKs, cfs.values(), userTypes); }
[ "public", "static", "KSMetaData", "fromSchema", "(", "Row", "serializedKs", ",", "Row", "serializedCFs", ",", "Row", "serializedUserTypes", ")", "{", "Map", "<", "String", ",", "CFMetaData", ">", "cfs", "=", "deserializeColumnFamilies", "(", "serializedCFs", ")", ...
Deserialize Keyspace with nested ColumnFamilies @param serializedKs Keyspace in serialized form @param serializedCFs Collection of the serialized ColumnFamilies @return deserialized keyspace with cf_defs
[ "Deserialize", "Keyspace", "with", "nested", "ColumnFamilies" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/KSMetaData.java#L300-L305
36,136
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/KSMetaData.java
KSMetaData.deserializeColumnFamilies
public static Map<String, CFMetaData> deserializeColumnFamilies(Row row) { if (row.cf == null) return Collections.emptyMap(); Map<String, CFMetaData> cfms = new HashMap<>(); UntypedResultSet results = QueryProcessor.resultify("SELECT * FROM system.schema_columnfamilies", row); for (UntypedResultSet.Row result : results) { CFMetaData cfm = CFMetaData.fromSchema(result); cfms.put(cfm.cfName, cfm); } return cfms; }
java
public static Map<String, CFMetaData> deserializeColumnFamilies(Row row) { if (row.cf == null) return Collections.emptyMap(); Map<String, CFMetaData> cfms = new HashMap<>(); UntypedResultSet results = QueryProcessor.resultify("SELECT * FROM system.schema_columnfamilies", row); for (UntypedResultSet.Row result : results) { CFMetaData cfm = CFMetaData.fromSchema(result); cfms.put(cfm.cfName, cfm); } return cfms; }
[ "public", "static", "Map", "<", "String", ",", "CFMetaData", ">", "deserializeColumnFamilies", "(", "Row", "row", ")", "{", "if", "(", "row", ".", "cf", "==", "null", ")", "return", "Collections", ".", "emptyMap", "(", ")", ";", "Map", "<", "String", "...
Deserialize ColumnFamilies from low-level schema representation, all of them belong to the same keyspace @return map containing name of the ColumnFamily and it's metadata for faster lookup
[ "Deserialize", "ColumnFamilies", "from", "low", "-", "level", "schema", "representation", "all", "of", "them", "belong", "to", "the", "same", "keyspace" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/KSMetaData.java#L312-L325
36,137
Stratio/stratio-cassandra
tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java
TimingInterval.merge
static TimingInterval merge(Iterable<TimingInterval> intervals, int maxSamples, long start) { ThreadLocalRandom rnd = ThreadLocalRandom.current(); long operationCount = 0, partitionCount = 0, rowCount = 0, errorCount = 0; long maxLatency = 0, totalLatency = 0; List<SampleOfLongs> latencies = new ArrayList<>(); long end = 0; long pauseStart = 0, pauseEnd = Long.MAX_VALUE; for (TimingInterval interval : intervals) { if (interval != null) { end = Math.max(end, interval.end); operationCount += interval.operationCount; maxLatency = Math.max(interval.maxLatency, maxLatency); totalLatency += interval.totalLatency; partitionCount += interval.partitionCount; rowCount += interval.rowCount; errorCount += interval.errorCount; latencies.addAll(Arrays.asList(interval.sample)); if (interval.pauseLength > 0) { pauseStart = Math.max(pauseStart, interval.pauseStart); pauseEnd = Math.min(pauseEnd, interval.pauseStart + interval.pauseLength); } } } if (pauseEnd < pauseStart || pauseStart <= 0) { pauseEnd = pauseStart = 0; } return new TimingInterval(start, end, maxLatency, pauseStart, pauseEnd - pauseStart, partitionCount, rowCount, totalLatency, operationCount, errorCount, SampleOfLongs.merge(rnd, latencies, maxSamples)); }
java
static TimingInterval merge(Iterable<TimingInterval> intervals, int maxSamples, long start) { ThreadLocalRandom rnd = ThreadLocalRandom.current(); long operationCount = 0, partitionCount = 0, rowCount = 0, errorCount = 0; long maxLatency = 0, totalLatency = 0; List<SampleOfLongs> latencies = new ArrayList<>(); long end = 0; long pauseStart = 0, pauseEnd = Long.MAX_VALUE; for (TimingInterval interval : intervals) { if (interval != null) { end = Math.max(end, interval.end); operationCount += interval.operationCount; maxLatency = Math.max(interval.maxLatency, maxLatency); totalLatency += interval.totalLatency; partitionCount += interval.partitionCount; rowCount += interval.rowCount; errorCount += interval.errorCount; latencies.addAll(Arrays.asList(interval.sample)); if (interval.pauseLength > 0) { pauseStart = Math.max(pauseStart, interval.pauseStart); pauseEnd = Math.min(pauseEnd, interval.pauseStart + interval.pauseLength); } } } if (pauseEnd < pauseStart || pauseStart <= 0) { pauseEnd = pauseStart = 0; } return new TimingInterval(start, end, maxLatency, pauseStart, pauseEnd - pauseStart, partitionCount, rowCount, totalLatency, operationCount, errorCount, SampleOfLongs.merge(rnd, latencies, maxSamples)); }
[ "static", "TimingInterval", "merge", "(", "Iterable", "<", "TimingInterval", ">", "intervals", ",", "int", "maxSamples", ",", "long", "start", ")", "{", "ThreadLocalRandom", "rnd", "=", "ThreadLocalRandom", ".", "current", "(", ")", ";", "long", "operationCount"...
merge multiple timer intervals together
[ "merge", "multiple", "timer", "intervals", "together" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/tools/stress/src/org/apache/cassandra/stress/util/TimingInterval.java#L79-L115
36,138
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/RangeTombstone.java
RangeTombstone.supersedes
public boolean supersedes(RangeTombstone rt, Comparator<Composite> comparator) { if (rt.data.markedForDeleteAt > data.markedForDeleteAt) return false; return comparator.compare(min, rt.min) <= 0 && comparator.compare(max, rt.max) >= 0; }
java
public boolean supersedes(RangeTombstone rt, Comparator<Composite> comparator) { if (rt.data.markedForDeleteAt > data.markedForDeleteAt) return false; return comparator.compare(min, rt.min) <= 0 && comparator.compare(max, rt.max) >= 0; }
[ "public", "boolean", "supersedes", "(", "RangeTombstone", "rt", ",", "Comparator", "<", "Composite", ">", "comparator", ")", "{", "if", "(", "rt", ".", "data", ".", "markedForDeleteAt", ">", "data", ".", "markedForDeleteAt", ")", "return", "false", ";", "ret...
This tombstone supersedes another one if it is more recent and cover a bigger range than rt.
[ "This", "tombstone", "supersedes", "another", "one", "if", "it", "is", "more", "recent", "and", "cover", "a", "bigger", "range", "than", "rt", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/RangeTombstone.java#L89-L95
36,139
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/ByteBufferUtil.java
ByteBufferUtil.string
public static String string(ByteBuffer buffer, int position, int length) throws CharacterCodingException { return string(buffer, position, length, StandardCharsets.UTF_8); }
java
public static String string(ByteBuffer buffer, int position, int length) throws CharacterCodingException { return string(buffer, position, length, StandardCharsets.UTF_8); }
[ "public", "static", "String", "string", "(", "ByteBuffer", "buffer", ",", "int", "position", ",", "int", "length", ")", "throws", "CharacterCodingException", "{", "return", "string", "(", "buffer", ",", "position", ",", "length", ",", "StandardCharsets", ".", ...
Decode a String representation. This method assumes that the encoding charset is UTF_8. @param buffer a byte buffer holding the string representation @param position the starting position in {@code buffer} to start decoding from @param length the number of bytes from {@code buffer} to use @return the decoded string
[ "Decode", "a", "String", "representation", ".", "This", "method", "assumes", "that", "the", "encoding", "charset", "is", "UTF_8", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/ByteBufferUtil.java#L121-L124
36,140
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/ByteBufferUtil.java
ByteBufferUtil.compareSubArrays
public static int compareSubArrays(ByteBuffer bytes1, int offset1, ByteBuffer bytes2, int offset2, int length) { if (bytes1 == null) return bytes2 == null ? 0 : -1; if (bytes2 == null) return 1; assert bytes1.limit() >= offset1 + length : "The first byte array isn't long enough for the specified offset and length."; assert bytes2.limit() >= offset2 + length : "The second byte array isn't long enough for the specified offset and length."; for (int i = 0; i < length; i++) { byte byte1 = bytes1.get(offset1 + i); byte byte2 = bytes2.get(offset2 + i); if (byte1 == byte2) continue; // compare non-equal bytes as unsigned return (byte1 & 0xFF) < (byte2 & 0xFF) ? -1 : 1; } return 0; }
java
public static int compareSubArrays(ByteBuffer bytes1, int offset1, ByteBuffer bytes2, int offset2, int length) { if (bytes1 == null) return bytes2 == null ? 0 : -1; if (bytes2 == null) return 1; assert bytes1.limit() >= offset1 + length : "The first byte array isn't long enough for the specified offset and length."; assert bytes2.limit() >= offset2 + length : "The second byte array isn't long enough for the specified offset and length."; for (int i = 0; i < length; i++) { byte byte1 = bytes1.get(offset1 + i); byte byte2 = bytes2.get(offset2 + i); if (byte1 == byte2) continue; // compare non-equal bytes as unsigned return (byte1 & 0xFF) < (byte2 & 0xFF) ? -1 : 1; } return 0; }
[ "public", "static", "int", "compareSubArrays", "(", "ByteBuffer", "bytes1", ",", "int", "offset1", ",", "ByteBuffer", "bytes2", ",", "int", "offset2", ",", "int", "length", ")", "{", "if", "(", "bytes1", "==", "null", ")", "return", "bytes2", "==", "null",...
Compare two ByteBuffer at specified offsets for length. Compares the non equal bytes as unsigned. @param bytes1 First byte buffer to compare. @param offset1 Position to start the comparison at in the first array. @param bytes2 Second byte buffer to compare. @param offset2 Position to start the comparison at in the second array. @param length How many bytes to compare? @return -1 if byte1 is less than byte2, 1 if byte2 is less than byte1 or 0 if equal.
[ "Compare", "two", "ByteBuffer", "at", "specified", "offsets", "for", "length", ".", "Compares", "the", "non", "equal", "bytes", "as", "unsigned", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/ByteBufferUtil.java#L472-L490
36,141
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/ByteBufferUtil.java
ByteBufferUtil.minimalBufferFor
public static ByteBuffer minimalBufferFor(ByteBuffer buf) { return buf.capacity() > buf.remaining() || !buf.hasArray() ? ByteBuffer.wrap(getArray(buf)) : buf; }
java
public static ByteBuffer minimalBufferFor(ByteBuffer buf) { return buf.capacity() > buf.remaining() || !buf.hasArray() ? ByteBuffer.wrap(getArray(buf)) : buf; }
[ "public", "static", "ByteBuffer", "minimalBufferFor", "(", "ByteBuffer", "buf", ")", "{", "return", "buf", ".", "capacity", "(", ")", ">", "buf", ".", "remaining", "(", ")", "||", "!", "buf", ".", "hasArray", "(", ")", "?", "ByteBuffer", ".", "wrap", "...
trims size of bytebuffer to exactly number of bytes in it, to do not hold too much memory
[ "trims", "size", "of", "bytebuffer", "to", "exactly", "number", "of", "bytes", "in", "it", "to", "do", "not", "hold", "too", "much", "memory" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/ByteBufferUtil.java#L513-L516
36,142
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/ByteBufferUtil.java
ByteBufferUtil.getShortLength
public static int getShortLength(ByteBuffer bb, int position) { int length = (bb.get(position) & 0xFF) << 8; return length | (bb.get(position + 1) & 0xFF); }
java
public static int getShortLength(ByteBuffer bb, int position) { int length = (bb.get(position) & 0xFF) << 8; return length | (bb.get(position + 1) & 0xFF); }
[ "public", "static", "int", "getShortLength", "(", "ByteBuffer", "bb", ",", "int", "position", ")", "{", "int", "length", "=", "(", "bb", ".", "get", "(", "position", ")", "&", "0xFF", ")", "<<", "8", ";", "return", "length", "|", "(", "bb", ".", "g...
Doesn't change bb position
[ "Doesn", "t", "change", "bb", "position" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/ByteBufferUtil.java#L519-L523
36,143
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/LocalStrategy.java
LocalStrategy.getNaturalEndpoints
@Override public ArrayList<InetAddress> getNaturalEndpoints(RingPosition searchPosition) { ArrayList<InetAddress> l = new ArrayList<InetAddress>(1); l.add(FBUtilities.getBroadcastAddress()); return l; }
java
@Override public ArrayList<InetAddress> getNaturalEndpoints(RingPosition searchPosition) { ArrayList<InetAddress> l = new ArrayList<InetAddress>(1); l.add(FBUtilities.getBroadcastAddress()); return l; }
[ "@", "Override", "public", "ArrayList", "<", "InetAddress", ">", "getNaturalEndpoints", "(", "RingPosition", "searchPosition", ")", "{", "ArrayList", "<", "InetAddress", ">", "l", "=", "new", "ArrayList", "<", "InetAddress", ">", "(", "1", ")", ";", "l", "."...
We need to override this even if we override calculateNaturalEndpoints, because the default implementation depends on token calculations but LocalStrategy may be used before tokens are set up.
[ "We", "need", "to", "override", "this", "even", "if", "we", "override", "calculateNaturalEndpoints", "because", "the", "default", "implementation", "depends", "on", "token", "calculations", "but", "LocalStrategy", "may", "be", "used", "before", "tokens", "are", "s...
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/LocalStrategy.java#L44-L50
36,144
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.removeTruncationRecord
public static synchronized void removeTruncationRecord(UUID cfId) { String req = "DELETE truncated_at[?] from system.%s WHERE key = '%s'"; executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), cfId); truncationRecords = null; forceBlockingFlush(LOCAL_CF); }
java
public static synchronized void removeTruncationRecord(UUID cfId) { String req = "DELETE truncated_at[?] from system.%s WHERE key = '%s'"; executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), cfId); truncationRecords = null; forceBlockingFlush(LOCAL_CF); }
[ "public", "static", "synchronized", "void", "removeTruncationRecord", "(", "UUID", "cfId", ")", "{", "String", "req", "=", "\"DELETE truncated_at[?] from system.%s WHERE key = '%s'\"", ";", "executeInternal", "(", "String", ".", "format", "(", "req", ",", "LOCAL_CF", ...
This method is used to remove information about truncation time for specified column family
[ "This", "method", "is", "used", "to", "remove", "information", "about", "truncation", "time", "for", "specified", "column", "family" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L303-L309
36,145
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.updateTokens
public static synchronized void updateTokens(InetAddress ep, Collection<Token> tokens) { if (ep.equals(FBUtilities.getBroadcastAddress())) { removeEndpoint(ep); return; } String req = "INSERT INTO system.%s (peer, tokens) VALUES (?, ?)"; executeInternal(String.format(req, PEERS_CF), ep, tokensAsSet(tokens)); }
java
public static synchronized void updateTokens(InetAddress ep, Collection<Token> tokens) { if (ep.equals(FBUtilities.getBroadcastAddress())) { removeEndpoint(ep); return; } String req = "INSERT INTO system.%s (peer, tokens) VALUES (?, ?)"; executeInternal(String.format(req, PEERS_CF), ep, tokensAsSet(tokens)); }
[ "public", "static", "synchronized", "void", "updateTokens", "(", "InetAddress", "ep", ",", "Collection", "<", "Token", ">", "tokens", ")", "{", "if", "(", "ep", ".", "equals", "(", "FBUtilities", ".", "getBroadcastAddress", "(", ")", ")", ")", "{", "remove...
Record tokens being used by another node
[ "Record", "tokens", "being", "used", "by", "another", "node" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L377-L387
36,146
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.removeEndpoint
public static synchronized void removeEndpoint(InetAddress ep) { String req = "DELETE FROM system.%s WHERE peer = ?"; executeInternal(String.format(req, PEERS_CF), ep); }
java
public static synchronized void removeEndpoint(InetAddress ep) { String req = "DELETE FROM system.%s WHERE peer = ?"; executeInternal(String.format(req, PEERS_CF), ep); }
[ "public", "static", "synchronized", "void", "removeEndpoint", "(", "InetAddress", "ep", ")", "{", "String", "req", "=", "\"DELETE FROM system.%s WHERE peer = ?\"", ";", "executeInternal", "(", "String", ".", "format", "(", "req", ",", "PEERS_CF", ")", ",", "ep", ...
Remove stored tokens being used by another node
[ "Remove", "stored", "tokens", "being", "used", "by", "another", "node" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L439-L443
36,147
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.updateTokens
public static synchronized void updateTokens(Collection<Token> tokens) { assert !tokens.isEmpty() : "removeEndpoint should be used instead"; String req = "INSERT INTO system.%s (key, tokens) VALUES ('%s', ?)"; executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), tokensAsSet(tokens)); forceBlockingFlush(LOCAL_CF); }
java
public static synchronized void updateTokens(Collection<Token> tokens) { assert !tokens.isEmpty() : "removeEndpoint should be used instead"; String req = "INSERT INTO system.%s (key, tokens) VALUES ('%s', ?)"; executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), tokensAsSet(tokens)); forceBlockingFlush(LOCAL_CF); }
[ "public", "static", "synchronized", "void", "updateTokens", "(", "Collection", "<", "Token", ">", "tokens", ")", "{", "assert", "!", "tokens", ".", "isEmpty", "(", ")", ":", "\"removeEndpoint should be used instead\"", ";", "String", "req", "=", "\"INSERT INTO sys...
This method is used to update the System Keyspace with the new tokens for this node
[ "This", "method", "is", "used", "to", "update", "the", "System", "Keyspace", "with", "the", "new", "tokens", "for", "this", "node" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L448-L454
36,148
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.updateLocalTokens
public static synchronized Collection<Token> updateLocalTokens(Collection<Token> addTokens, Collection<Token> rmTokens) { Collection<Token> tokens = getSavedTokens(); tokens.removeAll(rmTokens); tokens.addAll(addTokens); updateTokens(tokens); return tokens; }
java
public static synchronized Collection<Token> updateLocalTokens(Collection<Token> addTokens, Collection<Token> rmTokens) { Collection<Token> tokens = getSavedTokens(); tokens.removeAll(rmTokens); tokens.addAll(addTokens); updateTokens(tokens); return tokens; }
[ "public", "static", "synchronized", "Collection", "<", "Token", ">", "updateLocalTokens", "(", "Collection", "<", "Token", ">", "addTokens", ",", "Collection", "<", "Token", ">", "rmTokens", ")", "{", "Collection", "<", "Token", ">", "tokens", "=", "getSavedTo...
Convenience method to update the list of tokens in the local system keyspace. @param addTokens tokens to add @param rmTokens tokens to remove @return the collection of persisted tokens
[ "Convenience", "method", "to", "update", "the", "list", "of", "tokens", "in", "the", "local", "system", "keyspace", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L463-L470
36,149
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.loadTokens
public static SetMultimap<InetAddress, Token> loadTokens() { SetMultimap<InetAddress, Token> tokenMap = HashMultimap.create(); for (UntypedResultSet.Row row : executeInternal("SELECT peer, tokens FROM system." + PEERS_CF)) { InetAddress peer = row.getInetAddress("peer"); if (row.has("tokens")) tokenMap.putAll(peer, deserializeTokens(row.getSet("tokens", UTF8Type.instance))); } return tokenMap; }
java
public static SetMultimap<InetAddress, Token> loadTokens() { SetMultimap<InetAddress, Token> tokenMap = HashMultimap.create(); for (UntypedResultSet.Row row : executeInternal("SELECT peer, tokens FROM system." + PEERS_CF)) { InetAddress peer = row.getInetAddress("peer"); if (row.has("tokens")) tokenMap.putAll(peer, deserializeTokens(row.getSet("tokens", UTF8Type.instance))); } return tokenMap; }
[ "public", "static", "SetMultimap", "<", "InetAddress", ",", "Token", ">", "loadTokens", "(", ")", "{", "SetMultimap", "<", "InetAddress", ",", "Token", ">", "tokenMap", "=", "HashMultimap", ".", "create", "(", ")", ";", "for", "(", "UntypedResultSet", ".", ...
Return a map of stored tokens to IP addresses
[ "Return", "a", "map", "of", "stored", "tokens", "to", "IP", "addresses" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L482-L493
36,150
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.loadHostIds
public static Map<InetAddress, UUID> loadHostIds() { Map<InetAddress, UUID> hostIdMap = new HashMap<InetAddress, UUID>(); for (UntypedResultSet.Row row : executeInternal("SELECT peer, host_id FROM system." + PEERS_CF)) { InetAddress peer = row.getInetAddress("peer"); if (row.has("host_id")) { hostIdMap.put(peer, row.getUUID("host_id")); } } return hostIdMap; }
java
public static Map<InetAddress, UUID> loadHostIds() { Map<InetAddress, UUID> hostIdMap = new HashMap<InetAddress, UUID>(); for (UntypedResultSet.Row row : executeInternal("SELECT peer, host_id FROM system." + PEERS_CF)) { InetAddress peer = row.getInetAddress("peer"); if (row.has("host_id")) { hostIdMap.put(peer, row.getUUID("host_id")); } } return hostIdMap; }
[ "public", "static", "Map", "<", "InetAddress", ",", "UUID", ">", "loadHostIds", "(", ")", "{", "Map", "<", "InetAddress", ",", "UUID", ">", "hostIdMap", "=", "new", "HashMap", "<", "InetAddress", ",", "UUID", ">", "(", ")", ";", "for", "(", "UntypedRes...
Return a map of store host_ids to IP addresses
[ "Return", "a", "map", "of", "store", "host_ids", "to", "IP", "addresses" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L499-L511
36,151
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.getPreferredIP
public static InetAddress getPreferredIP(InetAddress ep) { String req = "SELECT preferred_ip FROM system.%s WHERE peer=?"; UntypedResultSet result = executeInternal(String.format(req, PEERS_CF), ep); if (!result.isEmpty() && result.one().has("preferred_ip")) return result.one().getInetAddress("preferred_ip"); return ep; }
java
public static InetAddress getPreferredIP(InetAddress ep) { String req = "SELECT preferred_ip FROM system.%s WHERE peer=?"; UntypedResultSet result = executeInternal(String.format(req, PEERS_CF), ep); if (!result.isEmpty() && result.one().has("preferred_ip")) return result.one().getInetAddress("preferred_ip"); return ep; }
[ "public", "static", "InetAddress", "getPreferredIP", "(", "InetAddress", "ep", ")", "{", "String", "req", "=", "\"SELECT preferred_ip FROM system.%s WHERE peer=?\"", ";", "UntypedResultSet", "result", "=", "executeInternal", "(", "String", ".", "format", "(", "req", "...
Get preferred IP for given endpoint if it is known. Otherwise this returns given endpoint itself. @param ep endpoint address to check @return Preferred IP for given endpoint if present, otherwise returns given ep
[ "Get", "preferred", "IP", "for", "given", "endpoint", "if", "it", "is", "known", ".", "Otherwise", "this", "returns", "given", "endpoint", "itself", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L519-L526
36,152
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.loadDcRackInfo
public static Map<InetAddress, Map<String,String>> loadDcRackInfo() { Map<InetAddress, Map<String, String>> result = new HashMap<InetAddress, Map<String, String>>(); for (UntypedResultSet.Row row : executeInternal("SELECT peer, data_center, rack from system." + PEERS_CF)) { InetAddress peer = row.getInetAddress("peer"); if (row.has("data_center") && row.has("rack")) { Map<String, String> dcRack = new HashMap<String, String>(); dcRack.put("data_center", row.getString("data_center")); dcRack.put("rack", row.getString("rack")); result.put(peer, dcRack); } } return result; }
java
public static Map<InetAddress, Map<String,String>> loadDcRackInfo() { Map<InetAddress, Map<String, String>> result = new HashMap<InetAddress, Map<String, String>>(); for (UntypedResultSet.Row row : executeInternal("SELECT peer, data_center, rack from system." + PEERS_CF)) { InetAddress peer = row.getInetAddress("peer"); if (row.has("data_center") && row.has("rack")) { Map<String, String> dcRack = new HashMap<String, String>(); dcRack.put("data_center", row.getString("data_center")); dcRack.put("rack", row.getString("rack")); result.put(peer, dcRack); } } return result; }
[ "public", "static", "Map", "<", "InetAddress", ",", "Map", "<", "String", ",", "String", ">", ">", "loadDcRackInfo", "(", ")", "{", "Map", "<", "InetAddress", ",", "Map", "<", "String", ",", "String", ">", ">", "result", "=", "new", "HashMap", "<", "...
Return a map of IP addresses containing a map of dc and rack info
[ "Return", "a", "map", "of", "IP", "addresses", "containing", "a", "map", "of", "dc", "and", "rack", "info" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L531-L546
36,153
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.setLocalHostId
public static UUID setLocalHostId(UUID hostId) { String req = "INSERT INTO system.%s (key, host_id) VALUES ('%s', ?)"; executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), hostId); return hostId; }
java
public static UUID setLocalHostId(UUID hostId) { String req = "INSERT INTO system.%s (key, host_id) VALUES ('%s', ?)"; executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), hostId); return hostId; }
[ "public", "static", "UUID", "setLocalHostId", "(", "UUID", "hostId", ")", "{", "String", "req", "=", "\"INSERT INTO system.%s (key, host_id) VALUES ('%s', ?)\"", ";", "executeInternal", "(", "String", ".", "format", "(", "req", ",", "LOCAL_CF", ",", "LOCAL_KEY", ")"...
Sets the local host ID explicitly. Should only be called outside of SystemTable when replacing a node.
[ "Sets", "the", "local", "host", "ID", "explicitly", ".", "Should", "only", "be", "called", "outside", "of", "SystemTable", "when", "replacing", "a", "node", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L712-L717
36,154
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.clearSSTableReadMeter
public static void clearSSTableReadMeter(String keyspace, String table, int generation) { String cql = "DELETE FROM system.%s WHERE keyspace_name=? AND columnfamily_name=? and generation=?"; executeInternal(String.format(cql, SSTABLE_ACTIVITY_CF), keyspace, table, generation); }
java
public static void clearSSTableReadMeter(String keyspace, String table, int generation) { String cql = "DELETE FROM system.%s WHERE keyspace_name=? AND columnfamily_name=? and generation=?"; executeInternal(String.format(cql, SSTABLE_ACTIVITY_CF), keyspace, table, generation); }
[ "public", "static", "void", "clearSSTableReadMeter", "(", "String", "keyspace", ",", "String", "table", ",", "int", "generation", ")", "{", "String", "cql", "=", "\"DELETE FROM system.%s WHERE keyspace_name=? AND columnfamily_name=? and generation=?\"", ";", "executeInternal"...
Clears persisted read rates from system.sstable_activity for SSTables that have been deleted.
[ "Clears", "persisted", "read", "rates", "from", "system", ".", "sstable_activity", "for", "SSTables", "that", "have", "been", "deleted", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L941-L945
36,155
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.updateSizeEstimates
public static void updateSizeEstimates(String keyspace, String table, Map<Range<Token>, Pair<Long, Long>> estimates) { long timestamp = FBUtilities.timestampMicros(); CFMetaData estimatesTable = CFMetaData.SizeEstimatesCf; Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, UTF8Type.instance.decompose(keyspace)); // delete all previous values with a single range tombstone. mutation.deleteRange(SIZE_ESTIMATES_CF, estimatesTable.comparator.make(table).start(), estimatesTable.comparator.make(table).end(), timestamp - 1); // add a CQL row for each primary token range. ColumnFamily cells = mutation.addOrGet(estimatesTable); for (Map.Entry<Range<Token>, Pair<Long, Long>> entry : estimates.entrySet()) { Range<Token> range = entry.getKey(); Pair<Long, Long> values = entry.getValue(); Composite prefix = estimatesTable.comparator.make(table, range.left.toString(), range.right.toString()); CFRowAdder adder = new CFRowAdder(cells, prefix, timestamp); adder.add("partitions_count", values.left) .add("mean_partition_size", values.right); } mutation.apply(); }
java
public static void updateSizeEstimates(String keyspace, String table, Map<Range<Token>, Pair<Long, Long>> estimates) { long timestamp = FBUtilities.timestampMicros(); CFMetaData estimatesTable = CFMetaData.SizeEstimatesCf; Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, UTF8Type.instance.decompose(keyspace)); // delete all previous values with a single range tombstone. mutation.deleteRange(SIZE_ESTIMATES_CF, estimatesTable.comparator.make(table).start(), estimatesTable.comparator.make(table).end(), timestamp - 1); // add a CQL row for each primary token range. ColumnFamily cells = mutation.addOrGet(estimatesTable); for (Map.Entry<Range<Token>, Pair<Long, Long>> entry : estimates.entrySet()) { Range<Token> range = entry.getKey(); Pair<Long, Long> values = entry.getValue(); Composite prefix = estimatesTable.comparator.make(table, range.left.toString(), range.right.toString()); CFRowAdder adder = new CFRowAdder(cells, prefix, timestamp); adder.add("partitions_count", values.left) .add("mean_partition_size", values.right); } mutation.apply(); }
[ "public", "static", "void", "updateSizeEstimates", "(", "String", "keyspace", ",", "String", "table", ",", "Map", "<", "Range", "<", "Token", ">", ",", "Pair", "<", "Long", ",", "Long", ">", ">", "estimates", ")", "{", "long", "timestamp", "=", "FBUtilit...
Writes the current partition count and size estimates into SIZE_ESTIMATES_CF
[ "Writes", "the", "current", "partition", "count", "and", "size", "estimates", "into", "SIZE_ESTIMATES_CF" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L950-L975
36,156
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/MessagingService.java
MessagingService.maybeAddLatency
public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency) { if (cb.isLatencyForSnitch()) addLatency(address, latency); }
java
public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency) { if (cb.isLatencyForSnitch()) addLatency(address, latency); }
[ "public", "void", "maybeAddLatency", "(", "IAsyncCallback", "cb", ",", "InetAddress", "address", ",", "long", "latency", ")", "{", "if", "(", "cb", ".", "isLatencyForSnitch", "(", ")", ")", "addLatency", "(", "address", ",", "latency", ")", ";", "}" ]
Track latency information for the dynamic snitch @param cb the callback associated with this message -- this lets us know if it's a message type we're interested in @param address the host that replied to the message @param latency
[ "Track", "latency", "information", "for", "the", "dynamic", "snitch" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/MessagingService.java#L385-L389
36,157
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/MessagingService.java
MessagingService.listen
public void listen(InetAddress localEp) throws ConfigurationException { callbacks.reset(); // hack to allow tests to stop/restart MS for (ServerSocket ss : getServerSockets(localEp)) { SocketThread th = new SocketThread(ss, "ACCEPT-" + localEp); th.start(); socketThreads.add(th); } listenGate.signalAll(); }
java
public void listen(InetAddress localEp) throws ConfigurationException { callbacks.reset(); // hack to allow tests to stop/restart MS for (ServerSocket ss : getServerSockets(localEp)) { SocketThread th = new SocketThread(ss, "ACCEPT-" + localEp); th.start(); socketThreads.add(th); } listenGate.signalAll(); }
[ "public", "void", "listen", "(", "InetAddress", "localEp", ")", "throws", "ConfigurationException", "{", "callbacks", ".", "reset", "(", ")", ";", "// hack to allow tests to stop/restart MS", "for", "(", "ServerSocket", "ss", ":", "getServerSockets", "(", "localEp", ...
Listen on the specified port. @param localEp InetAddress whose port to listen on.
[ "Listen", "on", "the", "specified", "port", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/MessagingService.java#L411-L421
36,158
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/MessagingService.java
MessagingService.registerVerbHandlers
public void registerVerbHandlers(Verb verb, IVerbHandler verbHandler) { assert !verbHandlers.containsKey(verb); verbHandlers.put(verb, verbHandler); }
java
public void registerVerbHandlers(Verb verb, IVerbHandler verbHandler) { assert !verbHandlers.containsKey(verb); verbHandlers.put(verb, verbHandler); }
[ "public", "void", "registerVerbHandlers", "(", "Verb", "verb", ",", "IVerbHandler", "verbHandler", ")", "{", "assert", "!", "verbHandlers", ".", "containsKey", "(", "verb", ")", ";", "verbHandlers", ".", "put", "(", "verb", ",", "verbHandler", ")", ";", "}" ...
Register a verb and the corresponding verb handler with the Messaging Service. @param verb @param verbHandler handler for the specified verb
[ "Register", "a", "verb", "and", "the", "corresponding", "verb", "handler", "with", "the", "Messaging", "Service", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/MessagingService.java#L540-L544
36,159
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/MessagingService.java
MessagingService.sendRR
public int sendRR(MessageOut message, InetAddress to, IAsyncCallback cb, long timeout, boolean failureCallback) { int id = addCallback(cb, message, to, timeout, failureCallback); sendOneWay(failureCallback ? message.withParameter(FAILURE_CALLBACK_PARAM, ONE_BYTE) : message, id, to); return id; }
java
public int sendRR(MessageOut message, InetAddress to, IAsyncCallback cb, long timeout, boolean failureCallback) { int id = addCallback(cb, message, to, timeout, failureCallback); sendOneWay(failureCallback ? message.withParameter(FAILURE_CALLBACK_PARAM, ONE_BYTE) : message, id, to); return id; }
[ "public", "int", "sendRR", "(", "MessageOut", "message", ",", "InetAddress", "to", ",", "IAsyncCallback", "cb", ",", "long", "timeout", ",", "boolean", "failureCallback", ")", "{", "int", "id", "=", "addCallback", "(", "cb", ",", "message", ",", "to", ",",...
Send a non-mutation message to a given endpoint. This method specifies a callback which is invoked with the actual response. @param message message to be sent. @param to endpoint to which the message needs to be sent @param cb callback interface which is used to pass the responses or suggest that a timeout occurred to the invoker of the send(). @param timeout the timeout used for expiration @return an reference to message id used to match with the result
[ "Send", "a", "non", "-", "mutation", "message", "to", "a", "given", "endpoint", ".", "This", "method", "specifies", "a", "callback", "which", "is", "invoked", "with", "the", "actual", "response", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/MessagingService.java#L617-L622
36,160
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/MessagingService.java
MessagingService.sendOneWay
public void sendOneWay(MessageOut message, int id, InetAddress to) { if (logger.isTraceEnabled()) logger.trace(FBUtilities.getBroadcastAddress() + " sending " + message.verb + " to " + id + "@" + to); if (to.equals(FBUtilities.getBroadcastAddress())) logger.trace("Message-to-self {} going over MessagingService", message); // message sinks are a testing hook MessageOut processedMessage = SinkManager.processOutboundMessage(message, id, to); if (processedMessage == null) { return; } // get pooled connection (really, connection queue) OutboundTcpConnection connection = getConnection(to, processedMessage); // write it connection.enqueue(processedMessage, id); }
java
public void sendOneWay(MessageOut message, int id, InetAddress to) { if (logger.isTraceEnabled()) logger.trace(FBUtilities.getBroadcastAddress() + " sending " + message.verb + " to " + id + "@" + to); if (to.equals(FBUtilities.getBroadcastAddress())) logger.trace("Message-to-self {} going over MessagingService", message); // message sinks are a testing hook MessageOut processedMessage = SinkManager.processOutboundMessage(message, id, to); if (processedMessage == null) { return; } // get pooled connection (really, connection queue) OutboundTcpConnection connection = getConnection(to, processedMessage); // write it connection.enqueue(processedMessage, id); }
[ "public", "void", "sendOneWay", "(", "MessageOut", "message", ",", "int", "id", ",", "InetAddress", "to", ")", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "logger", ".", "trace", "(", "FBUtilities", ".", "getBroadcastAddress", "(", ")",...
Send a message to a given endpoint. This method adheres to the fire and forget style messaging. @param message messages to be sent. @param to endpoint to which the message needs to be sent
[ "Send", "a", "message", "to", "a", "given", "endpoint", ".", "This", "method", "adheres", "to", "the", "fire", "and", "forget", "style", "messaging", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/MessagingService.java#L663-L683
36,161
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.min
private static ByteBuffer min(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b2; return b1; }
java
private static ByteBuffer min(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b2; return b1; }
[ "private", "static", "ByteBuffer", "min", "(", "ByteBuffer", "b1", ",", "ByteBuffer", "b2", ",", "AbstractType", "<", "?", ">", "comparator", ")", "{", "if", "(", "b1", "==", "null", ")", "return", "b2", ";", "if", "(", "b2", "==", "null", ")", "retu...
return the min column note that comparator should not be of CompositeType! @param b1 lhs @param b2 rhs @param comparator the comparator to use @return the smallest column according to comparator
[ "return", "the", "min", "column" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L119-L129
36,162
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.max
private static ByteBuffer max(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b1; return b2; }
java
private static ByteBuffer max(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b1; return b2; }
[ "private", "static", "ByteBuffer", "max", "(", "ByteBuffer", "b1", ",", "ByteBuffer", "b2", ",", "AbstractType", "<", "?", ">", "comparator", ")", "{", "if", "(", "b1", "==", "null", ")", "return", "b2", ";", "if", "(", "b2", "==", "null", ")", "retu...
return the max column note that comparator should not be of CompositeType! @param b1 lhs @param b2 rhs @param comparator the comparator to use @return the biggest column according to comparator
[ "return", "the", "max", "column" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L141-L151
36,163
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.mergeMin
public static List<ByteBuffer> mergeMin(List<ByteBuffer> minColumnNames, List<ByteBuffer> candidates, CellNameType comparator) { if (minColumnNames.isEmpty()) return minimalBuffersFor(candidates); if (candidates.isEmpty()) return minColumnNames; List<ByteBuffer> biggest = minColumnNames.size() > candidates.size() ? minColumnNames : candidates; List<ByteBuffer> smallest = minColumnNames.size() > candidates.size() ? candidates : minColumnNames; // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller List<ByteBuffer> retList = smallest.size() == biggest.size() ? new ArrayList<>(smallest) : maybeGrow(smallest, biggest.size()); for (int i = 0; i < biggest.size(); i++) retList.set(i, minimalBufferFor(min(retList.get(i), biggest.get(i), comparator.subtype(i)))); return retList; }
java
public static List<ByteBuffer> mergeMin(List<ByteBuffer> minColumnNames, List<ByteBuffer> candidates, CellNameType comparator) { if (minColumnNames.isEmpty()) return minimalBuffersFor(candidates); if (candidates.isEmpty()) return minColumnNames; List<ByteBuffer> biggest = minColumnNames.size() > candidates.size() ? minColumnNames : candidates; List<ByteBuffer> smallest = minColumnNames.size() > candidates.size() ? candidates : minColumnNames; // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller List<ByteBuffer> retList = smallest.size() == biggest.size() ? new ArrayList<>(smallest) : maybeGrow(smallest, biggest.size()); for (int i = 0; i < biggest.size(); i++) retList.set(i, minimalBufferFor(min(retList.get(i), biggest.get(i), comparator.subtype(i)))); return retList; }
[ "public", "static", "List", "<", "ByteBuffer", ">", "mergeMin", "(", "List", "<", "ByteBuffer", ">", "minColumnNames", ",", "List", "<", "ByteBuffer", ">", "candidates", ",", "CellNameType", "comparator", ")", "{", "if", "(", "minColumnNames", ".", "isEmpty", ...
Merge 2 lists of min cell name components. @param minColumnNames lhs @param candidates rhs @param comparator comparator to use @return a list with smallest column names according to (sub)comparator
[ "Merge", "2", "lists", "of", "min", "cell", "name", "components", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L161-L181
36,164
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.mergeMax
public static List<ByteBuffer> mergeMax(List<ByteBuffer> maxColumnNames, List<ByteBuffer> candidates, CellNameType comparator) { if (maxColumnNames.isEmpty()) return minimalBuffersFor(candidates); if (candidates.isEmpty()) return maxColumnNames; List<ByteBuffer> biggest = maxColumnNames.size() > candidates.size() ? maxColumnNames : candidates; List<ByteBuffer> smallest = maxColumnNames.size() > candidates.size() ? candidates : maxColumnNames; // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller List<ByteBuffer> retList = smallest.size() == biggest.size() ? new ArrayList<>(smallest) : maybeGrow(smallest, biggest.size()); for (int i = 0; i < biggest.size(); i++) retList.set(i, minimalBufferFor(max(retList.get(i), biggest.get(i), comparator.subtype(i)))); return retList; }
java
public static List<ByteBuffer> mergeMax(List<ByteBuffer> maxColumnNames, List<ByteBuffer> candidates, CellNameType comparator) { if (maxColumnNames.isEmpty()) return minimalBuffersFor(candidates); if (candidates.isEmpty()) return maxColumnNames; List<ByteBuffer> biggest = maxColumnNames.size() > candidates.size() ? maxColumnNames : candidates; List<ByteBuffer> smallest = maxColumnNames.size() > candidates.size() ? candidates : maxColumnNames; // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller List<ByteBuffer> retList = smallest.size() == biggest.size() ? new ArrayList<>(smallest) : maybeGrow(smallest, biggest.size()); for (int i = 0; i < biggest.size(); i++) retList.set(i, minimalBufferFor(max(retList.get(i), biggest.get(i), comparator.subtype(i)))); return retList; }
[ "public", "static", "List", "<", "ByteBuffer", ">", "mergeMax", "(", "List", "<", "ByteBuffer", ">", "maxColumnNames", ",", "List", "<", "ByteBuffer", ">", "candidates", ",", "CellNameType", "comparator", ")", "{", "if", "(", "maxColumnNames", ".", "isEmpty", ...
Merge 2 lists of max cell name components. @param maxColumnNames lhs @param candidates rhs @param comparator comparator to use @return a list with biggest column names according to (sub)comparator
[ "Merge", "2", "lists", "of", "max", "cell", "name", "components", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L199-L219
36,165
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/BufferCounterCell.java
BufferCounterCell.createLocal
public static CounterCell createLocal(CellName name, long value, long timestamp, long timestampOfLastDelete) { return new BufferCounterCell(name, contextManager.createLocal(value), timestamp, timestampOfLastDelete); }
java
public static CounterCell createLocal(CellName name, long value, long timestamp, long timestampOfLastDelete) { return new BufferCounterCell(name, contextManager.createLocal(value), timestamp, timestampOfLastDelete); }
[ "public", "static", "CounterCell", "createLocal", "(", "CellName", "name", ",", "long", "value", ",", "long", "timestamp", ",", "long", "timestampOfLastDelete", ")", "{", "return", "new", "BufferCounterCell", "(", "name", ",", "contextManager", ".", "createLocal",...
For use by tests of compatibility with pre-2.1 counter only.
[ "For", "use", "by", "tests", "of", "compatibility", "with", "pre", "-", "2", ".", "1", "counter", "only", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/BufferCounterCell.java#L55-L58
36,166
Stratio/stratio-cassandra
src/java/org/apache/cassandra/tools/SSTableImport.java
SSTableImport.addColumnsToCF
private void addColumnsToCF(List<?> row, ColumnFamily cfamily) { CFMetaData cfm = cfamily.metadata(); assert cfm != null; for (Object c : row) { JsonColumn col = new JsonColumn<List>((List) c, cfm); if (col.isRangeTombstone()) { Composite start = cfm.comparator.fromByteBuffer(col.getName()); Composite end = cfm.comparator.fromByteBuffer(col.getValue()); cfamily.addAtom(new RangeTombstone(start, end, col.timestamp, col.localExpirationTime)); continue; } assert cfm.isCQL3Table() || col.getName().hasRemaining() : "Cell name should not be empty"; CellName cname = col.getName().hasRemaining() ? cfm.comparator.cellFromByteBuffer(col.getName()) : cfm.comparator.rowMarker(Composites.EMPTY); if (col.isExpiring()) { cfamily.addColumn(new BufferExpiringCell(cname, col.getValue(), col.timestamp, col.ttl, col.localExpirationTime)); } else if (col.isCounter()) { cfamily.addColumn(new BufferCounterCell(cname, col.getValue(), col.timestamp, col.timestampOfLastDelete)); } else if (col.isDeleted()) { cfamily.addTombstone(cname, col.getValue(), col.timestamp); } else if (col.isRangeTombstone()) { CellName end = cfm.comparator.cellFromByteBuffer(col.getValue()); cfamily.addAtom(new RangeTombstone(cname, end, col.timestamp, col.localExpirationTime)); } // cql3 row marker, see CASSANDRA-5852 else if (cname.isEmpty()) { cfamily.addColumn(cfm.comparator.rowMarker(Composites.EMPTY), col.getValue(), col.timestamp); } else { cfamily.addColumn(cname, col.getValue(), col.timestamp); } } }
java
private void addColumnsToCF(List<?> row, ColumnFamily cfamily) { CFMetaData cfm = cfamily.metadata(); assert cfm != null; for (Object c : row) { JsonColumn col = new JsonColumn<List>((List) c, cfm); if (col.isRangeTombstone()) { Composite start = cfm.comparator.fromByteBuffer(col.getName()); Composite end = cfm.comparator.fromByteBuffer(col.getValue()); cfamily.addAtom(new RangeTombstone(start, end, col.timestamp, col.localExpirationTime)); continue; } assert cfm.isCQL3Table() || col.getName().hasRemaining() : "Cell name should not be empty"; CellName cname = col.getName().hasRemaining() ? cfm.comparator.cellFromByteBuffer(col.getName()) : cfm.comparator.rowMarker(Composites.EMPTY); if (col.isExpiring()) { cfamily.addColumn(new BufferExpiringCell(cname, col.getValue(), col.timestamp, col.ttl, col.localExpirationTime)); } else if (col.isCounter()) { cfamily.addColumn(new BufferCounterCell(cname, col.getValue(), col.timestamp, col.timestampOfLastDelete)); } else if (col.isDeleted()) { cfamily.addTombstone(cname, col.getValue(), col.timestamp); } else if (col.isRangeTombstone()) { CellName end = cfm.comparator.cellFromByteBuffer(col.getValue()); cfamily.addAtom(new RangeTombstone(cname, end, col.timestamp, col.localExpirationTime)); } // cql3 row marker, see CASSANDRA-5852 else if (cname.isEmpty()) { cfamily.addColumn(cfm.comparator.rowMarker(Composites.EMPTY), col.getValue(), col.timestamp); } else { cfamily.addColumn(cname, col.getValue(), col.timestamp); } } }
[ "private", "void", "addColumnsToCF", "(", "List", "<", "?", ">", "row", ",", "ColumnFamily", "cfamily", ")", "{", "CFMetaData", "cfm", "=", "cfamily", ".", "metadata", "(", ")", ";", "assert", "cfm", "!=", "null", ";", "for", "(", "Object", "c", ":", ...
Add columns to a column family. @param row the columns associated with a row @param cfamily the column family to add columns to
[ "Add", "columns", "to", "a", "column", "family", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableImport.java#L206-L253
36,167
Stratio/stratio-cassandra
src/java/org/apache/cassandra/tools/SSTableImport.java
SSTableImport.importJson
public int importJson(String jsonFile, String keyspace, String cf, String ssTablePath) throws IOException { ColumnFamily columnFamily = ArrayBackedSortedColumns.factory.create(keyspace, cf); IPartitioner partitioner = DatabaseDescriptor.getPartitioner(); int importedKeys = (isSorted) ? importSorted(jsonFile, columnFamily, ssTablePath, partitioner) : importUnsorted(jsonFile, columnFamily, ssTablePath, partitioner); if (importedKeys != -1) System.out.printf("%d keys imported successfully.%n", importedKeys); return importedKeys; }
java
public int importJson(String jsonFile, String keyspace, String cf, String ssTablePath) throws IOException { ColumnFamily columnFamily = ArrayBackedSortedColumns.factory.create(keyspace, cf); IPartitioner partitioner = DatabaseDescriptor.getPartitioner(); int importedKeys = (isSorted) ? importSorted(jsonFile, columnFamily, ssTablePath, partitioner) : importUnsorted(jsonFile, columnFamily, ssTablePath, partitioner); if (importedKeys != -1) System.out.printf("%d keys imported successfully.%n", importedKeys); return importedKeys; }
[ "public", "int", "importJson", "(", "String", "jsonFile", ",", "String", "keyspace", ",", "String", "cf", ",", "String", "ssTablePath", ")", "throws", "IOException", "{", "ColumnFamily", "columnFamily", "=", "ArrayBackedSortedColumns", ".", "factory", ".", "create...
Convert a JSON formatted file to an SSTable. @param jsonFile the file containing JSON formatted data @param keyspace keyspace the data belongs to @param cf column family the data belongs to @param ssTablePath file to write the SSTable to @throws IOException for errors reading/writing input/output
[ "Convert", "a", "JSON", "formatted", "file", "to", "an", "SSTable", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableImport.java#L282-L294
36,168
Stratio/stratio-cassandra
src/java/org/apache/cassandra/tools/SSTableImport.java
SSTableImport.getKeyValidator
private AbstractType<?> getKeyValidator(ColumnFamily columnFamily) { // this is a fix to support backward compatibility // which allows to skip the current key validator // please, take a look onto CASSANDRA-7498 for more details if ("true".equals(System.getProperty("skip.key.validator", "false"))) { return BytesType.instance; } return columnFamily.metadata().getKeyValidator(); }
java
private AbstractType<?> getKeyValidator(ColumnFamily columnFamily) { // this is a fix to support backward compatibility // which allows to skip the current key validator // please, take a look onto CASSANDRA-7498 for more details if ("true".equals(System.getProperty("skip.key.validator", "false"))) { return BytesType.instance; } return columnFamily.metadata().getKeyValidator(); }
[ "private", "AbstractType", "<", "?", ">", "getKeyValidator", "(", "ColumnFamily", "columnFamily", ")", "{", "// this is a fix to support backward compatibility", "// which allows to skip the current key validator", "// please, take a look onto CASSANDRA-7498 for more details", "if", "(...
Get key validator for column family @param columnFamily column family instance @return key validator for given column family
[ "Get", "key", "validator", "for", "column", "family" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableImport.java#L435-L443
36,169
Stratio/stratio-cassandra
src/java/org/apache/cassandra/tools/SSTableImport.java
SSTableImport.main
public static void main(String[] args) throws ParseException, ConfigurationException { CommandLineParser parser = new PosixParser(); try { cmd = parser.parse(options, args); } catch (org.apache.commons.cli.ParseException e) { System.err.println(e.getMessage()); printProgramUsage(); System.exit(1); } if (cmd.getArgs().length != 2) { printProgramUsage(); System.exit(1); } String json = cmd.getArgs()[0]; String ssTable = cmd.getArgs()[1]; String keyspace = cmd.getOptionValue(KEYSPACE_OPTION); String cfamily = cmd.getOptionValue(COLUMN_FAMILY_OPTION); Integer keyCountToImport = null; boolean isSorted = false; if (cmd.hasOption(KEY_COUNT_OPTION)) { keyCountToImport = Integer.valueOf(cmd.getOptionValue(KEY_COUNT_OPTION)); } if (cmd.hasOption(IS_SORTED_OPTION)) { isSorted = true; } DatabaseDescriptor.loadSchemas(false); if (Schema.instance.getNonSystemKeyspaces().size() < 1) { String msg = "no non-system keyspaces are defined"; System.err.println(msg); throw new ConfigurationException(msg); } try { new SSTableImport(keyCountToImport, isSorted).importJson(json, keyspace, cfamily, ssTable); } catch (Exception e) { JVMStabilityInspector.inspectThrowable(e); e.printStackTrace(); System.err.println("ERROR: " + e.getMessage()); System.exit(-1); } System.exit(0); }
java
public static void main(String[] args) throws ParseException, ConfigurationException { CommandLineParser parser = new PosixParser(); try { cmd = parser.parse(options, args); } catch (org.apache.commons.cli.ParseException e) { System.err.println(e.getMessage()); printProgramUsage(); System.exit(1); } if (cmd.getArgs().length != 2) { printProgramUsage(); System.exit(1); } String json = cmd.getArgs()[0]; String ssTable = cmd.getArgs()[1]; String keyspace = cmd.getOptionValue(KEYSPACE_OPTION); String cfamily = cmd.getOptionValue(COLUMN_FAMILY_OPTION); Integer keyCountToImport = null; boolean isSorted = false; if (cmd.hasOption(KEY_COUNT_OPTION)) { keyCountToImport = Integer.valueOf(cmd.getOptionValue(KEY_COUNT_OPTION)); } if (cmd.hasOption(IS_SORTED_OPTION)) { isSorted = true; } DatabaseDescriptor.loadSchemas(false); if (Schema.instance.getNonSystemKeyspaces().size() < 1) { String msg = "no non-system keyspaces are defined"; System.err.println(msg); throw new ConfigurationException(msg); } try { new SSTableImport(keyCountToImport, isSorted).importJson(json, keyspace, cfamily, ssTable); } catch (Exception e) { JVMStabilityInspector.inspectThrowable(e); e.printStackTrace(); System.err.println("ERROR: " + e.getMessage()); System.exit(-1); } System.exit(0); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "ParseException", ",", "ConfigurationException", "{", "CommandLineParser", "parser", "=", "new", "PosixParser", "(", ")", ";", "try", "{", "cmd", "=", "parser", ".", "parse",...
Converts JSON to an SSTable file. JSON input can either be a file specified using an optional command line argument, or supplied on standard in. @param args command line arguments @throws IOException on failure to open/read/write files or output streams @throws ParseException on failure to parse JSON input @throws ConfigurationException on configuration error.
[ "Converts", "JSON", "to", "an", "SSTable", "file", ".", "JSON", "input", "can", "either", "be", "a", "file", "specified", "using", "an", "optional", "command", "line", "argument", "or", "supplied", "on", "standard", "in", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableImport.java#L465-L525
36,170
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.updateHostId
public void updateHostId(UUID hostId, InetAddress endpoint) { assert hostId != null; assert endpoint != null; lock.writeLock().lock(); try { InetAddress storedEp = endpointToHostIdMap.inverse().get(hostId); if (storedEp != null) { if (!storedEp.equals(endpoint) && (FailureDetector.instance.isAlive(storedEp))) { throw new RuntimeException(String.format("Host ID collision between active endpoint %s and %s (id=%s)", storedEp, endpoint, hostId)); } } UUID storedId = endpointToHostIdMap.get(endpoint); if ((storedId != null) && (!storedId.equals(hostId))) logger.warn("Changing {}'s host ID from {} to {}", endpoint, storedId, hostId); endpointToHostIdMap.forcePut(endpoint, hostId); } finally { lock.writeLock().unlock(); } }
java
public void updateHostId(UUID hostId, InetAddress endpoint) { assert hostId != null; assert endpoint != null; lock.writeLock().lock(); try { InetAddress storedEp = endpointToHostIdMap.inverse().get(hostId); if (storedEp != null) { if (!storedEp.equals(endpoint) && (FailureDetector.instance.isAlive(storedEp))) { throw new RuntimeException(String.format("Host ID collision between active endpoint %s and %s (id=%s)", storedEp, endpoint, hostId)); } } UUID storedId = endpointToHostIdMap.get(endpoint); if ((storedId != null) && (!storedId.equals(hostId))) logger.warn("Changing {}'s host ID from {} to {}", endpoint, storedId, hostId); endpointToHostIdMap.forcePut(endpoint, hostId); } finally { lock.writeLock().unlock(); } }
[ "public", "void", "updateHostId", "(", "UUID", "hostId", ",", "InetAddress", "endpoint", ")", "{", "assert", "hostId", "!=", "null", ";", "assert", "endpoint", "!=", "null", ";", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{...
Store an end-point to host ID mapping. Each ID must be unique, and cannot be changed after the fact. @param hostId @param endpoint
[ "Store", "an", "end", "-", "point", "to", "host", "ID", "mapping", ".", "Each", "ID", "must", "be", "unique", "and", "cannot", "be", "changed", "after", "the", "fact", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L220-L251
36,171
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.getHostId
public UUID getHostId(InetAddress endpoint) { lock.readLock().lock(); try { return endpointToHostIdMap.get(endpoint); } finally { lock.readLock().unlock(); } }
java
public UUID getHostId(InetAddress endpoint) { lock.readLock().lock(); try { return endpointToHostIdMap.get(endpoint); } finally { lock.readLock().unlock(); } }
[ "public", "UUID", "getHostId", "(", "InetAddress", "endpoint", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "return", "endpointToHostIdMap", ".", "get", "(", "endpoint", ")", ";", "}", "finally", "{", "lock", "."...
Return the unique host ID for an end-point.
[ "Return", "the", "unique", "host", "ID", "for", "an", "end", "-", "point", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L254-L265
36,172
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.getEndpointForHostId
public InetAddress getEndpointForHostId(UUID hostId) { lock.readLock().lock(); try { return endpointToHostIdMap.inverse().get(hostId); } finally { lock.readLock().unlock(); } }
java
public InetAddress getEndpointForHostId(UUID hostId) { lock.readLock().lock(); try { return endpointToHostIdMap.inverse().get(hostId); } finally { lock.readLock().unlock(); } }
[ "public", "InetAddress", "getEndpointForHostId", "(", "UUID", "hostId", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "return", "endpointToHostIdMap", ".", "inverse", "(", ")", ".", "get", "(", "hostId", ")", ";", ...
Return the end-point for a unique host ID
[ "Return", "the", "end", "-", "point", "for", "a", "unique", "host", "ID" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L268-L279
36,173
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.addMovingEndpoint
public void addMovingEndpoint(Token token, InetAddress endpoint) { assert endpoint != null; lock.writeLock().lock(); try { movingEndpoints.add(Pair.create(token, endpoint)); } finally { lock.writeLock().unlock(); } }
java
public void addMovingEndpoint(Token token, InetAddress endpoint) { assert endpoint != null; lock.writeLock().lock(); try { movingEndpoints.add(Pair.create(token, endpoint)); } finally { lock.writeLock().unlock(); } }
[ "public", "void", "addMovingEndpoint", "(", "Token", "token", ",", "InetAddress", "endpoint", ")", "{", "assert", "endpoint", "!=", "null", ";", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "movingEndpoints", ".", "add", "(...
Add a new moving endpoint @param token token which is node moving to @param endpoint address of the moving node
[ "Add", "a", "new", "moving", "endpoint" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L372-L386
36,174
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.cloneOnlyTokenMap
public TokenMetadata cloneOnlyTokenMap() { lock.readLock().lock(); try { return new TokenMetadata(SortedBiMultiValMap.<Token, InetAddress>create(tokenToEndpointMap, null, inetaddressCmp), HashBiMap.create(endpointToHostIdMap), new Topology(topology)); } finally { lock.readLock().unlock(); } }
java
public TokenMetadata cloneOnlyTokenMap() { lock.readLock().lock(); try { return new TokenMetadata(SortedBiMultiValMap.<Token, InetAddress>create(tokenToEndpointMap, null, inetaddressCmp), HashBiMap.create(endpointToHostIdMap), new Topology(topology)); } finally { lock.readLock().unlock(); } }
[ "public", "TokenMetadata", "cloneOnlyTokenMap", "(", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "return", "new", "TokenMetadata", "(", "SortedBiMultiValMap", ".", "<", "Token", ",", "InetAddress", ">", "create", "(...
Create a copy of TokenMetadata with only tokenToEndpointMap. That is, pending ranges, bootstrap tokens and leaving endpoints are not included in the copy.
[ "Create", "a", "copy", "of", "TokenMetadata", "with", "only", "tokenToEndpointMap", ".", "That", "is", "pending", "ranges", "bootstrap", "tokens", "and", "leaving", "endpoints", "are", "not", "included", "in", "the", "copy", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L517-L530
36,175
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.cachedOnlyTokenMap
public TokenMetadata cachedOnlyTokenMap() { TokenMetadata tm = cachedTokenMap.get(); if (tm != null) return tm; // synchronize to prevent thundering herd (CASSANDRA-6345) synchronized (this) { if ((tm = cachedTokenMap.get()) != null) return tm; tm = cloneOnlyTokenMap(); cachedTokenMap.set(tm); return tm; } }
java
public TokenMetadata cachedOnlyTokenMap() { TokenMetadata tm = cachedTokenMap.get(); if (tm != null) return tm; // synchronize to prevent thundering herd (CASSANDRA-6345) synchronized (this) { if ((tm = cachedTokenMap.get()) != null) return tm; tm = cloneOnlyTokenMap(); cachedTokenMap.set(tm); return tm; } }
[ "public", "TokenMetadata", "cachedOnlyTokenMap", "(", ")", "{", "TokenMetadata", "tm", "=", "cachedTokenMap", ".", "get", "(", ")", ";", "if", "(", "tm", "!=", "null", ")", "return", "tm", ";", "// synchronize to prevent thundering herd (CASSANDRA-6345)", "synchroni...
Return a cached TokenMetadata with only tokenToEndpointMap, i.e., the same as cloneOnlyTokenMap but uses a cached copy that is invalided when the ring changes, so in the common case no extra locking is required. Callers must *NOT* mutate the returned metadata object.
[ "Return", "a", "cached", "TokenMetadata", "with", "only", "tokenToEndpointMap", "i", ".", "e", ".", "the", "same", "as", "cloneOnlyTokenMap", "but", "uses", "a", "cached", "copy", "that", "is", "invalided", "when", "the", "ring", "changes", "so", "in", "the"...
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L539-L555
36,176
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.cloneAfterAllLeft
public TokenMetadata cloneAfterAllLeft() { lock.readLock().lock(); try { TokenMetadata allLeftMetadata = cloneOnlyTokenMap(); for (InetAddress endpoint : leavingEndpoints) allLeftMetadata.removeEndpoint(endpoint); return allLeftMetadata; } finally { lock.readLock().unlock(); } }
java
public TokenMetadata cloneAfterAllLeft() { lock.readLock().lock(); try { TokenMetadata allLeftMetadata = cloneOnlyTokenMap(); for (InetAddress endpoint : leavingEndpoints) allLeftMetadata.removeEndpoint(endpoint); return allLeftMetadata; } finally { lock.readLock().unlock(); } }
[ "public", "TokenMetadata", "cloneAfterAllLeft", "(", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "TokenMetadata", "allLeftMetadata", "=", "cloneOnlyTokenMap", "(", ")", ";", "for", "(", "InetAddress", "endpoint", ":",...
Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave operations have finished. @return new token metadata
[ "Create", "a", "copy", "of", "TokenMetadata", "with", "tokenToEndpointMap", "reflecting", "situation", "after", "all", "current", "leave", "operations", "have", "finished", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L563-L579
36,177
Stratio/stratio-cassandra
src/java/org/apache/cassandra/locator/TokenMetadata.java
TokenMetadata.cloneAfterAllSettled
public TokenMetadata cloneAfterAllSettled() { lock.readLock().lock(); try { TokenMetadata metadata = cloneOnlyTokenMap(); for (InetAddress endpoint : leavingEndpoints) metadata.removeEndpoint(endpoint); for (Pair<Token, InetAddress> pair : movingEndpoints) metadata.updateNormalToken(pair.left, pair.right); return metadata; } finally { lock.readLock().unlock(); } }
java
public TokenMetadata cloneAfterAllSettled() { lock.readLock().lock(); try { TokenMetadata metadata = cloneOnlyTokenMap(); for (InetAddress endpoint : leavingEndpoints) metadata.removeEndpoint(endpoint); for (Pair<Token, InetAddress> pair : movingEndpoints) metadata.updateNormalToken(pair.left, pair.right); return metadata; } finally { lock.readLock().unlock(); } }
[ "public", "TokenMetadata", "cloneAfterAllSettled", "(", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "TokenMetadata", "metadata", "=", "cloneOnlyTokenMap", "(", ")", ";", "for", "(", "InetAddress", "endpoint", ":", "...
Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave, and move operations have finished. @return new token metadata
[ "Create", "a", "copy", "of", "TokenMetadata", "with", "tokenToEndpointMap", "reflecting", "situation", "after", "all", "current", "leave", "and", "move", "operations", "have", "finished", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/locator/TokenMetadata.java#L587-L608
36,178
Stratio/stratio-cassandra
src/java/org/apache/cassandra/metrics/RestorableMeter.java
RestorableMeter.tickIfNecessary
private void tickIfNecessary() { final long oldTick = lastTick.get(); final long newTick = clock.tick(); final long age = newTick - oldTick; if (age > TICK_INTERVAL) { final long newIntervalStartTick = newTick - age % TICK_INTERVAL; if (lastTick.compareAndSet(oldTick, newIntervalStartTick)) { final long requiredTicks = age / TICK_INTERVAL; for (long i = 0; i < requiredTicks; i++) { m15Rate.tick(); m120Rate.tick(); } } } }
java
private void tickIfNecessary() { final long oldTick = lastTick.get(); final long newTick = clock.tick(); final long age = newTick - oldTick; if (age > TICK_INTERVAL) { final long newIntervalStartTick = newTick - age % TICK_INTERVAL; if (lastTick.compareAndSet(oldTick, newIntervalStartTick)) { final long requiredTicks = age / TICK_INTERVAL; for (long i = 0; i < requiredTicks; i++) { m15Rate.tick(); m120Rate.tick(); } } } }
[ "private", "void", "tickIfNecessary", "(", ")", "{", "final", "long", "oldTick", "=", "lastTick", ".", "get", "(", ")", ";", "final", "long", "newTick", "=", "clock", ".", "tick", "(", ")", ";", "final", "long", "age", "=", "newTick", "-", "oldTick", ...
Updates the moving averages as needed.
[ "Updates", "the", "moving", "averages", "as", "needed", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/metrics/RestorableMeter.java#L74-L88
36,179
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/TopKSampler.java
TopKSampler.beginSampling
public synchronized void beginSampling(int capacity) { if (!enabled) { summary = new StreamSummary<T>(capacity); hll = new HyperLogLogPlus(14); enabled = true; } }
java
public synchronized void beginSampling(int capacity) { if (!enabled) { summary = new StreamSummary<T>(capacity); hll = new HyperLogLogPlus(14); enabled = true; } }
[ "public", "synchronized", "void", "beginSampling", "(", "int", "capacity", ")", "{", "if", "(", "!", "enabled", ")", "{", "summary", "=", "new", "StreamSummary", "<", "T", ">", "(", "capacity", ")", ";", "hll", "=", "new", "HyperLogLogPlus", "(", "14", ...
Start to record samples @param capacity Number of sample items to keep in memory, the lower this is the less accurate results are. For best results use value close to cardinality, but understand the memory trade offs.
[ "Start", "to", "record", "samples" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/TopKSampler.java#L55-L63
36,180
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/TopKSampler.java
TopKSampler.finishSampling
public synchronized SamplerResult<T> finishSampling(int count) { List<Counter<T>> results = Collections.EMPTY_LIST; long cardinality = 0; if (enabled) { enabled = false; results = summary.topK(count); cardinality = hll.cardinality(); } return new SamplerResult<T>(results, cardinality); }
java
public synchronized SamplerResult<T> finishSampling(int count) { List<Counter<T>> results = Collections.EMPTY_LIST; long cardinality = 0; if (enabled) { enabled = false; results = summary.topK(count); cardinality = hll.cardinality(); } return new SamplerResult<T>(results, cardinality); }
[ "public", "synchronized", "SamplerResult", "<", "T", ">", "finishSampling", "(", "int", "count", ")", "{", "List", "<", "Counter", "<", "T", ">>", "results", "=", "Collections", ".", "EMPTY_LIST", ";", "long", "cardinality", "=", "0", ";", "if", "(", "en...
Call to stop collecting samples, and gather the results @param count Number of most frequent items to return
[ "Call", "to", "stop", "collecting", "samples", "and", "gather", "the", "results" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/TopKSampler.java#L69-L80
36,181
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/TopKSampler.java
TopKSampler.addSample
public void addSample(final T item, final long hash, final int value) { if (enabled) { final Object lock = this; samplerExecutor.execute(new Runnable() { public void run() { // samplerExecutor is single threaded but still need // synchronization against jmx calls to finishSampling synchronized (lock) { if (enabled) { try { summary.offer(item, value); hll.offerHashed(hash); } catch (Exception e) { logger.debug("Failure to offer sample", e); } } } } }); } }
java
public void addSample(final T item, final long hash, final int value) { if (enabled) { final Object lock = this; samplerExecutor.execute(new Runnable() { public void run() { // samplerExecutor is single threaded but still need // synchronization against jmx calls to finishSampling synchronized (lock) { if (enabled) { try { summary.offer(item, value); hll.offerHashed(hash); } catch (Exception e) { logger.debug("Failure to offer sample", e); } } } } }); } }
[ "public", "void", "addSample", "(", "final", "T", "item", ",", "final", "long", "hash", ",", "final", "int", "value", ")", "{", "if", "(", "enabled", ")", "{", "final", "Object", "lock", "=", "this", ";", "samplerExecutor", ".", "execute", "(", "new", ...
Adds a sample to statistics collection. This method is non-blocking and will use the "Sampler" thread pool to record results if the sampler is enabled. If not sampling this is a NOOP
[ "Adds", "a", "sample", "to", "statistics", "collection", ".", "This", "method", "is", "non", "-", "blocking", "and", "will", "use", "the", "Sampler", "thread", "pool", "to", "record", "results", "if", "the", "sampler", "is", "enabled", ".", "If", "not", ...
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/TopKSampler.java#L92-L120
36,182
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.getNext
public Tuple getNext() throws IOException { try { // load the next pair if (!reader.nextKeyValue()) return null; CfInfo cfInfo = getCfInfo(loadSignature); CfDef cfDef = cfInfo.cfDef; Row row = reader.getCurrentValue(); Tuple tuple = TupleFactory.getInstance().newTuple(cfDef.column_metadata.size()); Iterator<ColumnDef> itera = cfDef.column_metadata.iterator(); int i = 0; while (itera.hasNext()) { ColumnDef cdef = itera.next(); ByteBuffer columnValue = row.getBytesUnsafe(ByteBufferUtil.string(cdef.name.duplicate())); if (columnValue != null) { Cell cell = new BufferCell(CellNames.simpleDense(cdef.name), columnValue); AbstractType<?> validator = getValidatorMap(cfDef).get(cdef.name); setTupleValue(tuple, i, cqlColumnToObj(cell, cfDef), validator); } else tuple.set(i, null); i++; } return tuple; } catch (InterruptedException e) { throw new IOException(e.getMessage()); } }
java
public Tuple getNext() throws IOException { try { // load the next pair if (!reader.nextKeyValue()) return null; CfInfo cfInfo = getCfInfo(loadSignature); CfDef cfDef = cfInfo.cfDef; Row row = reader.getCurrentValue(); Tuple tuple = TupleFactory.getInstance().newTuple(cfDef.column_metadata.size()); Iterator<ColumnDef> itera = cfDef.column_metadata.iterator(); int i = 0; while (itera.hasNext()) { ColumnDef cdef = itera.next(); ByteBuffer columnValue = row.getBytesUnsafe(ByteBufferUtil.string(cdef.name.duplicate())); if (columnValue != null) { Cell cell = new BufferCell(CellNames.simpleDense(cdef.name), columnValue); AbstractType<?> validator = getValidatorMap(cfDef).get(cdef.name); setTupleValue(tuple, i, cqlColumnToObj(cell, cfDef), validator); } else tuple.set(i, null); i++; } return tuple; } catch (InterruptedException e) { throw new IOException(e.getMessage()); } }
[ "public", "Tuple", "getNext", "(", ")", "throws", "IOException", "{", "try", "{", "// load the next pair", "if", "(", "!", "reader", ".", "nextKeyValue", "(", ")", ")", "return", "null", ";", "CfInfo", "cfInfo", "=", "getCfInfo", "(", "loadSignature", ")", ...
get next row
[ "get", "next", "row" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L114-L148
36,183
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.cqlColumnToObj
private Object cqlColumnToObj(Cell col, CfDef cfDef) throws IOException { // standard Map<ByteBuffer,AbstractType> validators = getValidatorMap(cfDef); ByteBuffer cellName = col.name().toByteBuffer(); if (validators.get(cellName) == null) return cassandraToObj(getDefaultMarshallers(cfDef).get(MarshallerType.DEFAULT_VALIDATOR), col.value()); else return cassandraToObj(validators.get(cellName), col.value()); }
java
private Object cqlColumnToObj(Cell col, CfDef cfDef) throws IOException { // standard Map<ByteBuffer,AbstractType> validators = getValidatorMap(cfDef); ByteBuffer cellName = col.name().toByteBuffer(); if (validators.get(cellName) == null) return cassandraToObj(getDefaultMarshallers(cfDef).get(MarshallerType.DEFAULT_VALIDATOR), col.value()); else return cassandraToObj(validators.get(cellName), col.value()); }
[ "private", "Object", "cqlColumnToObj", "(", "Cell", "col", ",", "CfDef", "cfDef", ")", "throws", "IOException", "{", "// standard", "Map", "<", "ByteBuffer", ",", "AbstractType", ">", "validators", "=", "getValidatorMap", "(", "cfDef", ")", ";", "ByteBuffer", ...
convert a cql column to an object
[ "convert", "a", "cql", "column", "to", "an", "object" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L151-L160
36,184
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.getColumnMetadata
protected List<ColumnDef> getColumnMetadata(Cassandra.Client client) throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException, CharacterCodingException, org.apache.cassandra.exceptions.InvalidRequestException, ConfigurationException, NotFoundException { List<ColumnDef> keyColumns = null; // get key columns try { keyColumns = getKeysMeta(client); } catch(Exception e) { logger.error("Error in retrieving key columns" , e); } // get other columns List<ColumnDef> columns = getColumnMeta(client, false, !hasCompactValueAlias); // combine all columns in a list if (keyColumns != null && columns != null) keyColumns.addAll(columns); return keyColumns; }
java
protected List<ColumnDef> getColumnMetadata(Cassandra.Client client) throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException, CharacterCodingException, org.apache.cassandra.exceptions.InvalidRequestException, ConfigurationException, NotFoundException { List<ColumnDef> keyColumns = null; // get key columns try { keyColumns = getKeysMeta(client); } catch(Exception e) { logger.error("Error in retrieving key columns" , e); } // get other columns List<ColumnDef> columns = getColumnMeta(client, false, !hasCompactValueAlias); // combine all columns in a list if (keyColumns != null && columns != null) keyColumns.addAll(columns); return keyColumns; }
[ "protected", "List", "<", "ColumnDef", ">", "getColumnMetadata", "(", "Cassandra", ".", "Client", "client", ")", "throws", "InvalidRequestException", ",", "UnavailableException", ",", "TimedOutException", ",", "SchemaDisagreementException", ",", "TException", ",", "Char...
include key columns
[ "include", "key", "columns" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L224-L254
36,185
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.tupleToKeyMap
private Map<String, ByteBuffer> tupleToKeyMap(Tuple t) throws IOException { Map<String, ByteBuffer> keys = new HashMap<String, ByteBuffer>(); for (int i = 0; i < t.size(); i++) { if (t.getType(i) == DataType.TUPLE) { Tuple inner = (Tuple) t.get(i); if (inner.size() == 2) { Object name = inner.get(0); if (name != null) { keys.put(name.toString(), objToBB(inner.get(1))); } else throw new IOException("Key name was empty"); } else throw new IOException("Keys were not in name and value pairs"); } else { throw new IOException("keys was not a tuple"); } } return keys; }
java
private Map<String, ByteBuffer> tupleToKeyMap(Tuple t) throws IOException { Map<String, ByteBuffer> keys = new HashMap<String, ByteBuffer>(); for (int i = 0; i < t.size(); i++) { if (t.getType(i) == DataType.TUPLE) { Tuple inner = (Tuple) t.get(i); if (inner.size() == 2) { Object name = inner.get(0); if (name != null) { keys.put(name.toString(), objToBB(inner.get(1))); } else throw new IOException("Key name was empty"); } else throw new IOException("Keys were not in name and value pairs"); } else { throw new IOException("keys was not a tuple"); } } return keys; }
[ "private", "Map", "<", "String", ",", "ByteBuffer", ">", "tupleToKeyMap", "(", "Tuple", "t", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "ByteBuffer", ">", "keys", "=", "new", "HashMap", "<", "String", ",", "ByteBuffer", ">", "(", ")", ...
convert key tuple to key map
[ "convert", "key", "tuple", "to", "key", "map" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L415-L442
36,186
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.cqlQueryFromTuple
private void cqlQueryFromTuple(Map<String, ByteBuffer> key, Tuple t, int offset) throws IOException { for (int i = offset; i < t.size(); i++) { if (t.getType(i) == DataType.TUPLE) { Tuple inner = (Tuple) t.get(i); if (inner.size() > 0) { List<ByteBuffer> bindedVariables = bindedVariablesFromTuple(inner); if (bindedVariables.size() > 0) sendCqlQuery(key, bindedVariables); else throw new IOException("Missing binded variables"); } } else { throw new IOException("Output type was not a tuple"); } } }
java
private void cqlQueryFromTuple(Map<String, ByteBuffer> key, Tuple t, int offset) throws IOException { for (int i = offset; i < t.size(); i++) { if (t.getType(i) == DataType.TUPLE) { Tuple inner = (Tuple) t.get(i); if (inner.size() > 0) { List<ByteBuffer> bindedVariables = bindedVariablesFromTuple(inner); if (bindedVariables.size() > 0) sendCqlQuery(key, bindedVariables); else throw new IOException("Missing binded variables"); } } else { throw new IOException("Output type was not a tuple"); } } }
[ "private", "void", "cqlQueryFromTuple", "(", "Map", "<", "String", ",", "ByteBuffer", ">", "key", ",", "Tuple", "t", ",", "int", "offset", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "t", ".", "size", "(",...
send CQL query request using data from tuple
[ "send", "CQL", "query", "request", "using", "data", "from", "tuple" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L445-L466
36,187
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.bindedVariablesFromTuple
private List<ByteBuffer> bindedVariablesFromTuple(Tuple t) throws IOException { List<ByteBuffer> variables = new ArrayList<ByteBuffer>(); for (int i = 0; i < t.size(); i++) variables.add(objToBB(t.get(i))); return variables; }
java
private List<ByteBuffer> bindedVariablesFromTuple(Tuple t) throws IOException { List<ByteBuffer> variables = new ArrayList<ByteBuffer>(); for (int i = 0; i < t.size(); i++) variables.add(objToBB(t.get(i))); return variables; }
[ "private", "List", "<", "ByteBuffer", ">", "bindedVariablesFromTuple", "(", "Tuple", "t", ")", "throws", "IOException", "{", "List", "<", "ByteBuffer", ">", "variables", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "for", "(", "int", "i"...
compose a list of binded variables
[ "compose", "a", "list", "of", "binded", "variables" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L469-L475
36,188
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.sendCqlQuery
private void sendCqlQuery(Map<String, ByteBuffer> key, List<ByteBuffer> bindedVariables) throws IOException { try { writer.write(key, bindedVariables); } catch (InterruptedException e) { throw new IOException(e); } }
java
private void sendCqlQuery(Map<String, ByteBuffer> key, List<ByteBuffer> bindedVariables) throws IOException { try { writer.write(key, bindedVariables); } catch (InterruptedException e) { throw new IOException(e); } }
[ "private", "void", "sendCqlQuery", "(", "Map", "<", "String", ",", "ByteBuffer", ">", "key", ",", "List", "<", "ByteBuffer", ">", "bindedVariables", ")", "throws", "IOException", "{", "try", "{", "writer", ".", "write", "(", "key", ",", "bindedVariables", ...
writer write the data by executing CQL query
[ "writer", "write", "the", "data", "by", "executing", "CQL", "query" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L478-L488
36,189
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java
CqlNativeStorage.getWhereClauseForPartitionFilter
private String getWhereClauseForPartitionFilter() { UDFContext context = UDFContext.getUDFContext(); Properties property = context.getUDFProperties(AbstractCassandraStorage.class); return property.getProperty(PARTITION_FILTER_SIGNATURE); }
java
private String getWhereClauseForPartitionFilter() { UDFContext context = UDFContext.getUDFContext(); Properties property = context.getUDFProperties(AbstractCassandraStorage.class); return property.getProperty(PARTITION_FILTER_SIGNATURE); }
[ "private", "String", "getWhereClauseForPartitionFilter", "(", ")", "{", "UDFContext", "context", "=", "UDFContext", ".", "getUDFContext", "(", ")", ";", "Properties", "property", "=", "context", ".", "getUDFProperties", "(", "AbstractCassandraStorage", ".", "class", ...
retrieve where clause for partition filter
[ "retrieve", "where", "clause", "for", "partition", "filter" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/pig/CqlNativeStorage.java#L557-L562
36,190
Stratio/stratio-cassandra
src/java/org/apache/cassandra/dht/AbstractByteOrderedPartitioner.java
AbstractByteOrderedPartitioner.bigForBytes
private BigInteger bigForBytes(byte[] bytes, int sigbytes) { byte[] b; if (sigbytes != bytes.length) { b = new byte[sigbytes]; System.arraycopy(bytes, 0, b, 0, bytes.length); } else b = bytes; return new BigInteger(1, b); }
java
private BigInteger bigForBytes(byte[] bytes, int sigbytes) { byte[] b; if (sigbytes != bytes.length) { b = new byte[sigbytes]; System.arraycopy(bytes, 0, b, 0, bytes.length); } else b = bytes; return new BigInteger(1, b); }
[ "private", "BigInteger", "bigForBytes", "(", "byte", "[", "]", "bytes", ",", "int", "sigbytes", ")", "{", "byte", "[", "]", "b", ";", "if", "(", "sigbytes", "!=", "bytes", ".", "length", ")", "{", "b", "=", "new", "byte", "[", "sigbytes", "]", ";",...
Convert a byte array containing the most significant of 'sigbytes' bytes representing a big-endian magnitude into a BigInteger.
[ "Convert", "a", "byte", "array", "containing", "the", "most", "significant", "of", "sigbytes", "bytes", "representing", "a", "big", "-", "endian", "magnitude", "into", "a", "BigInteger", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/dht/AbstractByteOrderedPartitioner.java#L65-L75
36,191
Stratio/stratio-cassandra
src/java/org/apache/cassandra/concurrent/StageManager.java
StageManager.shutdownNow
public static void shutdownNow() { for (Stage stage : Stage.values()) { StageManager.stages.get(stage).shutdownNow(); } }
java
public static void shutdownNow() { for (Stage stage : Stage.values()) { StageManager.stages.get(stage).shutdownNow(); } }
[ "public", "static", "void", "shutdownNow", "(", ")", "{", "for", "(", "Stage", "stage", ":", "Stage", ".", "values", "(", ")", ")", "{", "StageManager", ".", "stages", ".", "get", "(", "stage", ")", ".", "shutdownNow", "(", ")", ";", "}", "}" ]
This method shuts down all registered stages.
[ "This", "method", "shuts", "down", "all", "registered", "stages", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/concurrent/StageManager.java#L107-L113
36,192
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/FBUtilities.java
FBUtilities.midpoint
public static Pair<BigInteger,Boolean> midpoint(BigInteger left, BigInteger right, int sigbits) { BigInteger midpoint; boolean remainder; if (left.compareTo(right) < 0) { BigInteger sum = left.add(right); remainder = sum.testBit(0); midpoint = sum.shiftRight(1); } else { BigInteger max = TWO.pow(sigbits); // wrapping case BigInteger distance = max.add(right).subtract(left); remainder = distance.testBit(0); midpoint = distance.shiftRight(1).add(left).mod(max); } return Pair.create(midpoint, remainder); }
java
public static Pair<BigInteger,Boolean> midpoint(BigInteger left, BigInteger right, int sigbits) { BigInteger midpoint; boolean remainder; if (left.compareTo(right) < 0) { BigInteger sum = left.add(right); remainder = sum.testBit(0); midpoint = sum.shiftRight(1); } else { BigInteger max = TWO.pow(sigbits); // wrapping case BigInteger distance = max.add(right).subtract(left); remainder = distance.testBit(0); midpoint = distance.shiftRight(1).add(left).mod(max); } return Pair.create(midpoint, remainder); }
[ "public", "static", "Pair", "<", "BigInteger", ",", "Boolean", ">", "midpoint", "(", "BigInteger", "left", ",", "BigInteger", "right", ",", "int", "sigbits", ")", "{", "BigInteger", "midpoint", ";", "boolean", "remainder", ";", "if", "(", "left", ".", "com...
Given two bit arrays represented as BigIntegers, containing the given number of significant bits, calculate a midpoint. @param left The left point. @param right The right point. @param sigbits The number of bits in the points that are significant. @return A midpoint that will compare bitwise halfway between the params, and a boolean representing whether a non-zero lsbit remainder was generated.
[ "Given", "two", "bit", "arrays", "represented", "as", "BigIntegers", "containing", "the", "given", "number", "of", "significant", "bits", "calculate", "a", "midpoint", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/FBUtilities.java#L183-L202
36,193
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/FBUtilities.java
FBUtilities.construct
public static <T> T construct(String classname, String readable) throws ConfigurationException { Class<T> cls = FBUtilities.classForName(classname, readable); try { return cls.newInstance(); } catch (IllegalAccessException e) { throw new ConfigurationException(String.format("Default constructor for %s class '%s' is inaccessible.", readable, classname)); } catch (InstantiationException e) { throw new ConfigurationException(String.format("Cannot use abstract class '%s' as %s.", classname, readable)); } catch (Exception e) { // Catch-all because Class.newInstance() "propagates any exception thrown by the nullary constructor, including a checked exception". if (e.getCause() instanceof ConfigurationException) throw (ConfigurationException)e.getCause(); throw new ConfigurationException(String.format("Error instantiating %s class '%s'.", readable, classname), e); } }
java
public static <T> T construct(String classname, String readable) throws ConfigurationException { Class<T> cls = FBUtilities.classForName(classname, readable); try { return cls.newInstance(); } catch (IllegalAccessException e) { throw new ConfigurationException(String.format("Default constructor for %s class '%s' is inaccessible.", readable, classname)); } catch (InstantiationException e) { throw new ConfigurationException(String.format("Cannot use abstract class '%s' as %s.", classname, readable)); } catch (Exception e) { // Catch-all because Class.newInstance() "propagates any exception thrown by the nullary constructor, including a checked exception". if (e.getCause() instanceof ConfigurationException) throw (ConfigurationException)e.getCause(); throw new ConfigurationException(String.format("Error instantiating %s class '%s'.", readable, classname), e); } }
[ "public", "static", "<", "T", ">", "T", "construct", "(", "String", "classname", ",", "String", "readable", ")", "throws", "ConfigurationException", "{", "Class", "<", "T", ">", "cls", "=", "FBUtilities", ".", "classForName", "(", "classname", ",", "readable...
Constructs an instance of the given class, which must have a no-arg or default constructor. @param classname Fully qualified classname. @param readable Descriptive noun for the role the class plays. @throws ConfigurationException If the class cannot be found.
[ "Constructs", "an", "instance", "of", "the", "given", "class", "which", "must", "have", "a", "no", "-", "arg", "or", "default", "constructor", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/FBUtilities.java#L472-L494
36,194
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/FBUtilities.java
FBUtilities.exec
public static void exec(ProcessBuilder pb) throws IOException { Process p = pb.start(); try { int errCode = p.waitFor(); if (errCode != 0) { BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); StringBuilder sb = new StringBuilder(); String str; while ((str = in.readLine()) != null) sb.append(str).append(System.getProperty("line.separator")); while ((str = err.readLine()) != null) sb.append(str).append(System.getProperty("line.separator")); throw new IOException("Exception while executing the command: "+ StringUtils.join(pb.command(), " ") + ", command error Code: " + errCode + ", command output: "+ sb.toString()); } } catch (InterruptedException e) { throw new AssertionError(e); } }
java
public static void exec(ProcessBuilder pb) throws IOException { Process p = pb.start(); try { int errCode = p.waitFor(); if (errCode != 0) { BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); StringBuilder sb = new StringBuilder(); String str; while ((str = in.readLine()) != null) sb.append(str).append(System.getProperty("line.separator")); while ((str = err.readLine()) != null) sb.append(str).append(System.getProperty("line.separator")); throw new IOException("Exception while executing the command: "+ StringUtils.join(pb.command(), " ") + ", command error Code: " + errCode + ", command output: "+ sb.toString()); } } catch (InterruptedException e) { throw new AssertionError(e); } }
[ "public", "static", "void", "exec", "(", "ProcessBuilder", "pb", ")", "throws", "IOException", "{", "Process", "p", "=", "pb", ".", "start", "(", ")", ";", "try", "{", "int", "errCode", "=", "p", ".", "waitFor", "(", ")", ";", "if", "(", "errCode", ...
Starts and waits for the given @param pb to finish. @throws java.io.IOException on non-zero exit code
[ "Starts", "and", "waits", "for", "the", "given" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/FBUtilities.java#L577-L602
36,195
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Keyspace.java
Keyspace.removeUnreadableSSTables
public static void removeUnreadableSSTables(File directory) { for (Keyspace keyspace : Keyspace.all()) { for (ColumnFamilyStore baseCfs : keyspace.getColumnFamilyStores()) { for (ColumnFamilyStore cfs : baseCfs.concatWithIndexes()) cfs.maybeRemoveUnreadableSSTables(directory); } } }
java
public static void removeUnreadableSSTables(File directory) { for (Keyspace keyspace : Keyspace.all()) { for (ColumnFamilyStore baseCfs : keyspace.getColumnFamilyStores()) { for (ColumnFamilyStore cfs : baseCfs.concatWithIndexes()) cfs.maybeRemoveUnreadableSSTables(directory); } } }
[ "public", "static", "void", "removeUnreadableSSTables", "(", "File", "directory", ")", "{", "for", "(", "Keyspace", "keyspace", ":", "Keyspace", ".", "all", "(", ")", ")", "{", "for", "(", "ColumnFamilyStore", "baseCfs", ":", "keyspace", ".", "getColumnFamilyS...
Removes every SSTable in the directory from the appropriate DataTracker's view. @param directory the unreadable directory, possibly with SSTables in it, but not necessarily.
[ "Removes", "every", "SSTable", "in", "the", "directory", "from", "the", "appropriate", "DataTracker", "s", "view", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L155-L165
36,196
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Keyspace.java
Keyspace.snapshot
public void snapshot(String snapshotName, String columnFamilyName) throws IOException { assert snapshotName != null; boolean tookSnapShot = false; for (ColumnFamilyStore cfStore : columnFamilyStores.values()) { if (columnFamilyName == null || cfStore.name.equals(columnFamilyName)) { tookSnapShot = true; cfStore.snapshot(snapshotName); } } if ((columnFamilyName != null) && !tookSnapShot) throw new IOException("Failed taking snapshot. Column family " + columnFamilyName + " does not exist."); }
java
public void snapshot(String snapshotName, String columnFamilyName) throws IOException { assert snapshotName != null; boolean tookSnapShot = false; for (ColumnFamilyStore cfStore : columnFamilyStores.values()) { if (columnFamilyName == null || cfStore.name.equals(columnFamilyName)) { tookSnapShot = true; cfStore.snapshot(snapshotName); } } if ((columnFamilyName != null) && !tookSnapShot) throw new IOException("Failed taking snapshot. Column family " + columnFamilyName + " does not exist."); }
[ "public", "void", "snapshot", "(", "String", "snapshotName", ",", "String", "columnFamilyName", ")", "throws", "IOException", "{", "assert", "snapshotName", "!=", "null", ";", "boolean", "tookSnapShot", "=", "false", ";", "for", "(", "ColumnFamilyStore", "cfStore"...
Take a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestamp @param snapshotName the tag associated with the name of the snapshot. This value may not be null @param columnFamilyName the column family to snapshot or all on null @throws IOException if the column family doesn't exist
[ "Take", "a", "snapshot", "of", "the", "specific", "column", "family", "or", "the", "entire", "set", "of", "column", "families", "if", "columnFamily", "is", "null", "with", "a", "given", "timestamp" ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L196-L211
36,197
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Keyspace.java
Keyspace.snapshotExists
public boolean snapshotExists(String snapshotName) { assert snapshotName != null; for (ColumnFamilyStore cfStore : columnFamilyStores.values()) { if (cfStore.snapshotExists(snapshotName)) return true; } return false; }
java
public boolean snapshotExists(String snapshotName) { assert snapshotName != null; for (ColumnFamilyStore cfStore : columnFamilyStores.values()) { if (cfStore.snapshotExists(snapshotName)) return true; } return false; }
[ "public", "boolean", "snapshotExists", "(", "String", "snapshotName", ")", "{", "assert", "snapshotName", "!=", "null", ";", "for", "(", "ColumnFamilyStore", "cfStore", ":", "columnFamilyStores", ".", "values", "(", ")", ")", "{", "if", "(", "cfStore", ".", ...
Check whether snapshots already exists for a given name. @param snapshotName the user supplied snapshot name @return true if the snapshot exists
[ "Check", "whether", "snapshots", "already", "exists", "for", "a", "given", "name", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L233-L242
36,198
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Keyspace.java
Keyspace.clearSnapshot
public static void clearSnapshot(String snapshotName, String keyspace) { List<File> snapshotDirs = Directories.getKSChildDirectories(keyspace); Directories.clearSnapshot(snapshotName, snapshotDirs); }
java
public static void clearSnapshot(String snapshotName, String keyspace) { List<File> snapshotDirs = Directories.getKSChildDirectories(keyspace); Directories.clearSnapshot(snapshotName, snapshotDirs); }
[ "public", "static", "void", "clearSnapshot", "(", "String", "snapshotName", ",", "String", "keyspace", ")", "{", "List", "<", "File", ">", "snapshotDirs", "=", "Directories", ".", "getKSChildDirectories", "(", "keyspace", ")", ";", "Directories", ".", "clearSnap...
Clear all the snapshots for a given keyspace. @param snapshotName the user supplied snapshot name. It empty or null, all the snapshots will be cleaned
[ "Clear", "all", "the", "snapshots", "for", "a", "given", "keyspace", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L250-L254
36,199
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/Keyspace.java
Keyspace.dropCf
public void dropCf(UUID cfId) { assert columnFamilyStores.containsKey(cfId); ColumnFamilyStore cfs = columnFamilyStores.remove(cfId); if (cfs == null) return; // wait for any outstanding reads/writes that might affect the CFS cfs.keyspace.writeOrder.awaitNewBarrier(); cfs.readOrdering.awaitNewBarrier(); unloadCf(cfs); }
java
public void dropCf(UUID cfId) { assert columnFamilyStores.containsKey(cfId); ColumnFamilyStore cfs = columnFamilyStores.remove(cfId); if (cfs == null) return; // wait for any outstanding reads/writes that might affect the CFS cfs.keyspace.writeOrder.awaitNewBarrier(); cfs.readOrdering.awaitNewBarrier(); unloadCf(cfs); }
[ "public", "void", "dropCf", "(", "UUID", "cfId", ")", "{", "assert", "columnFamilyStores", ".", "containsKey", "(", "cfId", ")", ";", "ColumnFamilyStore", "cfs", "=", "columnFamilyStores", ".", "remove", "(", "cfId", ")", ";", "if", "(", "cfs", "==", "null...
best invoked on the compaction mananger.
[ "best", "invoked", "on", "the", "compaction", "mananger", "." ]
f6416b43ad5309083349ad56266450fa8c6a2106
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L291-L303