idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
155,400
public void writeAll ( java . sql . ResultSet rs , boolean includeColumnNames ) throws SQLException , IOException { if ( includeColumnNames ) { writeColumnNames ( rs ) ; } while ( rs . next ( ) ) { writeNext ( resultService . getColumnValues ( rs ) ) ; } }
Writes the entire ResultSet to a CSV file .
67
11
155,401
public void addRecord ( String key , String value ) throws TarMalformatException , IOException { if ( key == null || value == null || key . length ( ) < 1 || value . length ( ) < 1 ) { throw new TarMalformatException ( RB . singleton . getString ( RB . ZERO_WRITE ) ) ; } int lenWithoutIlen = key . length ( ) + value . ...
I guess the initial length field is supposed to be in units of characters not bytes?
366
17
155,402
synchronized public void shutdown ( ) { m_shutdown . set ( true ) ; if ( m_isExecutorServiceLocal ) { try { m_es . shutdown ( ) ; m_es . awaitTermination ( 365 , TimeUnit . DAYS ) ; } catch ( InterruptedException e ) { repairLog . warn ( "Unexpected interrupted exception" , e ) ; } } }
shutdown silences the babysitter and causes watches to not reset . Note that shutting down will churn ephemeral ZK nodes - shutdown allows the programmer to not set watches on nodes from terminated session .
84
41
155,403
public static Pair < BabySitter , List < String > > blockingFactory ( ZooKeeper zk , String dir , Callback cb ) throws InterruptedException , ExecutionException { ExecutorService es = CoreUtils . getCachedSingleThreadExecutor ( "Babysitter-" + dir , 15000 ) ; Pair < BabySitter , List < String > > babySitter = blockingF...
Create a new BabySitter and block on reading the initial children list .
122
15
155,404
public static Pair < BabySitter , List < String > > blockingFactory ( ZooKeeper zk , String dir , Callback cb , ExecutorService es ) throws InterruptedException , ExecutionException { BabySitter bs = new BabySitter ( zk , dir , cb , es ) ; List < String > initialChildren ; try { initialChildren = bs . m_eventHandler . ...
Create a new BabySitter and block on reading the initial children list . Use the provided ExecutorService to queue events to rather than creating a private ExecutorService . The initial set of children will be retrieved in the current thread and not the ExecutorService because it is assumed this is being called from th...
127
65
155,405
public static BabySitter nonblockingFactory ( ZooKeeper zk , String dir , Callback cb , ExecutorService es ) throws InterruptedException , ExecutionException { BabySitter bs = new BabySitter ( zk , dir , cb , es ) ; bs . m_es . submit ( bs . m_eventHandler ) ; return bs ; }
Create a new BabySitter and make sure it reads the initial children list . Use the provided ExecutorService to queue events to rather than creating a private ExecutorService .
81
35
155,406
void checkClosed ( ) throws SQLException { if ( isClosed ) { throw Util . sqlException ( ErrorCode . X_07501 ) ; } if ( connection . isClosed ) { close ( ) ; throw Util . sqlException ( ErrorCode . X_08503 ) ; } }
An internal check for closed statements .
67
7
155,407
void performPostExecute ( ) throws SQLException { resultOut . clearLobResults ( ) ; generatedResult = null ; if ( resultIn == null ) { return ; } Result current = resultIn ; while ( current . getChainedResult ( ) != null ) { current = current . getUnlinkChainedResult ( ) ; if ( current . getType ( ) == ResultConstants ...
processes chained warnings and any generated columns result set
222
10
155,408
boolean getMoreResults ( int current ) throws SQLException { checkClosed ( ) ; if ( resultIn == null || ! resultIn . isData ( ) ) { return false ; } if ( resultSetCounter == 0 ) { resultSetCounter ++ ; return true ; } if ( currentResultSet != null && current != KEEP_CURRENT_RESULT ) { currentResultSet . close ( ) ; } r...
Note yet correct for multiple ResultSets . Should keep track of the previous ResultSet objects to be able to close them
98
24
155,409
void closeResultData ( ) throws SQLException { if ( currentResultSet != null ) { currentResultSet . close ( ) ; } if ( generatedResultSet != null ) { generatedResultSet . close ( ) ; } generatedResultSet = null ; generatedResult = null ; resultIn = null ; }
See comment for getMoreResults .
65
7
155,410
public boolean compatibleWithTable ( VoltTable table ) { String candidateName = getTableName ( table ) ; // table can't have the same name as the view if ( candidateName . equals ( viewName ) ) { return false ; } // view is for a different table if ( candidateName . equals ( srcTableName ) == false ) { return false ; }...
Check if the view could apply to the provided table unchanged .
269
12
155,411
@ Beta @ GwtIncompatible // concurrency public static ThreadFactory platformThreadFactory ( ) { if ( ! isAppEngine ( ) ) { return Executors . defaultThreadFactory ( ) ; } try { return ( ThreadFactory ) Class . forName ( "com.google_voltpatches.appengine.api.ThreadManager" ) . getMethod ( "currentRequestThreadFactory" )...
Returns a default thread factory used to create new threads .
210
11
155,412
public static void verifySnapshots ( final List < String > directories , final Set < String > snapshotNames ) { FileFilter filter = new SnapshotFilter ( ) ; if ( ! snapshotNames . isEmpty ( ) ) { filter = new SpecificSnapshotFilter ( snapshotNames ) ; } Map < String , Snapshot > snapshots = new HashMap < String , Snaps...
Perform snapshot verification .
213
5
155,413
public long lowestEquivalentValue ( final long value ) { final int bucketIndex = getBucketIndex ( value ) ; final int subBucketIndex = getSubBucketIndex ( value , bucketIndex ) ; long thisValueBaseLevel = valueFromIndex ( bucketIndex , subBucketIndex ) ; return thisValueBaseLevel ; }
Get the lowest value that is equivalent to the given value within the histogram s resolution . Where equivalent means that value samples recorded for any two equivalent values are counted in a common total count .
70
38
155,414
public double getMean ( ) { if ( getTotalCount ( ) == 0 ) { return 0.0 ; } recordedValuesIterator . reset ( ) ; double totalValue = 0 ; while ( recordedValuesIterator . hasNext ( ) ) { HistogramIterationValue iterationValue = recordedValuesIterator . next ( ) ; totalValue += medianEquivalentValue ( iterationValue . get...
Get the computed mean value of all recorded values in the histogram
118
13
155,415
public double getStdDeviation ( ) { if ( getTotalCount ( ) == 0 ) { return 0.0 ; } final double mean = getMean ( ) ; double geometric_deviation_total = 0.0 ; recordedValuesIterator . reset ( ) ; while ( recordedValuesIterator . hasNext ( ) ) { HistogramIterationValue iterationValue = recordedValuesIterator . next ( ) ;...
Get the computed standard deviation of all recorded values in the histogram
173
13
155,416
public void reestablishTotalCount ( ) { // On overflow, the totalCount accumulated counter will (always) not match the total of counts long totalCounted = 0 ; for ( int i = 0 ; i < countsArrayLength ; i ++ ) { totalCounted += getCountAtIndex ( i ) ; } setTotalCount ( totalCounted ) ; }
Reestablish the internal notion of totalCount by recalculating it from recorded values .
75
17
155,417
static void setTableColumnsForSubquery ( Table table , QueryExpression queryExpression , boolean fullIndex ) { table . columnList = queryExpression . getColumns ( ) ; table . columnCount = queryExpression . getColumnCount ( ) ; table . createPrimaryKey ( ) ; if ( fullIndex ) { int [ ] colIndexes = null ; colIndexes = t...
For table subqueries
124
5
155,418
public void considerCandidatePlan ( CompiledPlan plan , AbstractParsedStmt parsedStmt ) { //System.out.println(String.format("[Raw plan]:%n%s", rawplan.rootPlanGraph.toExplainPlanString())); // run the set of microptimizations, which may return many plans (or not) ScanDeterminizer . apply ( plan , m_detMode ) ; // add ...
Picks the best cost plan for a given raw plan
345
11
155,419
public static PartitionDRGateway getInstance ( int partitionId , ProducerDRGateway producerGateway , StartAction startAction ) { // if this is a primary cluster in a DR-enabled scenario // try to load the real version of this class PartitionDRGateway pdrg = null ; if ( producerGateway != null ) { pdrg = tryToLoadProVer...
Load the full subclass if it should otherwise load the noop stub .
272
14
155,420
public String [ ] getUserPermissionList ( String userName ) { if ( ! m_enabled ) { return m_perm_list ; } if ( userName == null ) { return new String [ ] { } ; } AuthUser user = getUser ( userName ) ; if ( user == null ) { return new String [ ] { } ; } return user . m_permissions_list ; }
Get users permission list not god for permission checking .
86
10
155,421
public void callProcedure ( AuthUser user , boolean isAdmin , int timeout , ProcedureCallback cb , String procName , Object [ ] args ) { // since we know the caller, this is safe assert ( cb != null ) ; StoredProcedureInvocation task = new StoredProcedureInvocation ( ) ; task . setProcName ( procName ) ; task . setPara...
Used to call a procedure from NTPRocedureRunner Calls createTransaction with the proper params
354
19
155,422
public static void printSystemOut ( String message1 , long message2 ) { if ( TRACESYSTEMOUT ) { System . out . print ( message1 ) ; System . out . println ( message2 ) ; } }
Used to print messages to System . out
48
8
155,423
public static boolean acceptsPrecision ( int type ) { switch ( type ) { case Types . SQL_BINARY : case Types . SQL_BIT : case Types . SQL_BIT_VARYING : case Types . SQL_BLOB : case Types . SQL_CHAR : case Types . SQL_NCHAR : case Types . SQL_CLOB : case Types . NCLOB : case Types . SQL_VARBINARY : case Types . SQL_VARC...
Types that accept precision params in column definition or casts . CHAR VARCHAR and VARCHAR_IGNORECASE params are ignored when the sql . enforce_strict_types is false .
361
40
155,424
public static < T > Iterable < T > cycle ( T ... elements ) { return cycle ( Lists . newArrayList ( elements ) ) ; }
Returns an iterable whose iterators cycle indefinitely over the provided elements .
31
14
155,425
@ Override protected void coreLoadCatalog ( long timestamp , final byte [ ] catalogBytes ) throws EEException { LOG . trace ( "Loading Application Catalog..." ) ; int errorCode = 0 ; errorCode = nativeLoadCatalog ( pointer , timestamp , catalogBytes ) ; checkErrorCode ( errorCode ) ; //LOG.info("Loaded Catalog."); }
Provide a serialized catalog and initialize version 0 of the engine s catalog .
74
16
155,426
@ Override public void coreUpdateCatalog ( long timestamp , boolean isStreamUpdate , final String catalogDiffs ) throws EEException { LOG . trace ( "Loading Application Catalog..." ) ; int errorCode = 0 ; errorCode = nativeUpdateCatalog ( pointer , timestamp , isStreamUpdate , getStringBytes ( catalogDiffs ) ) ; checkE...
Provide a catalog diff and a new catalog version and update the engine s catalog .
78
17
155,427
@ Override public int extractPerFragmentStats ( int batchSize , long [ ] executionTimesOut ) { m_perFragmentStatsBuffer . clear ( ) ; // Discard the first byte since it is the timing on/off switch. m_perFragmentStatsBuffer . get ( ) ; int succeededFragmentsCount = m_perFragmentStatsBuffer . getInt ( ) ; if ( executionT...
Extract the per - fragment stats from the buffer .
200
11
155,428
@ Override public VoltTable [ ] getStats ( final StatsSelector selector , final int locators [ ] , final boolean interval , final Long now ) { //Clear is destructive, do it before the native call m_nextDeserializer . clear ( ) ; final int numResults = nativeGetStats ( pointer , selector . ordinal ( ) , locators , inter...
Retrieve a set of statistics using the specified selector from the StatisticsSelector enum .
319
17
155,429
public boolean storeLargeTempTableBlock ( long siteId , long blockCounter , ByteBuffer block ) { LargeBlockTask task = LargeBlockTask . getStoreTask ( new BlockId ( siteId , blockCounter ) , block ) ; return executeLargeBlockTaskSynchronously ( task ) ; }
Store a large temp table block to disk .
61
9
155,430
public boolean loadLargeTempTableBlock ( long siteId , long blockCounter , ByteBuffer block ) { LargeBlockTask task = LargeBlockTask . getLoadTask ( new BlockId ( siteId , blockCounter ) , block ) ; return executeLargeBlockTaskSynchronously ( task ) ; }
Read a large table block from disk and write it to a ByteBuffer . Block will still be stored on disk when this operation completes .
61
27
155,431
public boolean releaseLargeTempTableBlock ( long siteId , long blockCounter ) { LargeBlockTask task = LargeBlockTask . getReleaseTask ( new BlockId ( siteId , blockCounter ) ) ; return executeLargeBlockTaskSynchronously ( task ) ; }
Delete the block with the given id from disk .
55
10
155,432
public List < String > getSQLStatements ( ) { List < String > sqlStatements = new ArrayList <> ( plannedStatements . size ( ) ) ; for ( AdHocPlannedStatement plannedStatement : plannedStatements ) { sqlStatements . add ( new String ( plannedStatement . sql , Constants . UTF8ENCODING ) ) ; } return sqlStatements ; }
Retrieve all the SQL statement text as a list of strings .
83
13
155,433
public boolean isSinglePartitionCompatible ( ) { for ( AdHocPlannedStatement plannedStmt : plannedStatements ) { if ( plannedStmt . core . collectorFragment != null ) { return false ; } } return true ; }
Detect if batch is compatible with single partition optimizations
52
9
155,434
public ByteBuffer flattenPlanArrayToBuffer ( ) throws IOException { int size = 0 ; // sizeof batch ParameterSet userParamCache = null ; if ( userParamSet == null ) { userParamCache = ParameterSet . emptyParameterSet ( ) ; } else { Object [ ] typedUserParams = new Object [ userParamSet . length ] ; int ii = 0 ; for ( Ad...
For convenience serialization is accomplished with this single method but deserialization is piecemeal via the static methods userParamsFromBuffer and planArrayFromBuffer with no dummy AdHocPlannedStmtBatch receiver instance required .
525
47
155,435
public String explainStatement ( int i , Database db , boolean getJSONString ) { AdHocPlannedStatement plannedStatement = plannedStatements . get ( i ) ; String aggplan = new String ( plannedStatement . core . aggregatorFragment , Constants . UTF8ENCODING ) ; PlanNodeTree pnt = new PlanNodeTree ( ) ; try { String resul...
Return the EXPLAIN string of the batched statement at the index
360
14
155,436
public synchronized static AdHocCompilerCache getCacheForCatalogHash ( byte [ ] catalogHash ) { String hashString = Encoder . hexEncode ( catalogHash ) ; AdHocCompilerCache cache = m_catalogHashMatch . getIfPresent ( hashString ) ; if ( cache == null ) { cache = new AdHocCompilerCache ( ) ; m_catalogHashMatch . put ( h...
Get the global cache for a given hash of the catalog . Note that there can be only one cache per catalogHash at a time .
99
27
155,437
synchronized void printStats ( ) { String line1 = String . format ( "CACHE STATS - Literals: Hits %d/%d (%.1f%%), Inserts %d Evictions %d\n" , m_literalHits , m_literalQueries , ( m_literalHits * 100.0 ) / m_literalQueries , m_literalInsertions , m_literalEvictions ) ; String line2 = String . format ( "CACHE STATS - Pl...
Stats printing method used during development . Probably shouldn t live past real stats integration .
275
16
155,438
public synchronized void put ( String sql , String parsedToken , AdHocPlannedStatement planIn , String [ ] extractedLiterals , boolean hasUserQuestionMarkParameters , boolean hasAutoParameterizedException ) { assert ( sql != null ) ; assert ( parsedToken != null ) ; assert ( planIn != null ) ; AdHocPlannedStatement pla...
Called from the PlannerTool directly when it finishes planning . This is the only way to populate the cache .
689
23
155,439
public void startPeriodicStatsPrinting ( ) { if ( m_statsTimer == null ) { m_statsTimer = new Timer ( ) ; m_statsTimer . scheduleAtFixedRate ( new TimerTask ( ) { @ Override public void run ( ) { printStats ( ) ; } } , 5000 , 5000 ) ; } }
Start a timer that prints cache stats to the console every 5s . Used for development until we get better stats integration .
74
24
155,440
@ Override public Date getDate ( int parameterIndex , Calendar cal ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves the value of the designated JDBC DATE parameter as a java . sql . Date object using the given Calendar object to construct the date .
39
31
155,441
@ Override public Date getDate ( String parameterName , Calendar cal ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves the value of a JDBC DATE parameter as a java . sql . Date object using the given Calendar object to construct the date .
39
30
155,442
@ Override public Object getObject ( String parameterName , Map < String , Class < ? > > map ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Returns an object representing the value of OUT parameter parameterName and uses map for the custom mapping of the parameter value .
47
23
155,443
@ Override public Time getTime ( int parameterIndex , Calendar cal ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves the value of the designated JDBC TIME parameter as a java . sql . Time object using the given Calendar object to construct the time .
39
30
155,444
@ Override public Time getTime ( String parameterName , Calendar cal ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves the value of a JDBC TIME parameter as a java . sql . Time object using the given Calendar object to construct the time .
39
29
155,445
@ Override public Timestamp getTimestamp ( int parameterIndex , Calendar cal ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves the value of the designated JDBC TIMESTAMP parameter as a java . sql . Timestamp object using the given Calendar object to construct the Timestamp object .
41
35
155,446
@ Override public Timestamp getTimestamp ( String parameterName , Calendar cal ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves the value of a JDBC TIMESTAMP parameter as a java . sql . Timestamp object using the given Calendar object to construct the Timestamp object .
41
34
155,447
@ Override public void registerOutParameter ( String parameterName , int sqlType , int scale ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Registers the parameter named parameterName to be of JDBC type sqlType .
44
16
155,448
@ Override public void setNString ( String parameterName , String value ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Sets the designated parameter to the given String object .
40
11
155,449
@ Override public void setURL ( String parameterName , URL val ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Sets the designated parameter to the given java . net . URL object .
39
15
155,450
public static String suffixHSIdsWithMigratePartitionLeaderRequest ( Long HSId ) { return Long . toString ( Long . MAX_VALUE ) + "/" + Long . toString ( HSId ) + migrate_partition_leader_suffix ; }
Generate a HSID string with BALANCE_SPI_SUFFIX information . When this string is updated we can tell the reason why HSID is changed .
56
34
155,451
public void startPartitionWatch ( ) throws InterruptedException , ExecutionException { Future < ? > task = m_es . submit ( new PartitionWatchEvent ( ) ) ; task . get ( ) ; }
Initialized and start watching partition level cache this function is blocking .
44
12
155,452
private void processPartitionWatchEvent ( ) throws KeeperException , InterruptedException { try { m_zk . create ( m_rootNode , null , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; m_zk . getData ( m_rootNode , m_childWatch , null ) ; } catch ( KeeperException . NodeExistsException e ) { m_zk . getData ( m_rootNod...
Race to create partition - specific zk node and put a watch on it .
111
16
155,453
public Object convertToDefaultType ( SessionInterface session , Object a ) { if ( a == null ) { return a ; } Type otherType ; if ( a instanceof Number ) { if ( a instanceof BigInteger ) { a = new BigDecimal ( ( BigInteger ) a ) ; } else if ( a instanceof Float ) { a = new Double ( ( ( Float ) a ) . doubleValue ( ) ) ; ...
Converts a value to this type
658
7
155,454
private static Double convertToDouble ( Object a ) { double value ; if ( a instanceof java . lang . Double ) { return ( Double ) a ; } else if ( a instanceof BigDecimal ) { BigDecimal bd = ( BigDecimal ) a ; value = bd . doubleValue ( ) ; int signum = bd . signum ( ) ; BigDecimal bdd = new BigDecimal ( value + signum )...
Converter from a numeric object to Double . Input is checked to be within range represented by Double
165
20
155,455
public Object mod ( Object a , Object b ) { if ( a == null || b == null ) { return null ; } switch ( typeCode ) { case Types . SQL_REAL : case Types . SQL_FLOAT : case Types . SQL_DOUBLE : { double ad = ( ( Number ) a ) . doubleValue ( ) ; double bd = ( ( Number ) b ) . doubleValue ( ) ; if ( bd == 0 ) { throw Error . ...
A VoltDB extension
397
4
155,456
public synchronized void write ( int c ) throws IOException { checkClosed ( ) ; int newcount = count + 1 ; if ( newcount > buf . length ) { buf = copyOf ( buf , Math . max ( buf . length << 1 , newcount ) ) ; } buf [ count ] = ( char ) c ; count = newcount ; }
Writes the specified single character .
75
7
155,457
private void initiateSPIMigrationIfRequested ( Iv2InitiateTaskMessage msg ) { if ( ! "@MigratePartitionLeader" . equals ( msg . getStoredProcedureName ( ) ) ) { return ; } final Object [ ] params = msg . getParameters ( ) ; int pid = Integer . parseInt ( params [ 1 ] . toString ( ) ) ; if ( pid != m_partitionId ) { tmL...
rerouted from this moment on until the transactions are correctly routed to new leader .
566
16
155,458
private boolean checkMisroutedIv2IntiateTaskMessage ( Iv2InitiateTaskMessage message ) { if ( message . isForReplica ( ) ) { return false ; } if ( m_scheduler . isLeader ( ) && m_migratePartitionLeaderStatus != MigratePartitionLeaderStatus . TXN_RESTART ) { //At this point, the message is sent to partition leader retur...
if these requests are intended for leader . Client interface will restart these transactions .
348
15
155,459
private boolean checkMisroutedFragmentTaskMessage ( FragmentTaskMessage message ) { if ( m_scheduler . isLeader ( ) || message . isForReplica ( ) ) { return false ; } TransactionState txnState = ( ( ( SpScheduler ) m_scheduler ) . getTransactionState ( message . getTxnId ( ) ) ) ; // If a fragment is part of a transact...
After MigratePartitionLeader has been requested the fragments which are sent to leader site should be restarted .
436
22
155,460
private void handleLogRequest ( VoltMessage message ) { Iv2RepairLogRequestMessage req = ( Iv2RepairLogRequestMessage ) message ; // It is possible for a dead host to queue messages after a repair request is processed // so make sure this can't happen by re-queuing this message after we know the dead host is gone // Si...
Produce the repair log . This is idempotent .
484
13
155,461
private void setMigratePartitionLeaderStatus ( MigratePartitionLeaderMessage message ) { //The host with old partition leader is down. if ( message . isStatusReset ( ) ) { m_migratePartitionLeaderStatus = MigratePartitionLeaderStatus . NONE ; return ; } if ( m_migratePartitionLeaderStatus == MigratePartitionLeaderStatu...
that previous partition leader has drained its txns
263
9
155,462
public void setMigratePartitionLeaderStatus ( boolean migratePartitionLeader ) { if ( ! migratePartitionLeader ) { m_migratePartitionLeaderStatus = MigratePartitionLeaderStatus . NONE ; m_newLeaderHSID = Long . MIN_VALUE ; return ; } //The previous leader has already drained all txns if ( m_migratePartitionLeaderStatus...
the site for new partition leader
257
6
155,463
public void notifyNewLeaderOfTxnDoneIfNeeded ( ) { //return quickly to avoid performance hit if ( m_newLeaderHSID == Long . MIN_VALUE ) { return ; } SpScheduler scheduler = ( SpScheduler ) m_scheduler ; if ( ! scheduler . txnDoneBeforeCheckPoint ( ) ) { return ; } MigratePartitionLeaderMessage message = new MigratePart...
Then new master can proceed to process transactions .
253
9
155,464
public void resetMigratePartitionLeaderStatus ( ) { m_scheduler . m_isLeader = true ; m_migratePartitionLeaderStatus = MigratePartitionLeaderStatus . NONE ; m_repairLog . setLeaderState ( true ) ; m_newLeaderHSID = Long . MIN_VALUE ; }
Reinstall the site as leader .
70
7
155,465
private Option resolveOption ( String opt ) { opt = Util . stripLeadingHyphens ( opt ) ; for ( Option option : options ) { if ( opt . equals ( option . getOpt ( ) ) ) { return option ; } if ( opt . equals ( option . getLongOpt ( ) ) ) { return option ; } } return null ; }
Retrieves the option object given the long or short option as a String
75
15
155,466
public String [ ] getArgs ( ) { String [ ] answer = new String [ args . size ( ) ] ; args . toArray ( answer ) ; return answer ; }
Retrieve any left - over non - recognized options and arguments
36
12
155,467
public boolean processScanNodeWithReAggNode ( AbstractPlanNode node , AbstractPlanNode reAggNode ) { // MV table scan node can not be in in-lined nodes. for ( int i = 0 ; i < node . getChildCount ( ) ; i ++ ) { AbstractPlanNode child = node . getChild ( i ) ; if ( child instanceof AbstractScanPlanNode ) { AbstractScanP...
Find the scan node on MV table replace it with reAggNode for join query . This scan node can not be in - lined so it should be as a child of a join node .
246
38
155,468
private void resolveColumnReferences ( ) { if ( isDistinctSelect || isGrouped ) { acceptsSequences = false ; } for ( int i = 0 ; i < rangeVariables . length ; i ++ ) { Expression e = rangeVariables [ i ] . nonIndexJoinCondition ; if ( e == null ) { continue ; } resolveColumnReferencesAndAllocate ( e , i + 1 , false ) ;...
Resolves all column expressions in the GROUP BY clause and beyond . Replaces any alias column expression in the ORDER BY cluase with the actual select column expression .
236
33
155,469
private int getMaxRowCount ( Session session , int rowCount ) { int limitStart = getLimitStart ( session ) ; int limitCount = getLimitCount ( session , rowCount ) ; if ( simpleLimit ) { if ( rowCount == 0 ) { rowCount = limitCount ; } // A VoltDB extension to support LIMIT 0 if ( rowCount > Integer . MAX_VALUE - limitS...
translate the rowCount into total number of rows needed from query including any rows skipped at the beginning
309
20
155,470
protected void dumpExprColumns ( String header ) { System . out . println ( "\n\n*********************************************" ) ; System . out . println ( header ) ; try { System . out . println ( getSQL ( ) ) ; } catch ( Exception e ) { } for ( int i = 0 ; i < exprColumns . length ; ++ i ) { if ( i == 0 ) System . o...
Dumps the exprColumns list for this query specification . Writes to stdout .
201
18
155,471
public void updateEECacheStats ( long eeCacheSize , long hits , long misses , int partitionId ) { m_cache1Level = eeCacheSize ; m_cache1Hits += hits ; m_cacheMisses += misses ; m_invocations += hits + misses ; m_partitionId = partitionId ; }
Used to update EE cache stats without changing tracked time
72
10
155,472
public void endStatsCollection ( long cache1Size , long cache2Size , CacheUse cacheUse , long partitionId ) { if ( m_currentStartTime != null ) { long delta = System . nanoTime ( ) - m_currentStartTime ; if ( delta < 0 ) { if ( Math . abs ( delta ) > 1000000000 ) { log . info ( "Planner statistics recorded a negative p...
Called after planning or failing to plan . Records timer and cache stats .
302
15
155,473
@ Override protected void updateStatsRow ( Object rowKey , Object rowValues [ ] ) { super . updateStatsRow ( rowKey , rowValues ) ; rowValues [ columnNameToIndex . get ( "PARTITION_ID" ) ] = m_partitionId ; long totalTimedExecutionTime = m_totalPlanningTime ; long minExecutionTime = m_minPlanningTime ; long maxExecutio...
Update the rowValues array with the latest statistical information . This method is overrides the super class version which must also be called so that it can update its columns .
805
33
155,474
static void tag ( StringBuilder sb , String color , String text ) { sb . append ( "<span class='label label" ) ; if ( color != null ) { sb . append ( "-" ) . append ( color ) ; } String classText = text . replace ( ' ' , ' ' ) ; sb . append ( " l-" ) . append ( classText ) . append ( "'>" ) . append ( text ) . append (...
Make an html bootstrap tag with our custom css class .
103
13
155,475
public static String report ( Catalog catalog , long minHeap , boolean isPro , int hostCount , int sitesPerHost , int kfactor , ArrayList < Feedback > warnings , String autoGenDDL ) throws IOException { // asynchronously get platform properties new Thread ( ) { @ Override public void run ( ) { PlatformProperties . getP...
Generate the HTML catalog report from a newly compiled VoltDB catalog
709
13
155,476
public static String liveReport ( ) { byte [ ] reportbytes = VoltDB . instance ( ) . getCatalogContext ( ) . getFileInJar ( VoltCompiler . CATLOG_REPORT ) ; String report = new String ( reportbytes , Charsets . UTF_8 ) ; // remove commented out code report = report . replace ( "<!--##RESOURCES" , "" ) ; report = report...
Find the pre - compild catalog report in the jarfile and modify it for use in the the built - in web portal .
328
26
155,477
private static boolean turnOffClientInterface ( ) { // we don't expect this to ever fail, but if it does, skip to dying immediately VoltDBInterface vdbInstance = instance ( ) ; if ( vdbInstance != null ) { ClientInterface ci = vdbInstance . getClientInterface ( ) ; if ( ci != null ) { if ( ! ci . ceaseAllPublicFacingTr...
turn off client interface as fast as possible
101
8
155,478
private static void sendCrashSNMPTrap ( String msg ) { if ( msg == null || msg . trim ( ) . isEmpty ( ) ) { return ; } VoltDBInterface vdbInstance = instance ( ) ; if ( vdbInstance == null ) { return ; } SnmpTrapSender snmp = vdbInstance . getSnmpTrapSender ( ) ; if ( snmp == null ) { return ; } try { snmp . crash ( ms...
send a SNMP trap crash notification
146
7
155,479
public static void crashGlobalVoltDB ( String errMsg , boolean stackTrace , Throwable t ) { // for test code wasCrashCalled = true ; crashMessage = errMsg ; if ( ignoreCrash ) { throw new AssertionError ( "Faux crash of VoltDB successful." ) ; } // end test code // send a snmp trap crash notification sendCrashSNMPTrap ...
Exit the process with an error message optionally with a stack trace . Also notify all connected peers that the node is going down .
283
25
155,480
public static void main ( String [ ] args ) { //Thread.setDefaultUncaughtExceptionHandler(new VoltUncaughtExceptionHandler()); Configuration config = new Configuration ( args ) ; try { if ( ! config . validate ( ) ) { System . exit ( - 1 ) ; } else { if ( config . m_startAction == StartAction . GET ) { cli ( config ) ;...
Entry point for the VoltDB server process .
154
9
155,481
public static String getDefaultReplicationInterface ( ) { if ( m_config . m_drInterface == null || m_config . m_drInterface . isEmpty ( ) ) { if ( m_config . m_externalInterface == null ) { return "" ; } else { return m_config . m_externalInterface ; } } else { return m_config . m_drInterface ; } }
Selects the a specified m_drInterface over a specified m_externalInterface from m_config
85
20
155,482
public void removeAllZeros ( ) { Iterator < Map . Entry < K , AtomicLong > > entryIterator = map . entrySet ( ) . iterator ( ) ; while ( entryIterator . hasNext ( ) ) { Map . Entry < K , AtomicLong > entry = entryIterator . next ( ) ; AtomicLong atomic = entry . getValue ( ) ; if ( atomic != null && atomic . get ( ) ==...
Removes all mappings from this map whose values are zero .
102
13
155,483
public CompletableFuture < ClientResponseWithPartitionKey [ ] > callAllPartitionProcedure ( String procedureName , Object ... params ) { return m_runner . callAllPartitionProcedure ( procedureName , params ) ; }
A version of the similar API from VoltDB clients but for for non - transactional procedures . Runs a single - partition procedure on every partition that exists at the time it is called .
52
37
155,484
public static ByteBuffer getTableDataReference ( VoltTable vt ) { ByteBuffer buf = vt . m_buffer . duplicate ( ) ; buf . rewind ( ) ; return buf ; }
End users should not call this method . Obtain a reference to the table s underlying buffer . The returned reference s position and mark are independent of the table s buffer position and mark . The returned buffer has no mark and is at position 0 .
41
49
155,485
private long reserveNextTicket ( double requiredPermits , long nowMicros ) { resync ( nowMicros ) ; long microsToNextFreeTicket = Math . max ( 0 , nextFreeTicketMicros - nowMicros ) ; double storedPermitsToSpend = Math . min ( requiredPermits , this . storedPermits ) ; double freshPermits = requiredPermits - storedPerm...
Reserves next ticket and returns the wait time that the caller must wait for .
176
16
155,486
public Options addOptionGroup ( OptionGroup group ) { if ( group . isRequired ( ) ) { requiredOpts . add ( group ) ; } for ( Option option : group . getOptions ( ) ) { // an Option cannot be required if it is in an // OptionGroup, either the group is required or // nothing is required option . setRequired ( false ) ; a...
Add the specified option group .
104
6
155,487
public Options addOption ( String opt , String description ) { addOption ( opt , null , false , description ) ; return this ; }
Add an option that only contains a short name . The option does not take an argument .
28
18
155,488
public Options addOption ( String opt , boolean hasArg , String description ) { addOption ( opt , null , hasArg , description ) ; return this ; }
Add an option that only contains a short - name . It may be specified as requiring an argument .
33
20
155,489
public Options addOption ( String opt , String longOpt , boolean hasArg , String description ) { addOption ( new Option ( opt , longOpt , hasArg , description ) ) ; return this ; }
Add an option that contains a short - name and a long - name . It may be specified as requiring an argument .
42
24
155,490
public static VoltXMLElement mergeTwoElementsUsingOperator ( String opName , String opElementId , VoltXMLElement first , VoltXMLElement second ) { if ( first == null || second == null ) { return first == null ? second : first ; } if ( opName == null || opElementId == null ) { return null ; } VoltXMLElement retval = new...
If one of the elements is null return the other one diectly .
150
15
155,491
public static List < VoltXMLElement > buildLimitElements ( int limit , String limitValueElementId ) { if ( limitValueElementId == null ) { return null ; } List < VoltXMLElement > retval = new ArrayList < VoltXMLElement > ( ) ; retval . add ( new VoltXMLElement ( "offset" ) ) ; VoltXMLElement limitElement = new VoltXMLE...
Build VoltXMLElement for expression like LIMIT 1 .
165
12
155,492
public static VoltXMLElement buildColumnParamJoincondElement ( String opName , VoltXMLElement leftElement , String valueParamElementId , String opElementId ) { VoltXMLElement valueParamElement = buildValueElement ( valueParamElementId ) ; return mergeTwoElementsUsingOperator ( opName , opElementId , leftElement , value...
Build VoltXMLElement for expression like column = ? .
80
12
155,493
public static VoltXMLElement buildParamElement ( String elementId , String index , String valueType ) { VoltXMLElement retval = new VoltXMLElement ( "parameter" ) ; retval . attributes . put ( "id" , elementId ) ; retval . attributes . put ( "index" , index ) ; retval . attributes . put ( "valuetype" , valueType ) ; re...
Build an element to be inserted under the parameters tree .
93
11
155,494
@ Override public void loadFromJSONObject ( JSONObject jobj , Database db ) throws JSONException { super . loadFromJSONObject ( jobj , db ) ; m_lookupType = IndexLookupType . get ( jobj . getString ( Members . LOOKUP_TYPE . name ( ) ) ) ; m_sortDirection = SortDirectionType . get ( jobj . getString ( Members . SORT_DIR...
all members loaded
502
3
155,495
public boolean isPredicatesOptimizableForAggregate ( ) { // for reverse scan, need to examine "added" predicates List < AbstractExpression > predicates = ExpressionUtil . uncombinePredicate ( m_predicate ) ; // if the size of predicates doesn't equal 1, can't be our added artifact predicates if ( predicates . size ( ) ...
added for reverse scan purpose only
213
6
155,496
private void respondWithDummy ( ) { final FragmentResponseMessage response = new FragmentResponseMessage ( m_fragmentMsg , m_initiator . getHSId ( ) ) ; response . m_sourceHSId = m_initiator . getHSId ( ) ; response . setRecovering ( true ) ; response . setStatus ( FragmentResponseMessage . SUCCESS , null ) ; // Set th...
Respond with a dummy fragment response .
244
8
155,497
public FragmentResponseMessage processFragmentTask ( SiteProcedureConnection siteConnection ) { final FragmentResponseMessage currentFragResponse = new FragmentResponseMessage ( m_fragmentMsg , m_initiator . getHSId ( ) ) ; currentFragResponse . setStatus ( FragmentResponseMessage . SUCCESS , null ) ; for ( int frag = ...
modified to work in the new world
780
7
155,498
@ Override public void run ( ) { try { VoltTable partitionKeys = null ; partitionKeys = m_client . callProcedure ( "@GetPartitionKeys" , "INTEGER" ) . getResults ( ) [ 0 ] ; while ( partitionKeys . advanceRow ( ) ) { m_client . callProcedure ( new NullCallback ( ) , "DeleteOldAdRequests" , partitionKeys . getLong ( "PA...
Remove aged - out data from the ad_requests table . This table is partitioned and may be large so use the run - everywhere pattern to minimize impact to throughput .
158
35
155,499
public void updateLobUsage ( boolean commit ) { if ( ! hasLobOps ) { return ; } hasLobOps = false ; if ( commit ) { for ( int i = 0 ; i < createdLobs . size ( ) ; i ++ ) { long lobID = createdLobs . get ( i ) ; int delta = lobUsageCount . get ( lobID , 0 ) ; if ( delta == 1 ) { lobUsageCount . remove ( lobID ) ; create...
update LobManager user counts delete lobs that have no usage
330
12