idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
12,200
public static void skipIndex ( DataInput in ) throws IOException { int columnIndexSize = in . readInt ( ) ; if ( in instanceof FileDataInput ) { FileUtils . skipBytesFully ( in , columnIndexSize ) ; } else { byte [ ] skip = new byte [ columnIndexSize ] ; in . readFully ( skip ) ; } }
Skip the index
12,201
public static List < IndexInfo > deserializeIndex ( FileDataInput in , CType type ) throws IOException { int columnIndexSize = in . readInt ( ) ; if ( columnIndexSize == 0 ) return Collections . < IndexInfo > emptyList ( ) ; ArrayList < IndexInfo > indexList = new ArrayList < IndexInfo > ( ) ; FileMark mark = in . mark...
Deserialize the index into a structure and return it
12,202
public Timer newTimer ( String opType , int sampleCount ) { final Timer timer = new Timer ( sampleCount ) ; if ( ! timers . containsKey ( opType ) ) timers . put ( opType , new ArrayList < Timer > ( ) ) ; timers . get ( opType ) . add ( timer ) ; return timer ; }
build a new timer and add it to the set of running timers .
12,203
public void close ( org . apache . hadoop . mapred . Reporter reporter ) throws IOException { close ( ) ; }
Fills the deprecated RecordWriter interface for streaming .
12,204
static SelectStatement forSelection ( CFMetaData cfm , Selection selection ) { return new SelectStatement ( cfm , 0 , defaultParameters , selection , null ) ; }
queried data through processColumnFamily .
12,205
private boolean selectACollection ( ) { if ( ! cfm . comparator . hasCollections ( ) ) return false ; for ( ColumnDefinition def : selection . getColumns ( ) ) { if ( def . type . isCollection ( ) && def . type . isMultiCell ( ) ) return true ; } return false ; }
Returns true if a non - frozen collection is selected false otherwise .
12,206
private static Composite addEOC ( Composite composite , Bound eocBound ) { return eocBound == Bound . END ? composite . end ( ) : composite . start ( ) ; }
Adds an EOC to the specified Composite .
12,207
private static void addValue ( CBuilder builder , ColumnDefinition def , ByteBuffer value ) throws InvalidRequestException { if ( value == null ) throw new InvalidRequestException ( String . format ( "Invalid null value in condition for column %s" , def . name ) ) ; builder . add ( value ) ; }
Adds the specified value to the specified builder
12,208
void processColumnFamily ( ByteBuffer key , ColumnFamily cf , QueryOptions options , long now , Selection . ResultSetBuilder result ) throws InvalidRequestException { CFMetaData cfm = cf . metadata ( ) ; ByteBuffer [ ] keyComponents = null ; if ( cfm . getKeyValidator ( ) instanceof CompositeType ) { keyComponents = ( ...
Used by ModificationStatement for CAS operations
12,209
private boolean isRestrictedByMultipleContains ( ColumnDefinition columnDef ) { if ( ! columnDef . type . isCollection ( ) ) return false ; Restriction restriction = metadataRestrictions . get ( columnDef . name ) ; if ( ! ( restriction instanceof Contains ) ) return false ; Contains contains = ( Contains ) restriction...
Checks if the specified column is restricted by multiple contains or contains key .
12,210
synchronized void requestReport ( CountDownLatch signal ) { if ( finalReport != null ) { report = finalReport ; finalReport = new TimingInterval ( 0 ) ; signal . countDown ( ) ; } else reportRequest = signal ; }
checks to see if the timer is dead ; if not requests a report and otherwise fulfills the request itself
12,211
public synchronized void close ( ) { if ( reportRequest == null ) finalReport = buildReport ( ) ; else { finalReport = new TimingInterval ( 0 ) ; report = buildReport ( ) ; reportRequest . countDown ( ) ; reportRequest = null ; } }
closes the timer ; if a request is outstanding it furnishes the request otherwise it populates finalReport
12,212
public void write ( WritableByteChannel channel ) throws IOException { long totalSize = totalSize ( ) ; RandomAccessReader file = sstable . openDataReader ( ) ; ChecksumValidator validator = new File ( sstable . descriptor . filenameFor ( Component . CRC ) ) . exists ( ) ? DataIntegrityMetadata . checksumValidator ( ss...
Stream file of specified sections to given channel .
12,213
protected long write ( RandomAccessReader reader , ChecksumValidator validator , int start , long length , long bytesTransferred ) throws IOException { int toTransfer = ( int ) Math . min ( transferBuffer . length , length - bytesTransferred ) ; int minReadable = ( int ) Math . min ( transferBuffer . length , reader . ...
Sequentially read bytes from the file and write them to the output stream
12,214
public static long sizeOnHeapOf ( ByteBuffer [ ] array ) { long allElementsSize = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) if ( array [ i ] != null ) allElementsSize += sizeOnHeapOf ( array [ i ] ) ; return allElementsSize + sizeOfArray ( array ) ; }
Memory a ByteBuffer array consumes .
12,215
public static long sizeOnHeapOf ( ByteBuffer buffer ) { if ( buffer . isDirect ( ) ) return BUFFER_EMPTY_SIZE ; if ( buffer . capacity ( ) > buffer . remaining ( ) ) return buffer . remaining ( ) ; return BUFFER_EMPTY_SIZE + sizeOfArray ( buffer . capacity ( ) , 1 ) ; }
Memory a byte buffer consumes
12,216
public static DebuggableThreadPoolExecutor createWithMaximumPoolSize ( String threadPoolName , int size , int keepAliveTime , TimeUnit unit ) { return new DebuggableThreadPoolExecutor ( size , Integer . MAX_VALUE , keepAliveTime , unit , new LinkedBlockingQueue < Runnable > ( ) , new NamedThreadFactory ( threadPoolName...
Returns a ThreadPoolExecutor with a fixed maximum number of threads but whose threads are terminated when idle for too long . When all threads are actively executing tasks new tasks are queued .
12,217
public void execute ( Runnable command ) { super . execute ( isTracing ( ) && ! ( command instanceof TraceSessionWrapper ) ? new TraceSessionWrapper < Object > ( Executors . callable ( command , null ) ) : command ) ; }
execute does not call newTaskFor
12,218
public void executeCLIStatement ( String statement ) throws CharacterCodingException , TException , TimedOutException , NotFoundException , NoSuchFieldException , InvalidRequestException , UnavailableException , InstantiationException , IllegalAccessException { Tree tree = CliCompiler . compileQuery ( statement ) ; try...
Execute a CLI Statement
12,219
private void executeSet ( Tree statement ) throws TException , InvalidRequestException , UnavailableException , TimedOutException { if ( ! CliMain . isConnected ( ) || ! hasKeySpace ( ) ) return ; long startTime = System . nanoTime ( ) ; Tree columnFamilySpec = statement . getChild ( 0 ) ; Tree keyTree = columnFamilySp...
Execute SET statement
12,220
private void executeIncr ( Tree statement , long multiplier ) throws TException , NotFoundException , InvalidRequestException , UnavailableException , TimedOutException { if ( ! CliMain . isConnected ( ) || ! hasKeySpace ( ) ) return ; Tree columnFamilySpec = statement . getChild ( 0 ) ; String columnFamily = CliCompil...
Execute INCR statement
12,221
private void executeAddKeySpace ( Tree statement ) { if ( ! CliMain . isConnected ( ) ) return ; String keyspaceName = CliUtils . unescapeSQLString ( statement . getChild ( 0 ) . getText ( ) ) ; KsDef ksDef = new KsDef ( keyspaceName , DEFAULT_PLACEMENT_STRATEGY , new LinkedList < CfDef > ( ) ) ; try { String mySchemaV...
Add a keyspace
12,222
private void executeAddColumnFamily ( Tree statement ) { if ( ! CliMain . isConnected ( ) || ! hasKeySpace ( ) ) return ; CfDef cfDef = new CfDef ( keySpace , CliUtils . unescapeSQLString ( statement . getChild ( 0 ) . getText ( ) ) ) ; try { String mySchemaVersion = thriftClient . system_add_column_family ( updateCfDe...
Add a column family
12,223
private void executeUpdateKeySpace ( Tree statement ) { if ( ! CliMain . isConnected ( ) ) return ; try { String keyspaceName = CliCompiler . getKeySpace ( statement , thriftClient . describe_keyspaces ( ) ) ; KsDef currentKsDef = getKSMetaData ( keyspaceName ) ; KsDef updatedKsDef = updateKsDefAttributes ( statement ,...
Update existing keyspace identified by name
12,224
private void executeUpdateColumnFamily ( Tree statement ) { if ( ! CliMain . isConnected ( ) || ! hasKeySpace ( ) ) return ; String cfName = CliCompiler . getColumnFamily ( statement , currentCfDefs ( ) ) ; try { CfDef cfDef = getCfDef ( thriftClient . describe_keyspace ( this . keySpace ) , cfName , true ) ; if ( cfDe...
Update existing column family identified by name
12,225
private KsDef updateKsDefAttributes ( Tree statement , KsDef ksDefToUpdate ) { KsDef ksDef = new KsDef ( ksDefToUpdate ) ; ksDef . setCf_defs ( new LinkedList < CfDef > ( ) ) ; for ( int i = 1 ; i < statement . getChildCount ( ) ; i += 2 ) { String currentStatement = statement . getChild ( i ) . getText ( ) . toUpperCa...
Used to update keyspace definition attributes
12,226
private void executeDelKeySpace ( Tree statement ) throws TException , InvalidRequestException , NotFoundException , SchemaDisagreementException { if ( ! CliMain . isConnected ( ) ) return ; String keyspaceName = CliCompiler . getKeySpace ( statement , thriftClient . describe_keyspaces ( ) ) ; String version = thriftCl...
Delete a keyspace
12,227
private void executeDelColumnFamily ( Tree statement ) throws TException , InvalidRequestException , NotFoundException , SchemaDisagreementException { if ( ! CliMain . isConnected ( ) || ! hasKeySpace ( ) ) return ; String cfName = CliCompiler . getColumnFamily ( statement , currentCfDefs ( ) ) ; String mySchemaVersion...
Delete a column family
12,228
private void showKeyspace ( PrintStream output , KsDef ksDef ) { output . append ( "create keyspace " ) . append ( CliUtils . maybeEscapeName ( ksDef . name ) ) ; writeAttr ( output , true , "placement_strategy" , normaliseType ( ksDef . strategy_class , "org.apache.cassandra.locator" ) ) ; if ( ksDef . strategy_option...
Creates a CLI script to create the Keyspace it s Column Families
12,229
private void showColumnMeta ( PrintStream output , CfDef cfDef , ColumnDef colDef ) { output . append ( NEWLINE + TAB + TAB + "{" ) ; final AbstractType < ? > comparator = getFormatType ( cfDef . column_type . equals ( "Super" ) ? cfDef . subcomparator_type : cfDef . comparator_type ) ; output . append ( "column_name :...
Writes the supplied ColumnDef to the StringBuilder as a cli script .
12,230
private boolean hasKeySpace ( boolean printError ) { boolean hasKeyspace = keySpace != null ; if ( ! hasKeyspace && printError ) sessionState . err . println ( "Not authorized to a working keyspace." ) ; return hasKeyspace ; }
Returns true if this . keySpace is set false otherwise
12,231
private IndexType getIndexTypeFromString ( String indexTypeAsString ) { IndexType indexType ; try { indexType = IndexType . findByValue ( new Integer ( indexTypeAsString ) ) ; } catch ( NumberFormatException e ) { try { indexType = IndexType . valueOf ( indexTypeAsString ) ; } catch ( IllegalArgumentException ie ) { th...
Getting IndexType object from indexType string
12,232
private ByteBuffer subColumnNameAsBytes ( String superColumn , String columnFamily ) { CfDef columnFamilyDef = getCfDef ( columnFamily ) ; return subColumnNameAsBytes ( superColumn , columnFamilyDef ) ; }
Converts sub - column name into ByteBuffer according to comparator type
12,233
private ByteBuffer subColumnNameAsBytes ( String superColumn , CfDef columnFamilyDef ) { String comparatorClass = columnFamilyDef . subcomparator_type ; if ( comparatorClass == null ) { sessionState . out . println ( String . format ( "Notice: defaulting to BytesType subcomparator for '%s'" , columnFamilyDef . getName ...
Converts column name into ByteBuffer according to comparator type
12,234
private AbstractType < ? > getValidatorForValue ( CfDef cfDef , byte [ ] columnNameInBytes ) { String defaultValidator = cfDef . default_validation_class ; for ( ColumnDef columnDefinition : cfDef . getColumn_metadata ( ) ) { byte [ ] nameInBytes = columnDefinition . getName ( ) ; if ( Arrays . equals ( nameInBytes , c...
Get validator for specific column value
12,235
public static AbstractType < ? > getTypeByFunction ( String functionName ) { Function function ; try { function = Function . valueOf ( functionName . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { String message = String . format ( "Function '%s' not found. Available functions: %s" , functionName , Functi...
Get AbstractType by function name
12,236
private void updateColumnMetaData ( CfDef columnFamily , ByteBuffer columnName , String validationClass ) { ColumnDef column = getColumnDefByName ( columnFamily , columnName ) ; if ( column != null ) { if ( column . getValidation_class ( ) . equals ( validationClass ) ) return ; column . setValidation_class ( validatio...
Used to locally update column family definition with new column metadata
12,237
private ColumnDef getColumnDefByName ( CfDef columnFamily , ByteBuffer columnName ) { for ( ColumnDef columnDef : columnFamily . getColumn_metadata ( ) ) { byte [ ] currName = columnDef . getName ( ) ; if ( ByteBufferUtil . compare ( currName , columnName ) == 0 ) { return columnDef ; } } return null ; }
Get specific ColumnDef in column family meta data by column name
12,238
private String formatSubcolumnName ( String keyspace , String columnFamily , ByteBuffer name ) { return getFormatType ( getCfDef ( keyspace , columnFamily ) . subcomparator_type ) . getString ( name ) ; }
returns sub - column name in human - readable format
12,239
private String formatColumnName ( String keyspace , String columnFamily , ByteBuffer name ) { return getFormatType ( getCfDef ( keyspace , columnFamily ) . comparator_type ) . getString ( name ) ; }
retuns column name in human - readable format
12,240
private void elapsedTime ( long startTime ) { long eta = System . nanoTime ( ) - startTime ; sessionState . out . print ( "Elapsed time: " ) ; if ( eta < 10000000 ) { sessionState . out . print ( Math . round ( eta / 10000.0 ) / 100.0 ) ; } else { sessionState . out . print ( Math . round ( eta / 1000000.0 ) ) ; } sess...
Print elapsed time . Print 2 fraction digits if eta is under 10 ms .
12,241
public void seek ( long pos ) throws IOException { long inSegmentPos = pos - segmentOffset ; if ( inSegmentPos < 0 || inSegmentPos > buffer . capacity ( ) ) throw new IOException ( String . format ( "Seek position %d is not within mmap segment (seg offs: %d, length: %d)" , pos , segmentOffset , buffer . capacity ( ) ) ...
IOException otherwise .
12,242
public void index ( ByteBuffer key , ColumnFamily columnFamily ) { Log . debug ( "Indexing row %s in index %s " , key , logName ) ; lock . readLock ( ) . lock ( ) ; try { if ( rowService != null ) { long timestamp = System . currentTimeMillis ( ) ; rowService . index ( key , columnFamily , timestamp ) ; } } catch ( Run...
Index the given row .
12,243
public void delete ( DecoratedKey key , OpOrder . Group opGroup ) { Log . debug ( "Removing row %s from index %s" , key , logName ) ; lock . writeLock ( ) . lock ( ) ; try { rowService . delete ( key ) ; rowService = null ; } catch ( RuntimeException e ) { Log . error ( e , "Error deleting row %s" , key ) ; throw e ; }...
cleans up deleted columns from cassandra cleanup compaction
12,244
public void sendTreeRequests ( Collection < InetAddress > endpoints ) { List < InetAddress > allEndpoints = new ArrayList < > ( endpoints ) ; allEndpoints . add ( FBUtilities . getBroadcastAddress ( ) ) ; if ( parallelismDegree != RepairParallelism . PARALLEL ) { List < ListenableFuture < InetAddress > > snapshotTasks ...
Send merkle tree request to every involved neighbor .
12,245
public synchronized int addTree ( InetAddress endpoint , MerkleTree tree ) { try { requestsSent . await ( ) ; } catch ( InterruptedException e ) { throw new AssertionError ( "Interrupted while waiting for requests to be sent" ) ; } if ( tree == null ) failed = true ; else trees . add ( new TreeResponse ( endpoint , tre...
Add a new received tree and return the number of remaining tree to be received for the job to be complete .
12,246
public String getString ( ByteBuffer bytes ) { TypeSerializer < T > serializer = getSerializer ( ) ; serializer . validate ( bytes ) ; return serializer . toString ( serializer . deserialize ( bytes ) ) ; }
get a string representation of the bytes suitable for log messages
12,247
public boolean isValueCompatibleWith ( AbstractType < ? > otherType ) { return isValueCompatibleWithInternal ( ( otherType instanceof ReversedType ) ? ( ( ReversedType ) otherType ) . baseType : otherType ) ; }
Returns true if values of the other AbstractType can be read and reasonably interpreted by the this AbstractType . Note that this is a weaker version of isCompatibleWith as it does not require that both type compare values the same way .
12,248
public int compareCollectionMembers ( ByteBuffer v1 , ByteBuffer v2 , ByteBuffer collectionName ) { return compare ( v1 , v2 ) ; }
An alternative comparison function used by CollectionsType in conjunction with CompositeType .
12,249
private static void writeKey ( PrintStream out , String value ) { writeJSON ( out , value ) ; out . print ( ": " ) ; }
JSON Hash Key serializer
12,250
private static List < Object > serializeColumn ( Cell cell , CFMetaData cfMetaData ) { CellNameType comparator = cfMetaData . comparator ; ArrayList < Object > serializedColumn = new ArrayList < Object > ( ) ; serializedColumn . add ( comparator . getString ( cell . name ( ) ) ) ; if ( cell instanceof DeletedCell ) { s...
Serialize a given cell to a List of Objects that jsonMapper knows how to turn into strings . Format is
12,251
private static void serializeRow ( SSTableIdentityIterator row , DecoratedKey key , PrintStream out ) { serializeRow ( row . getColumnFamily ( ) . deletionInfo ( ) , row , row . getColumnFamily ( ) . metadata ( ) , key , out ) ; }
Get portion of the columns and serialize in loop while not more columns left in the row
12,252
public static void enumeratekeys ( Descriptor desc , PrintStream outs , CFMetaData metadata ) throws IOException { KeyIterator iter = new KeyIterator ( desc ) ; try { DecoratedKey lastKey = null ; while ( iter . hasNext ( ) ) { DecoratedKey key = iter . next ( ) ; if ( lastKey != null && lastKey . compareTo ( key ) > 0...
Enumerate row keys from an SSTableReader and write the result to a PrintStream .
12,253
public static void export ( Descriptor desc , PrintStream outs , Collection < String > toExport , String [ ] excludes , CFMetaData metadata ) throws IOException { SSTableReader sstable = SSTableReader . open ( desc ) ; RandomAccessReader dfile = sstable . openDataReader ( ) ; try { IPartitioner partitioner = sstable . ...
Export specific rows from an SSTable and write the resulting JSON to a PrintStream .
12,254
static void export ( SSTableReader reader , PrintStream outs , String [ ] excludes , CFMetaData metadata ) throws IOException { Set < String > excludeSet = new HashSet < String > ( ) ; if ( excludes != null ) excludeSet = new HashSet < String > ( Arrays . asList ( excludes ) ) ; SSTableIdentityIterator row ; ISSTableSc...
than once from within the same process .
12,255
public static void export ( Descriptor desc , PrintStream outs , String [ ] excludes , CFMetaData metadata ) throws IOException { export ( SSTableReader . open ( desc ) , outs , excludes , metadata ) ; }
Export an SSTable and write the resulting JSON to a PrintStream .
12,256
public static void export ( Descriptor desc , String [ ] excludes , CFMetaData metadata ) throws IOException { export ( desc , System . out , excludes , metadata ) ; }
Export an SSTable and write the resulting JSON to standard out .
12,257
public static void main ( String [ ] args ) throws ConfigurationException { String usage = String . format ( "Usage: %s <sstable> [-k key [-k key [...]] -x key [-x key [...]]]%n" , SSTableExport . class . getName ( ) ) ; CommandLineParser parser = new PosixParser ( ) ; try { cmd = parser . parse ( options , args ) ; } ...
Given arguments specifying an SSTable and optionally an output file export the contents of the SSTable to JSON .
12,258
public SemanticVersion findSupportingVersion ( SemanticVersion ... versions ) { for ( SemanticVersion version : versions ) { if ( isSupportedBy ( version ) ) return version ; } return null ; }
Returns a version that is backward compatible with this version amongst a list of provided version or null if none can be found .
12,259
private Pair < List < SSTableReader > , Multimap < DataTracker , SSTableReader > > getCompactingAndNonCompactingSSTables ( ) { List < SSTableReader > allCompacting = new ArrayList < > ( ) ; Multimap < DataTracker , SSTableReader > allNonCompacting = HashMultimap . create ( ) ; for ( Keyspace ks : Keyspace . all ( ) ) {...
Returns a Pair of all compacting and non - compacting sstables . Non - compacting sstables will be marked as compacting .
12,260
public static List < SSTableReader > redistributeSummaries ( List < SSTableReader > compacting , List < SSTableReader > nonCompacting , long memoryPoolBytes ) throws IOException { long total = 0 ; for ( SSTableReader sstable : Iterables . concat ( compacting , nonCompacting ) ) total += sstable . getIndexSummaryOffHeap...
Attempts to fairly distribute a fixed pool of memory for index summaries across a set of SSTables based on their recent read rates .
12,261
public ByteBuffer getByteBuffer ( ) throws InvalidRequestException { switch ( type ) { case STRING : return AsciiType . instance . fromString ( text ) ; case INTEGER : return IntegerType . instance . fromString ( text ) ; case UUID : return LexicalUUIDType . instance . fromString ( text ) ; case FLOAT : return FloatTyp...
Returns the typed value serialized to a ByteBuffer .
12,262
private boolean selfAssign ( ) { if ( ! get ( ) . canAssign ( true ) ) return false ; for ( SEPExecutor exec : pool . executors ) { if ( exec . takeWorkPermit ( true ) ) { Work work = new Work ( exec ) ; if ( assign ( work , true ) ) return true ; pool . schedule ( work ) ; assert get ( ) . assigned != null ; return tr...
try to assign ourselves an executor with work available
12,263
private void startSpinning ( ) { assert get ( ) == Work . WORKING ; pool . spinningCount . incrementAndGet ( ) ; set ( Work . SPINNING ) ; }
collection at the same time
12,264
private void doWaitSpin ( ) { long sleep = 10000L * pool . spinningCount . get ( ) ; sleep = Math . min ( 1000000 , sleep ) ; sleep *= Math . random ( ) ; sleep = Math . max ( 10000 , sleep ) ; long start = System . nanoTime ( ) ; Long target = start + sleep ; if ( pool . spinning . putIfAbsent ( target , this ) != nul...
perform a sleep - spin incrementing pool . stopCheck accordingly
12,265
private void maybeStop ( long stopCheck , long now ) { long delta = now - stopCheck ; if ( delta <= 0 ) { if ( pool . stopCheck . compareAndSet ( stopCheck , now - stopCheckInterval ) ) { if ( ! assign ( Work . STOP_SIGNALLED , true ) ) pool . schedule ( Work . STOP_SIGNALLED ) ; } } else if ( soleSpinnerSpinTime > sto...
realtime we have spun too much and deschedule ; if we get too far behind realtime we reset to our initial offset
12,266
public List < Row > postReconciliationProcessing ( List < IndexExpression > clause , List < Row > rows ) { return rows ; }
Combines index query results from multiple nodes . This is done by the coordinator node after it has reconciled the replica responses .
12,267
public boolean isIndexBuilt ( ByteBuffer columnName ) { return SystemKeyspace . isIndexBuilt ( baseCfs . keyspace . getName ( ) , getNameForSystemKeyspace ( columnName ) ) ; }
Checks if the index for specified column is fully built
12,268
protected void buildIndexBlocking ( ) { logger . info ( String . format ( "Submitting index build of %s for data in %s" , getIndexName ( ) , StringUtils . join ( baseCfs . getSSTables ( ) , ", " ) ) ) ; try ( Refs < SSTableReader > sstables = baseCfs . selectAndReference ( ColumnFamilyStore . CANONICAL_SSTABLES ) . ref...
Builds the index using the data in the underlying CFS Blocks till it s complete
12,269
public Future < ? > buildIndexAsync ( ) { boolean allAreBuilt = true ; for ( ColumnDefinition cdef : columnDefs ) { if ( ! SystemKeyspace . isIndexBuilt ( baseCfs . keyspace . getName ( ) , getNameForSystemKeyspace ( cdef . name . bytes ) ) ) { allAreBuilt = false ; break ; } } if ( allAreBuilt ) return null ; Runnable...
Builds the index using the data in the underlying CF non blocking
12,270
public DecoratedKey getIndexKeyFor ( ByteBuffer value ) { ByteBuffer name = columnDefs . iterator ( ) . next ( ) . name . bytes ; return new BufferDecoratedKey ( new LocalToken ( baseCfs . metadata . getColumnDefinition ( name ) . type , value ) , value ) ; }
Returns the decoratedKey for a column value
12,271
public static SecondaryIndex createInstance ( ColumnFamilyStore baseCfs , ColumnDefinition cdef ) throws ConfigurationException { SecondaryIndex index ; switch ( cdef . getIndexType ( ) ) { case KEYS : index = new KeysIndex ( ) ; break ; case COMPOSITES : index = CompositesIndex . create ( cdef ) ; break ; case CUSTOM ...
This is the primary way to create a secondary index instance for a CF column . It will validate the index_options before initializing .
12,272
public static CellNameType getIndexComparator ( CFMetaData baseMetadata , ColumnDefinition cdef ) { switch ( cdef . getIndexType ( ) ) { case KEYS : return new SimpleDenseCellNameType ( keyComparator ) ; case COMPOSITES : return CompositesIndex . getIndexComparator ( baseMetadata , cdef ) ; case CUSTOM : return null ; ...
Returns the index comparator for index backed by CFS or null .
12,273
public RepairFuture submitRepairSession ( UUID parentRepairSession , Range < Token > range , String keyspace , RepairParallelism parallelismDegree , Set < InetAddress > endpoints , String ... cfnames ) { if ( cfnames . length == 0 ) return null ; RepairSession session = new RepairSession ( parentRepairSession , range ,...
Requests repairs for the given keyspace and column families .
12,274
public static Set < InetAddress > getNeighbors ( String keyspaceName , Range < Token > toRepair , Collection < String > dataCenters , Collection < String > hosts ) { StorageService ss = StorageService . instance ; Map < Range < Token > , List < InetAddress > > replicaSets = ss . getRangeToAddressMap ( keyspaceName ) ; ...
Return all of the neighbors with whom we share the provided range .
12,275
private static String decodeString ( ByteBuffer src ) throws CharacterCodingException { CharsetDecoder theDecoder = decoder . get ( ) ; theDecoder . reset ( ) ; final CharBuffer dst = CharBuffer . allocate ( ( int ) ( ( double ) src . remaining ( ) * theDecoder . maxCharsPerByte ( ) ) ) ; CoderResult cr = theDecoder . ...
is resolved in a release used by Cassandra .
12,276
public void activate ( ) { String pidFile = System . getProperty ( "cassandra-pidfile" ) ; try { try { MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; mbs . registerMBean ( new StandardMBean ( new NativeAccess ( ) , NativeAccessMBean . class ) , new ObjectName ( MBEAN_NAME ) ) ; } catch ( Exception e...
A convenience method to initialize and start the daemon in one shot .
12,277
protected static String toInternalName ( String name , boolean keepCase ) { return keepCase ? name : name . toLowerCase ( Locale . US ) ; }
Converts the specified name into the name used internally .
12,278
public Node < E > append ( E value , int maxSize ) { Node < E > newTail = new Node < > ( randomLevel ( ) , value ) ; lock . writeLock ( ) . lock ( ) ; try { if ( size >= maxSize ) return null ; size ++ ; Node < E > tail = head ; for ( int i = maxHeight - 1 ; i >= newTail . height ( ) ; i -- ) { Node < E > next ; while ...
regardless of its future position in the list from other modifications
12,279
public void remove ( Node < E > node ) { lock . writeLock ( ) . lock ( ) ; assert node . value != null ; node . value = null ; try { size -- ; for ( int i = 0 ; i < node . height ( ) ; i ++ ) { Node < E > prev = node . prev ( i ) ; Node < E > next = node . next ( i ) ; assert prev != null ; prev . setNext ( i , next ) ...
remove the provided node and its associated value from the list
12,280
public E get ( int index ) { lock . readLock ( ) . lock ( ) ; try { if ( index >= size ) return null ; index ++ ; int c = 0 ; Node < E > finger = head ; for ( int i = maxHeight - 1 ; i >= 0 ; i -- ) { while ( c + finger . size [ i ] <= index ) { c += finger . size [ i ] ; finger = finger . next ( i ) ; } } assert c == ...
retrieve the item at the provided index or return null if the index is past the end of the list
12,281
private boolean isWellFormed ( ) { for ( int i = 0 ; i < maxHeight ; i ++ ) { int c = 0 ; for ( Node node = head ; node != null ; node = node . next ( i ) ) { if ( node . prev ( i ) != null && node . prev ( i ) . next ( i ) != node ) return false ; if ( node . next ( i ) != null && node . next ( i ) . prev ( i ) != nod...
don t create a separate unit test - tools tree doesn t currently warrant them
12,282
public int binarySearch ( RowPosition key ) { int low = 0 , mid = offsetCount , high = mid - 1 , result = - 1 ; while ( low <= high ) { mid = ( low + high ) >> 1 ; result = - DecoratedKey . compareTo ( partitioner , ByteBuffer . wrap ( getKey ( mid ) ) , key ) ; if ( result > 0 ) { low = mid + 1 ; } else if ( result ==...
Harmony s Collections implementation
12,283
public void reloadClasses ( ) { File triggerDirectory = FBUtilities . cassandraTriggerDir ( ) ; if ( triggerDirectory == null ) return ; customClassLoader = new CustomClassLoader ( parent , triggerDirectory ) ; cachedTriggers . clear ( ) ; }
Reload the triggers which is already loaded Invoking this will update the class loader so new jars can be loaded .
12,284
private List < Mutation > executeInternal ( ByteBuffer key , ColumnFamily columnFamily ) { Map < String , TriggerDefinition > triggers = columnFamily . metadata ( ) . getTriggers ( ) ; if ( triggers . isEmpty ( ) ) return null ; List < Mutation > tmutations = Lists . newLinkedList ( ) ; Thread . currentThread ( ) . set...
Switch class loader before using the triggers for the column family if not loaded them with the custom class loader .
12,285
private static CharArraySet getDefaultStopwords ( String language ) { switch ( language ) { case "English" : return EnglishAnalyzer . getDefaultStopSet ( ) ; case "French" : return FrenchAnalyzer . getDefaultStopSet ( ) ; case "Spanish" : return SpanishAnalyzer . getDefaultStopSet ( ) ; case "Portuguese" : return Portu...
Returns the default stopwords set used by Lucene language analyzer for the specified language .
12,286
public static void setInputColumns ( Configuration conf , String columns ) { if ( columns == null || columns . isEmpty ( ) ) return ; conf . set ( INPUT_CQL_COLUMNS_CONFIG , columns ) ; }
Set the CQL columns for the input of this job .
12,287
public static void setInputCQLPageRowSize ( Configuration conf , String cqlPageRowSize ) { if ( cqlPageRowSize == null ) { throw new UnsupportedOperationException ( "cql page row size may not be null" ) ; } conf . set ( INPUT_CQL_PAGE_ROW_SIZE_CONFIG , cqlPageRowSize ) ; }
Set the CQL query Limit for the input of this job .
12,288
public static void setInputWhereClauses ( Configuration conf , String clauses ) { if ( clauses == null || clauses . isEmpty ( ) ) return ; conf . set ( INPUT_CQL_WHERE_CLAUSE_CONFIG , clauses ) ; }
Set the CQL user defined where clauses for the input of this job .
12,289
public static void setOutputCql ( Configuration conf , String cql ) { if ( cql == null || cql . isEmpty ( ) ) return ; conf . set ( OUTPUT_CQL , cql ) ; }
Set the CQL prepared statement for the output of this job .
12,290
public long getTimestamp ( ) { while ( true ) { long current = System . currentTimeMillis ( ) * 1000 ; long last = lastTimestampMicros . get ( ) ; long tstamp = last >= current ? last + 1 : current ; if ( lastTimestampMicros . compareAndSet ( last , tstamp ) ) return tstamp ; } }
This clock guarantees that updates for the same ClientState will be ordered in the sequence seen even if multiple updates happen in the same millisecond .
12,291
public void login ( AuthenticatedUser user ) throws AuthenticationException { if ( ! user . isAnonymous ( ) && ! Auth . isExistingUser ( user . getName ( ) ) ) throw new AuthenticationException ( String . format ( "User %s doesn't exist - create it with CREATE USER query first" , user . getName ( ) ) ) ; this . user = ...
Attempts to login the given user .
12,292
protected static boolean notAllowedStrategy ( DockerSlaveTemplate template ) { if ( isNull ( template ) ) { LOG . debug ( "Skipping DockerProvisioningStrategy because: template is null" ) ; return true ; } final RetentionStrategy retentionStrategy = template . getRetentionStrategy ( ) ; if ( isNull ( retentionStrategy ...
Exclude unknown mix of configuration .
12,293
public void pullImage ( DockerImagePullStrategy pullStrategy , String imageName ) throws InterruptedException { LOG . info ( "Pulling image {} with {} strategy..." , imageName , pullStrategy ) ; final List < Image > images = getDockerCli ( ) . listImagesCmd ( ) . withShowAll ( true ) . exec ( ) ; NameParser . ReposTag ...
Pull docker image on this docker host .
12,294
public String buildImage ( Map < String , File > plugins ) throws IOException , InterruptedException { LOG . debug ( "Building image for {}" , plugins ) ; final File buildDir = new File ( targetDir ( ) . getAbsolutePath ( ) + "/docker-it/build-image" ) ; if ( buildDir . exists ( ) ) { deleteDirectory ( buildDir ) ; } i...
Build docker image containing specified plugins .
12,295
public String runFreshJenkinsContainer ( DockerImagePullStrategy pullStrategy , boolean forceRefresh ) throws IOException , SettingsBuildingException , InterruptedException { LOG . debug ( "Entering run fresh jenkins container." ) ; pullImage ( pullStrategy , JENKINS_DEFAULT . getDockerImageName ( ) ) ; final Map < Str...
Run record and remove after test container with jenkins .
12,296
public String generateDockerfileFor ( Map < String , File > plugins ) throws IOException { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "FROM scratch" ) . append ( NL ) . append ( "MAINTAINER Kanstantsin Shautsou <kanstantsin.sha@gmail.com>" ) . append ( NL ) . append ( "COPY ./ /" ) . append ( NL...
Dockerfile as String based on sratch for placing plugins .
12,297
private DockerCLI createCliWithWait ( URL url , int port ) throws InterruptedException , IOException { DockerCLI tempCli = null ; boolean connected = false ; int i = 0 ; while ( i <= 10 && ! connected ) { i ++ ; try { final CLIConnectionFactory factory = new CLIConnectionFactory ( ) . url ( url ) ; tempCli = new Docker...
Create DockerCLI connection against specified jnlpSlaveAgent port
12,298
@ GuardedBy ( "hudson.model.Queue.lock" ) public long check ( final AbstractCloudComputer c ) { final AbstractCloudSlave computerNode = c . getNode ( ) ; if ( c . isIdle ( ) && computerNode != null ) { final long idleMilliseconds = System . currentTimeMillis ( ) - c . getIdleStartMilliseconds ( ) ; if ( idleMillisecond...
While x - stream serialisation buggy copy implementation .
12,299
public static boolean isSomethingHappening ( Jenkins jenkins ) { if ( ! jenkins . getQueue ( ) . isEmpty ( ) ) return true ; for ( Computer n : jenkins . getComputers ( ) ) if ( ! n . isIdle ( ) ) return true ; return false ; }
Returns true if Hudson is building something or going to build something .