idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
132,000 | 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 .... | allowed to see their own permissions . |
132,001 | 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 {}: {}" , dropped... | Called prior to deleting the user with DROP USER query . Internal hook so no permission checks are needed here . |
132,002 | 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 i... | Submits a non value - returning task for synchronous execution . It waits for all synchronous tasks to be completed . |
132,003 | 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 t... | Get system file descriptor from FileDescriptor object . |
132,004 | public boolean accepts ( OpOrder . Group opGroup , ReplayPosition replayPosition ) { OpOrder . Barrier barrier = this . writeBarrier ; if ( barrier == null ) return true ; if ( ! barrier . isAfter ( opGroup ) ) return false ; if ( replayPosition == null ) return true ; while ( true ) { ReplayPosition currentLast = last... | decide if this memtable should take the write or if it should go to the next memtable |
132,005 | 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 = alloc... | Should only be called by ColumnFamilyStore . apply via Keyspace . apply which supplies the appropriate OpOrdering . |
132,006 | public static void loadSchemas ( boolean updateVersion ) { ColumnFamilyStore schemaCFS = SystemKeyspace . schemaCFS ( SystemKeyspace . SCHEMA_KEYSPACES_CF ) ; if ( schemaCFS . estimateKeys ( ) == 0 ) { logger . info ( "Couldn't detect any schema definitions in local storage." ) ; if ( hasExistingNoSystemTables ( ) ) lo... | Load schema definitions . |
132,007 | 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 ( con... | Creates all storage - related directories . |
132,008 | 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_PROPO... | not part of the Verb enum so we can change timeouts easily via JMX |
132,009 | 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 , localAddre... | Create a socket and connect |
132,010 | public void collateOnDiskAtom ( ColumnFamily returnCF , Iterator < ? extends OnDiskAtom > toCollate , int gcBefore ) { filter . collectReducedColumns ( returnCF , gatherTombstones ( returnCF , toCollate ) , gcBefore , timestamp ) ; } | When there is only a single source of atoms we can skip the collate step |
132,011 | public static QueryFilter getIdentityFilter ( DecoratedKey key , String cfName , long timestamp ) { return new QueryFilter ( key , cfName , new IdentityQueryFilter ( ) , timestamp ) ; } | return a QueryFilter object that includes every column in the row . This is dangerous on large rows ; avoid except for test code . |
132,012 | public Memtable getMemtableFor ( OpOrder . Group opGroup , ReplayPosition replayPosition ) { for ( Memtable memtable : view . get ( ) . liveMemtables ) { if ( memtable . accepts ( opGroup , replayPosition ) ) return memtable ; } throw new AssertionError ( view . get ( ) . liveMemtables . toString ( ) ) ; } | get the Memtable that the ordered writeOp should be directed to |
132,013 | 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 |
132,014 | public void replaceEarlyOpenedFiles ( Collection < SSTableReader > toReplace , Collection < SSTableReader > replaceWith ) { for ( SSTableReader s : toReplace ) assert s . openReason . equals ( SSTableReader . OpenReason . EARLY ) ; replaceReaders ( toReplace , replaceWith , false ) ; } | Adds the early opened files to the data tracker but does not tell compaction strategies about it |
132,015 | 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 . com... | removes all sstables that are not busy compacting . |
132,016 | 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 ) ;... | Removes every SSTable in the directory from the DataTracker s view . |
132,017 | 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 p... | CLI utility methods |
132,018 | public void addComparator ( Comparator < T > comparator , boolean reverse ) { checkLocked ( ) ; comparatorChain . add ( comparator ) ; if ( reverse == true ) { orderingBits . set ( comparatorChain . size ( ) - 1 ) ; } } | Add a Comparator to the end of the chain using the given sortFields order |
132,019 | 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 . |
132,020 | 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 ) ; } } | Replace the Comparator at the given index in the ComparatorChain using the given sortFields order |
132,021 | 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" ) , AbstractReplicationStrat... | Deserialize only Keyspace attributes without nested ColumnFamilies |
132,022 | 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 . va... | Deserialize Keyspace with nested ColumnFamilies |
132,023 | 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 ( Unty... | Deserialize ColumnFamilies from low - level schema representation all of them belong to the same keyspace |
132,024 | 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 A... | merge multiple timer intervals together |
132,025 | 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 ; } | This tombstone supersedes another one if it is more recent and cover a bigger range than rt . |
132,026 | public static String string ( ByteBuffer buffer , int position , int length ) throws CharacterCodingException { return string ( buffer , position , length , StandardCharsets . UTF_8 ) ; } | Decode a String representation . This method assumes that the encoding charset is UTF_8 . |
132,027 | 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 offse... | Compare two ByteBuffer at specified offsets for length . Compares the non equal bytes as unsigned . |
132,028 | public static ByteBuffer minimalBufferFor ( ByteBuffer buf ) { return buf . capacity ( ) > buf . remaining ( ) || ! buf . hasArray ( ) ? ByteBuffer . wrap ( getArray ( buf ) ) : buf ; } | trims size of bytebuffer to exactly number of bytes in it to do not hold too much memory |
132,029 | public static int getShortLength ( ByteBuffer bb , int position ) { int length = ( bb . get ( position ) & 0xFF ) << 8 ; return length | ( bb . get ( position + 1 ) & 0xFF ) ; } | Doesn t change bb position |
132,030 | public ArrayList < InetAddress > getNaturalEndpoints ( RingPosition searchPosition ) { ArrayList < InetAddress > l = new ArrayList < InetAddress > ( 1 ) ; l . add ( FBUtilities . getBroadcastAddress ( ) ) ; return 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 . |
132,031 | 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 ) ; } | This method is used to remove information about truncation time for specified column family |
132,032 | 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 ... | Record tokens being used by another node |
132,033 | 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 |
132,034 | 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 ) ) ; for... | This method is used to update the System Keyspace with the new tokens for this node |
132,035 | 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 ; } | Convenience method to update the list of tokens in the local system keyspace . |
132,036 | 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 ( "to... | Return a map of stored tokens to IP addresses |
132,037 | 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... | Return a map of store host_ids to IP addresses |
132,038 | 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 ( ) . getI... | Get preferred IP for given endpoint if it is known . Otherwise this returns given endpoint itself . |
132,039 | 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 ) ) { InetAddr... | Return a map of IP addresses containing a map of dc and rack info |
132,040 | 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 ; } | Sets the local host ID explicitly . Should only be called outside of SystemTable when replacing a node . |
132,041 | 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 ) ; } | Clears persisted read rates from system . sstable_activity for SSTables that have been deleted . |
132,042 | 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 . inst... | Writes the current partition count and size estimates into SIZE_ESTIMATES_CF |
132,043 | public void maybeAddLatency ( IAsyncCallback cb , InetAddress address , long latency ) { if ( cb . isLatencyForSnitch ( ) ) addLatency ( address , latency ) ; } | Track latency information for the dynamic snitch |
132,044 | public void listen ( InetAddress localEp ) throws ConfigurationException { callbacks . reset ( ) ; for ( ServerSocket ss : getServerSockets ( localEp ) ) { SocketThread th = new SocketThread ( ss , "ACCEPT-" + localEp ) ; th . start ( ) ; socketThreads . add ( th ) ; } listenGate . signalAll ( ) ; } | Listen on the specified port . |
132,045 | 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 . |
132,046 | 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... | Send a non - mutation message to a given endpoint . This method specifies a callback which is invoked with the actual response . |
132,047 | 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 {... | Send a message to a given endpoint . This method adheres to the fire and forget style messaging . |
132,048 | 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 ; } | return the min column |
132,049 | 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 ; } | return the max column |
132,050 | 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 = minColumnName... | Merge 2 lists of min cell name components . |
132,051 | 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 = maxColumnName... | Merge 2 lists of max cell name components . |
132,052 | public static CounterCell createLocal ( CellName name , long value , long timestamp , long timestampOfLastDelete ) { return new BufferCounterCell ( name , contextManager . createLocal ( value ) , timestamp , timestampOfLastDelete ) ; } | For use by tests of compatibility with pre - 2 . 1 counter only . |
132,053 | 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 . ... | Add columns to a column family . |
132,054 | 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 ) ? importSorte... | Convert a JSON formatted file to an SSTable . |
132,055 | private AbstractType < ? > getKeyValidator ( ColumnFamily columnFamily ) { if ( "true" . equals ( System . getProperty ( "skip.key.validator" , "false" ) ) ) { return BytesType . instance ; } return columnFamily . metadata ( ) . getKeyValidator ( ) ; } | Get key validator for column family |
132,056 | 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 ( ... | 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 . |
132,057 | 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 . i... | Store an end - point to host ID mapping . Each ID must be unique and cannot be changed after the fact . |
132,058 | public UUID getHostId ( InetAddress endpoint ) { lock . readLock ( ) . lock ( ) ; try { return endpointToHostIdMap . get ( endpoint ) ; } finally { lock . readLock ( ) . unlock ( ) ; } } | Return the unique host ID for an end - point . |
132,059 | public InetAddress getEndpointForHostId ( UUID hostId ) { lock . readLock ( ) . lock ( ) ; try { return endpointToHostIdMap . inverse ( ) . get ( hostId ) ; } finally { lock . readLock ( ) . unlock ( ) ; } } | Return the end - point for a unique host ID |
132,060 | public void addMovingEndpoint ( Token token , InetAddress endpoint ) { assert endpoint != null ; lock . writeLock ( ) . lock ( ) ; try { movingEndpoints . add ( Pair . create ( token , endpoint ) ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } | Add a new moving endpoint |
132,061 | 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 ( ) ... | Create a copy of TokenMetadata with only tokenToEndpointMap . That is pending ranges bootstrap tokens and leaving endpoints are not included in the copy . |
132,062 | public TokenMetadata cachedOnlyTokenMap ( ) { TokenMetadata tm = cachedTokenMap . get ( ) ; if ( tm != null ) return tm ; synchronized ( this ) { if ( ( tm = cachedTokenMap . get ( ) ) != null ) return tm ; tm = cloneOnlyTokenMap ( ) ; cachedTokenMap . set ( tm ) ; return tm ; } } | 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 . |
132,063 | public TokenMetadata cloneAfterAllLeft ( ) { lock . readLock ( ) . lock ( ) ; try { TokenMetadata allLeftMetadata = cloneOnlyTokenMap ( ) ; for ( InetAddress endpoint : leavingEndpoints ) allLeftMetadata . removeEndpoint ( endpoint ) ; return allLeftMetadata ; } finally { lock . readLock ( ) . unlock ( ) ; } } | Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave operations have finished . |
132,064 | 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... | Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all current leave and move operations have finished . |
132,065 | 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 ) ) { fi... | Updates the moving averages as needed . |
132,066 | public synchronized void beginSampling ( int capacity ) { if ( ! enabled ) { summary = new StreamSummary < T > ( capacity ) ; hll = new HyperLogLogPlus ( 14 ) ; enabled = true ; } } | Start to record samples |
132,067 | 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... | Call to stop collecting samples and gather the results |
132,068 | 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 ( ) { synchronized ( lock ) { if ( enabled ) { try { summary . offer ( item , value ) ; hll . offerHashed ( hash ) ; } catch ( Exception... | 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 |
132,069 | public Tuple getNext ( ) throws IOException { try { 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 ( ) ) ; Iter... | get next row |
132,070 | private Object cqlColumnToObj ( Cell col , CfDef cfDef ) throws IOException { Map < ByteBuffer , AbstractType > validators = getValidatorMap ( cfDef ) ; ByteBuffer cellName = col . name ( ) . toByteBuffer ( ) ; if ( validators . get ( cellName ) == null ) return cassandraToObj ( getDefaultMarshallers ( cfDef ) . get ( ... | convert a cql column to an object |
132,071 | protected List < ColumnDef > getColumnMetadata ( Cassandra . Client client ) throws InvalidRequestException , UnavailableException , TimedOutException , SchemaDisagreementException , TException , CharacterCodingException , org . apache . cassandra . exceptions . InvalidRequestException , ConfigurationException , NotFou... | include key columns |
132,072 | 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 ... | convert key tuple to key map |
132,073 | 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 = bin... | send CQL query request using data from tuple |
132,074 | 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 ; } | compose a list of binded variables |
132,075 | private void sendCqlQuery ( Map < String , ByteBuffer > key , List < ByteBuffer > bindedVariables ) throws IOException { try { writer . write ( key , bindedVariables ) ; } catch ( InterruptedException e ) { throw new IOException ( e ) ; } } | writer write the data by executing CQL query |
132,076 | private String getWhereClauseForPartitionFilter ( ) { UDFContext context = UDFContext . getUDFContext ( ) ; Properties property = context . getUDFProperties ( AbstractCassandraStorage . class ) ; return property . getProperty ( PARTITION_FILTER_SIGNATURE ) ; } | retrieve where clause for partition filter |
132,077 | 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 ) ; } | Convert a byte array containing the most significant of sigbytes bytes representing a big - endian magnitude into a BigInteger . |
132,078 | public static void shutdownNow ( ) { for ( Stage stage : Stage . values ( ) ) { StageManager . stages . get ( stage ) . shutdownNow ( ) ; } } | This method shuts down all registered stages . |
132,079 | 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 ... | Given two bit arrays represented as BigIntegers containing the given number of significant bits calculate a midpoint . |
132,080 | 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 constru... | Constructs an instance of the given class which must have a no - arg or default constructor . |
132,081 | 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 . ... | Starts and waits for the given |
132,082 | public static void removeUnreadableSSTables ( File directory ) { for ( Keyspace keyspace : Keyspace . all ( ) ) { for ( ColumnFamilyStore baseCfs : keyspace . getColumnFamilyStores ( ) ) { for ( ColumnFamilyStore cfs : baseCfs . concatWithIndexes ( ) ) cfs . maybeRemoveUnreadableSSTables ( directory ) ; } } } | Removes every SSTable in the directory from the appropriate DataTracker s view . |
132,083 | 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 = ... | Take a snapshot of the specific column family or the entire set of column families if columnFamily is null with a given timestamp |
132,084 | public boolean snapshotExists ( String snapshotName ) { assert snapshotName != null ; for ( ColumnFamilyStore cfStore : columnFamilyStores . values ( ) ) { if ( cfStore . snapshotExists ( snapshotName ) ) return true ; } return false ; } | Check whether snapshots already exists for a given name . |
132,085 | public static void clearSnapshot ( String snapshotName , String keyspace ) { List < File > snapshotDirs = Directories . getKSChildDirectories ( keyspace ) ; Directories . clearSnapshot ( snapshotName , snapshotDirs ) ; } | Clear all the snapshots for a given keyspace . |
132,086 | public void dropCf ( UUID cfId ) { assert columnFamilyStores . containsKey ( cfId ) ; ColumnFamilyStore cfs = columnFamilyStores . remove ( cfId ) ; if ( cfs == null ) return ; cfs . keyspace . writeOrder . awaitNewBarrier ( ) ; cfs . readOrdering . awaitNewBarrier ( ) ; unloadCf ( cfs ) ; } | best invoked on the compaction mananger . |
132,087 | public void initCf ( UUID cfId , String cfName , boolean loadSSTables ) { ColumnFamilyStore cfs = columnFamilyStores . get ( cfId ) ; if ( cfs == null ) { ColumnFamilyStore oldCfs = columnFamilyStores . putIfAbsent ( cfId , ColumnFamilyStore . createColumnFamilyStore ( this , cfName , loadSSTables ) ) ; if ( oldCfs != ... | adds a cf to internal structures ends up creating disk files ) . |
132,088 | public void apply ( Mutation mutation , boolean writeCommitLog , boolean updateIndexes ) { try ( OpOrder . Group opGroup = writeOrder . start ( ) ) { ReplayPosition replayPosition = null ; if ( writeCommitLog ) { Tracing . trace ( "Appending to commitlog" ) ; replayPosition = CommitLog . instance . add ( mutation ) ; }... | This method appends a row to the global CommitLog then updates memtables and indexes . |
132,089 | public static Function . Factory factory ( final Function fun ) { return new Function . Factory ( ) { public Function create ( String ksName , String cfName ) { return fun ; } } ; } | Creates a trivial factory that always return the provided function . |
132,090 | private void initSocket ( ) { socket = new Socket ( ) ; try { socket . setSoLinger ( false , 0 ) ; socket . setTcpNoDelay ( true ) ; socket . setSoTimeout ( timeout ) ; } catch ( SocketException sx ) { LOGGER . error ( "Could not configure socket." , sx ) ; } } | Initializes the socket object |
132,091 | public void setTimeout ( int timeout ) { this . timeout = timeout ; try { socket . setSoTimeout ( timeout ) ; } catch ( SocketException sx ) { LOGGER . warn ( "Could not set socket timeout." , sx ) ; } } | Sets the socket timeout |
132,092 | public void open ( ) throws TTransportException { if ( isOpen ( ) ) { throw new TTransportException ( TTransportException . ALREADY_OPEN , "Socket already connected." ) ; } if ( host . length ( ) == 0 ) { throw new TTransportException ( TTransportException . NOT_OPEN , "Cannot open null host." ) ; } if ( port <= 0 ) { ... | Connects the socket creating a new socket object if necessary . |
132,093 | public ByteBuffer [ ] split ( ByteBuffer name ) { List < ByteBuffer > l = new ArrayList < ByteBuffer > ( ) ; ByteBuffer bb = name . duplicate ( ) ; readIsStatic ( bb ) ; int i = 0 ; while ( bb . remaining ( ) > 0 ) { getComparator ( i ++ , bb ) ; l . add ( ByteBufferUtil . readBytesWithShortLength ( bb ) ) ; bb . get (... | Split a composite column names into it s components . |
132,094 | public static < K extends IMeasurableMemory , V extends IMeasurableMemory > ConcurrentLinkedHashCache < K , V > create ( long weightedCapacity , EntryWeigher < K , V > entryWeiger ) { ConcurrentLinkedHashMap < K , V > map = new ConcurrentLinkedHashMap . Builder < K , V > ( ) . weigher ( entryWeiger ) . maximumWeightedC... | Initialize a cache with initial capacity with weightedCapacity |
132,095 | public void onSuccess ( StreamState state ) { logger . info ( String . format ( "[repair #%s] streaming task succeed, returning response to %s" , desc . sessionId , request . initiator ) ) ; MessagingService . instance ( ) . sendOneWay ( new SyncComplete ( desc , request . src , request . dst , true ) . createMessage (... | If we succeeded on both stream in and out reply back to the initiator . |
132,096 | public void onFailure ( Throwable t ) { MessagingService . instance ( ) . sendOneWay ( new SyncComplete ( desc , request . src , request . dst , false ) . createMessage ( ) , request . initiator ) ; } | If we failed on either stream in or out reply fail to the initiator . |
132,097 | public ByteBuffer createLocal ( long count ) { ContextState state = ContextState . allocate ( 0 , 1 , 0 ) ; state . writeLocal ( CounterId . getLocalId ( ) , 1L , count ) ; return state . context ; } | Creates a counter context with a single local shard . For use by tests of compatibility with pre - 2 . 1 counters only . |
132,098 | public ByteBuffer createRemote ( CounterId id , long clock , long count ) { ContextState state = ContextState . allocate ( 0 , 0 , 1 ) ; state . writeRemote ( id , clock , count ) ; return state . context ; } | Creates a counter context with a single remote shard . For use by tests of compatibility with pre - 2 . 1 counters only . |
132,099 | public Relationship diff ( ByteBuffer left , ByteBuffer right ) { Relationship relationship = Relationship . EQUAL ; ContextState leftState = ContextState . wrap ( left ) ; ContextState rightState = ContextState . wrap ( right ) ; while ( leftState . hasRemaining ( ) && rightState . hasRemaining ( ) ) { int compareId =... | Determine the count relationship between two contexts . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.