idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
154,400 | protected void shutdown ( ) throws InterruptedException { if ( m_deadConnectionFuture != null ) { m_deadConnectionFuture . cancel ( false ) ; try { m_deadConnectionFuture . get ( ) ; } catch ( Throwable t ) { } } if ( m_topologyCheckFuture != null ) { m_topologyCheckFuture . cancel ( false ) ; try { m_topologyCheckFutu... | all your read buffers events .. or something .. |
154,401 | public void sendEOLMessage ( int partitionId ) { final long initiatorHSId = m_cartographer . getHSIdForMaster ( partitionId ) ; Iv2EndOfLogMessage message = new Iv2EndOfLogMessage ( partitionId ) ; m_mailbox . send ( initiatorHSId , message ) ; } | Sends an end of log message to the master of that partition . This should only be called at the end of replay . |
154,402 | private ClientResponseImpl getMispartitionedErrorResponse ( StoredProcedureInvocation task , Procedure catProc , Exception ex ) { Object invocationParameter = null ; try { invocationParameter = task . getParameterAtIndex ( catProc . getPartitionparameter ( ) ) ; } catch ( Exception ex2 ) { } String exMsg = "Unknown" ; ... | Generate a mispartitioned response also log the message . |
154,403 | public boolean ceaseAllPublicFacingTrafficImmediately ( ) { try { if ( m_acceptor != null ) { m_acceptor . shutdown ( ) ; } if ( m_adminAcceptor != null ) { m_adminAcceptor . shutdown ( ) ; } } catch ( InterruptedException e ) { log . error ( e ) ; return false ; } finally { m_isAcceptingConnections . set ( false ) ; m... | This is not designed to be a safe shutdown . This is designed to stop sending messages to clients as fast as possible . It is currently called from VoltDB . crash ... |
154,404 | void processMigratePartitionLeaderTask ( MigratePartitionLeaderMessage message ) { synchronized ( m_lock ) { if ( message . startMigratingPartitionLeaders ( ) ) { if ( m_migratePartitionLeaderExecutor == null ) { m_migratePartitionLeaderExecutor = Executors . newSingleThreadScheduledExecutor ( CoreUtils . getThreadFact... | start or stop MigratePartitionLeader task |
154,405 | public VoltTable [ ] run ( SystemProcedureExecutionContext ctx ) { VoltDBInterface voltdb = VoltDB . instance ( ) ; OperationMode opMode = voltdb . getMode ( ) ; if ( ctx . isLowestSiteId ( ) ) { ZooKeeper zk = voltdb . getHostMessenger ( ) . getZK ( ) ; try { Stat stat ; OperationMode zkMode = null ; Code code ; do { ... | Exit admin mode |
154,406 | private static File getNativeLibraryFile ( String libname ) { String pathFormat = "/org/voltdb/native/%s/x86_64" ; String libPath = null ; String osName = System . getProperty ( "os.name" ) . toLowerCase ( ) ; if ( osName . contains ( "mac" ) ) { libPath = String . format ( pathFormat , "Mac" ) ; } else if ( osName . c... | Returns the native library file copied into a readable location . |
154,407 | public static void writeString ( String value , ByteBuffer buf ) { if ( value == null ) { buf . putInt ( VoltType . NULL_STRING_LENGTH ) ; return ; } byte [ ] strbytes = value . getBytes ( Constants . UTF8ENCODING ) ; int len = strbytes . length ; buf . putInt ( len ) ; buf . put ( strbytes ) ; } | Write a string in the standard VoltDB way |
154,408 | public static void writeVarbinary ( byte [ ] bytes , ByteBuffer buf ) throws IOException { if ( bytes == null ) { buf . putInt ( VoltType . NULL_STRING_LENGTH ) ; return ; } buf . putInt ( bytes . length ) ; buf . put ( bytes ) ; } | Write a set of bytes in the standard VoltDB way |
154,409 | private static long getMaxBidId ( Client client ) { long currentMaxBidId = 0 ; try { VoltTable vt = client . callProcedure ( "@AdHoc" , "select max(id) from bids" ) . getResults ( ) [ 0 ] ; vt . advanceRow ( ) ; currentMaxBidId = vt . getLong ( 0 ) ; if ( vt . wasNull ( ) ) { currentMaxBidId = 0 ; } } catch ( IOExcepti... | Find the current highest bid id in the bids table . We ll start generating new bids at this number plus one . |
154,410 | public void run ( ) { long bidId = m_bidId ++ ; long advertiserId = Math . abs ( m_rand . nextLong ( ) ) % NUM_ADVERTISERS ; GeographyValue bidRegion = Regions . pickRandomRegion ( ) ; TimestampType bidStartTime = new TimestampType ( ) ; TimestampType bidEndTime = new TimestampType ( bidStartTime . getTime ( ) + AdBrok... | This is the run method for this Runnable subclass . |
154,411 | String getName ( ) { int idx = mName . lastIndexOf ( '/' ) ; return ( idx > 0 ) ? mName . substring ( idx ) : mName ; } | Strip the other pathname components and return the basename |
154,412 | public AbstractExpression singlePartitioningExpression ( ) { AbstractExpression e = singlePartitioningExpressionForReport ( ) ; if ( e != null && isUsefulPartitioningExpression ( e ) ) { return e ; } return null ; } | smart accessor - only returns a value if it was unique and is useful |
154,413 | void analyzeTablePartitioning ( Collection < StmtTableScan > collection ) throws PlanningErrorException { m_countOfPartitionedTables = 0 ; for ( StmtTableScan tableScan : collection ) { if ( ! tableScan . getIsReplicated ( ) ) { ++ m_countOfPartitionedTables ; } } m_countOfIndependentlyPartitionedTables = m_countOfPart... | This simple analysis counts the number of partitioned tables in the join tree of a query and initializes a guess for the count of independently partitioned tables . |
154,414 | public void resetAnalysisState ( ) { m_countOfIndependentlyPartitionedTables = - 1 ; m_countOfPartitionedTables = - 1 ; m_fullColumnName = null ; m_inferredExpression . clear ( ) ; m_inferredParameterIndex = - 1 ; m_inferredValue = null ; m_isDML = false ; setJoinValid ( true ) ; setJoinInvalidReason ( null ) ; m_parti... | Sometimes when we fail to plan a statement we try again with different inputs using the same StatementPartitioning object . In this case it s incumbent on callers to reset the cached analysis state set by calling this method . |
154,415 | public boolean callProcedure ( Invocation invocation , ProcedureCallback callback ) { try { boolean result = m_importServerAdapter . callProcedure ( this , m_backPressurePredicate , callback , invocation . getProcedure ( ) , invocation . getParams ( ) ) ; reportStat ( result , invocation . getProcedure ( ) ) ; return r... | This should be used importer implementations to execute a stored procedure . |
154,416 | public void rateLimitedLog ( Level level , Throwable cause , String format , Object ... args ) { m_logger . rateLimitedLog ( LOG_SUPPRESSION_INTERVAL_SECONDS , level , cause , format , args ) ; } | This rate limited log must be used by the importers to log messages that may happen frequently and must be rate limited . |
154,417 | protected void trace ( Throwable t , String msgFormat , Object ... args ) { m_logger . trace ( String . format ( msgFormat , args ) , t ) ; } | Log a TRACE level log message . |
154,418 | public void warn ( Throwable t , String msgFormat , Object ... args ) { m_logger . warn ( String . format ( msgFormat , args ) , t ) ; } | Log a WARN level log message . |
154,419 | public void add ( Right right ) { if ( isFull ) { return ; } if ( right . isFull ) { clear ( ) ; isFull = true ; return ; } isFullSelect |= right . isFullSelect ; isFullInsert |= right . isFullInsert ; isFullUpdate |= right . isFullUpdate ; isFullReferences |= right . isFullReferences ; isFullDelete |= right . isFullDe... | Supports column level GRANT |
154,420 | public void remove ( SchemaObject object , Right right ) { if ( right . isFull ) { clear ( ) ; return ; } if ( isFull ) { isFull = false ; isFullSelect = isFullInsert = isFullUpdate = isFullReferences = isFullDelete = true ; } if ( right . isFullDelete ) { isFullDelete = false ; } if ( ! isFullSelect && selectColumnSet... | supports column level REVOKE |
154,421 | static boolean containsAllColumns ( OrderedHashSet columnSet , Table table , boolean [ ] columnCheckList ) { for ( int i = 0 ; i < columnCheckList . length ; i ++ ) { if ( columnCheckList [ i ] ) { if ( columnSet == null ) { return false ; } if ( columnSet . contains ( table . getColumn ( i ) . getName ( ) ) ) { contin... | Supports column level checks |
154,422 | String getTableRightsSQL ( Table table ) { StringBuffer sb = new StringBuffer ( ) ; if ( isFull ) { return Tokens . T_ALL ; } if ( isFullSelect ) { sb . append ( Tokens . T_SELECT ) ; sb . append ( ',' ) ; } else if ( selectColumnSet != null ) { sb . append ( Tokens . T_SELECT ) ; getColumnList ( table , selectColumnSe... | supports column level GRANT |
154,423 | public synchronized int next ( ) { while ( nextPort <= MAX_STATIC_PORT ) { int port = nextPort ++ ; if ( MiscUtils . isBindable ( port ) ) { return port ; } } throw new RuntimeException ( "Exhausted all possible ports" ) ; } | Return the next bindable port |
154,424 | static Range < Long > range ( long start , long end ) { return Range . closed ( start , end ) . canonical ( DiscreteDomain . longs ( ) ) ; } | Returns a canonical range that can be added to the internal range set . Only ranges returned by this method can be added to the range set otherwise range operations like contains may yield unexpected results . Consult the Guava doc on Range for details . |
154,425 | private static long start ( Range < Long > range ) { if ( range . lowerBoundType ( ) == BoundType . OPEN ) { return DiscreteDomain . longs ( ) . next ( range . lowerEndpoint ( ) ) ; } else { return range . lowerEndpoint ( ) ; } } | Get the start of the range . Always use this method to get the start of a range because it respects the bound type . |
154,426 | private static long end ( Range < Long > range ) { if ( range . upperBoundType ( ) == BoundType . OPEN ) { return DiscreteDomain . longs ( ) . previous ( range . upperEndpoint ( ) ) ; } else { return range . upperEndpoint ( ) ; } } | Get the end of the range . Always use this method to get the end of a range because it respects the bound type . |
154,427 | public void append ( long start , long end ) { assert ( start <= end && ( m_map . isEmpty ( ) || start > end ( m_map . span ( ) ) ) ) ; addRange ( start , end ) ; } | Appends a range to the tracker . The range has to be after the last sequence number of the tracker . |
154,428 | public int truncate ( long newTruncationPoint ) { int truncated = 0 ; if ( m_map . isEmpty ( ) ) { m_map . add ( range ( newTruncationPoint , newTruncationPoint ) ) ; m_hasSentinel = true ; return truncated ; } if ( newTruncationPoint < getFirstSeqNo ( ) ) { return truncated ; } if ( m_hasSentinel ) { truncated -= 1 ; ... | Truncate the tracker to the given safe point . After truncation the new safe point will be the first sequence number of the tracker . If the new safe point is before the first sequence number of the tracker it s a no - op . If the map is empty truncation point will be the new safe point of tracker . |
154,429 | public void truncateAfter ( long newTruncationPoint ) { if ( size ( ) == 0 ) { m_map . add ( range ( newTruncationPoint , newTruncationPoint ) ) ; m_hasSentinel = true ; return ; } if ( newTruncationPoint > getLastSeqNo ( ) ) { return ; } final Iterator < Range < Long > > iter = m_map . asDescendingSetOfRanges ( ) . it... | Truncate the tracker to the given truncation point . After truncation any ranges after the new truncation point will be removed . If the new safe point is after the last sequence number of the tracker it s a no - op . If the map is empty truncation point will be the new safe point of tracker . |
154,430 | public Pair < Long , Long > getRangeContaining ( long seq ) { Range < Long > range = m_map . rangeContaining ( seq ) ; if ( range != null ) { return new Pair < Long , Long > ( start ( range ) , end ( range ) ) ; } return null ; } | Get range that contains given sequence number |
154,431 | public Pair < Long , Long > getFirstGap ( ) { if ( m_map . isEmpty ( ) || size ( ) < 2 ) { return null ; } Iterator < Range < Long > > iter = m_map . asRanges ( ) . iterator ( ) ; long start = end ( iter . next ( ) ) + 1 ; long end = start ( iter . next ( ) ) - 1 ; return new Pair < Long , Long > ( start , end ) ; } | Find range of the first gap if it exists . If there is only one entry range after the first entry is NOT a gap . |
154,432 | public int sizeInSequence ( ) { int sequence = 0 ; if ( m_map . isEmpty ( ) ) { return sequence ; } final Iterator < Range < Long > > iter = m_map . asRanges ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Range < Long > range = iter . next ( ) ; sequence += end ( range ) - start ( range ) + 1 ; } if ( m_hasSentine... | Get total number of sequence from the tracker . |
154,433 | void sendEvent ( CallEvent call ) throws NoConnectionsException , IOException , ProcCallException { if ( call . endTS == null ) { assert ( call . startTS != null ) ; client . callProcedure ( new NullCallback ( ) , "BeginCall" , call . agentId , call . phoneNoStr ( ) , call . callId , call . startTS ) ; } else { assert ... | Send a call event to either BeginCall or EndCall based on the event . |
154,434 | public void write ( char [ ] c , int off , int len ) { ensureRoom ( len * 2 ) ; for ( int i = off ; i < len ; i ++ ) { int v = c [ i ] ; buffer [ count ++ ] = ( byte ) ( v >>> 8 ) ; buffer [ count ++ ] = ( byte ) v ; } } | additional public methods not in similar java . util classes |
154,435 | long executeSQL ( boolean isFinal ) throws VoltAbortException { long count = 0 ; VoltTable [ ] results = voltExecuteSQL ( isFinal ) ; for ( VoltTable result : results ) { long dmlUpdated = result . asScalarLong ( ) ; if ( dmlUpdated == 0 ) { throw new VoltAbortException ( "Insert failed for tuple." ) ; } if ( dmlUpdate... | Execute a set of queued inserts . Ensure each insert successfully inserts one row . Throw exception if not . |
154,436 | protected static boolean _isCloseSurrogateMethod ( final Class clazz , final Method method ) { return ( ( Connection . class . isAssignableFrom ( clazz ) || Statement . class . isAssignableFrom ( clazz ) ) && "close" . equals ( method . getName ( ) ) ) ; } | Simple test used only during static initialization . |
154,437 | protected static Class [ ] _computeProxiedInterface ( Object delegate ) { if ( delegate instanceof Array ) { return arrayInterface ; } else if ( delegate instanceof Connection ) { return connectionInterface ; } else if ( delegate instanceof CallableStatement ) { return callableStatementInterface ; } else if ( delegate ... | Given a delegate retrieves the interface that must be implemented by a surrogate dynamic proxy to ensure pooling sensitive methods of the delegate are not exposed directly to clients . |
154,438 | protected void closeConnectionSurrogate ( ) throws Throwable { ConnectionPool connectionPool = this . connectionPool ; if ( connectionPool == null ) { Connection connection = ( Connection ) this . delegate ; try { connection . close ( ) ; } catch ( SQLException ex ) { } } else { Connection connection = ( Connection ) t... | Does work toward enabling reuse of the delegate when it is a Connection . |
154,439 | public static String jsonifyClusterTrackers ( Pair < Long , Long > lastConsumerUniqueIds , Map < Integer , Map < Integer , DRSiteDrIdTracker > > allProducerTrackers ) throws JSONException { JSONStringer stringer = new JSONStringer ( ) ; stringer . object ( ) ; stringer . keySymbolValuePair ( "lastConsumerSpUniqueId" , ... | Serialize the cluster trackers into JSON . |
154,440 | public static Map < Integer , Map < Integer , DRSiteDrIdTracker > > dejsonifyClusterTrackers ( final String jsonData , boolean resetLastReceivedLogIds ) throws JSONException { Map < Integer , Map < Integer , DRSiteDrIdTracker > > producerTrackers = new HashMap < > ( ) ; JSONObject clusterData = new JSONObject ( jsonDat... | Deserialize the trackers retrieved from each consumer partitions . |
154,441 | public static void mergeTrackers ( Map < Integer , Map < Integer , DRSiteDrIdTracker > > base , Map < Integer , Map < Integer , DRSiteDrIdTracker > > add ) { for ( Map . Entry < Integer , Map < Integer , DRSiteDrIdTracker > > clusterEntry : add . entrySet ( ) ) { final Map < Integer , DRSiteDrIdTracker > baseClusterEnt... | Merge trackers in the additional map into the base map . |
154,442 | public JSONWriter array ( Iterable < ? extends JSONString > iter ) throws JSONException { array ( ) ; for ( JSONString element : iter ) { value ( element ) ; } endArray ( ) ; return this ; } | Append an array value based on a custom JSONString implementation . |
154,443 | public JSONWriter keySymbolValuePair ( String aKey , String aValue ) throws JSONException { assert ( aKey != null ) ; assert ( m_mode == 'k' ) ; assert ( m_scopeStack [ m_top ] . add ( aKey ) ) ; try { m_writer . write ( m_expectingComma ? ",\"" : "\"" ) ; m_writer . write ( aKey ) ; if ( aValue == null ) { m_writer . ... | Write a JSON key - value pair in one optimized step that assumes that the key is a symbol composed of normal characters requiring no escaping and asserts that keys are non - null and unique within an object ONLY if asserts are enabled . This method is most suitable in the common case where the caller is making a hard -... |
154,444 | public static byte [ ] gunzipBytes ( byte [ ] compressedBytes ) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ( int ) ( compressedBytes . length * 1.5 ) ) ; InflaterOutputStream dos = new InflaterOutputStream ( bos ) ; dos . write ( compressedBytes ) ; dos . close ( ) ; return bos . toByt... | to avoid linking all that jazz into the client code |
154,445 | public Object [ ] getGroupData ( Object [ ] data ) { if ( isSimpleAggregate ) { if ( simpleAggregateData == null ) { simpleAggregateData = data ; return null ; } return simpleAggregateData ; } RowIterator it = groupIndex . findFirstRow ( session , store , data ) ; if ( it . hasNext ( ) ) { Row row = it . getNextRow ( )... | Special case for isSimpleAggregate cannot use index lookup . |
154,446 | public void addConstraint ( Constraint c ) { int index = c . getConstraintType ( ) == Constraint . PRIMARY_KEY ? 0 : constraintList . length ; constraintList = ( Constraint [ ] ) ArrayUtil . toAdjustedArray ( constraintList , c , index , 1 ) ; updateConstraintLists ( ) ; } | Adds a constraint . |
154,447 | Constraint getUniqueConstraintForColumns ( int [ ] cols ) { for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . isUniqueWithColumns ( cols ) ) { return c ; } } return null ; } | Returns the UNIQUE or PK constraint with the given column signature . |
154,448 | Constraint getUniqueConstraintForColumns ( int [ ] mainTableCols , int [ ] refTableCols ) { for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . hasExprs ( ) ) { continue ; } int type = c . getConstraintType ( ) ; if ( type != Constraint . UNIQUE && type ... | Returns the UNIQUE or PK constraint with the given column signature . Modifies the composition of refTableCols if necessary . |
154,449 | Constraint getFKConstraintForColumns ( Table tableMain , int [ ] mainCols , int [ ] refCols ) { for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . isEquivalent ( tableMain , mainCols , this , refCols ) ) { return c ; } } return null ; } | Returns any foreign key constraint equivalent to the column sets |
154,450 | public Constraint getUniqueOrPKConstraintForIndex ( Index index ) { for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . getMainIndex ( ) == index && ( c . getConstraintType ( ) == Constraint . UNIQUE || c . getConstraintType ( ) == Constraint . PRIMARY_K... | Returns any unique Constraint using this index |
154,451 | int getNextConstraintIndex ( int from , int type ) { for ( int i = from , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . getConstraintType ( ) == type ) { return i ; } } return - 1 ; } | Returns the next constraint of a given type |
154,452 | public void addColumn ( ColumnSchema column ) { String name = column . getName ( ) . name ; if ( findColumn ( name ) >= 0 ) { throw Error . error ( ErrorCode . X_42504 , name ) ; } if ( column . isIdentity ( ) ) { if ( identityColumn != - 1 ) { throw Error . error ( ErrorCode . X_42525 , name ) ; } identityColumn = get... | Performs the table level checks and adds a column to the table at the DDL level . Only used at table creation not at alter column . |
154,453 | void checkColumnsMatch ( int [ ] col , Table other , int [ ] othercol ) { for ( int i = 0 ; i < col . length ; i ++ ) { Type type = colTypes [ col [ i ] ] ; Type otherType = other . colTypes [ othercol [ i ] ] ; if ( type . typeComparisonGroup != otherType . typeComparisonGroup ) { throw Error . error ( ErrorCode . X_4... | Match two valid equal length columns arrays for type of columns |
154,454 | OrderedHashSet getDependentConstraints ( int colIndex ) { OrderedHashSet set = new OrderedHashSet ( ) ; for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . hasColumnOnly ( colIndex ) ) { set . add ( c ) ; } } return set ; } | Returns list of constraints dependent only on one column |
154,455 | OrderedHashSet getContainingConstraints ( int colIndex ) { OrderedHashSet set = new OrderedHashSet ( ) ; for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . hasColumnPlus ( colIndex ) ) { set . add ( c ) ; } } return set ; } | Returns list of constraints dependent on more than one column |
154,456 | OrderedHashSet getDependentConstraints ( Constraint constraint ) { OrderedHashSet set = new OrderedHashSet ( ) ; for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . getConstraintType ( ) == Constraint . MAIN ) { if ( c . core . uniqueName == constraint .... | Returns list of MAIN constraints dependent on this PK or UNIQUE constraint |
154,457 | void checkColumnInFKConstraint ( int colIndex , int actionType ) { for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { Constraint c = constraintList [ i ] ; if ( c . getConstraintType ( ) == Constraint . FOREIGN_KEY && c . hasColumn ( colIndex ) && ( actionType == c . getUpdateAction ( ) || actionTyp... | Used for column defaults and nullability . Checks whether column is in an FK with a given referential action type . |
154,458 | public int getColumnIndex ( String name ) { int i = findColumn ( name ) ; if ( i == - 1 ) { throw Error . error ( ErrorCode . X_42501 , name ) ; } return i ; } | Returns the index of given column name or throws if not found |
154,459 | void setDefaultExpression ( int columnIndex , Expression def ) { ColumnSchema column = getColumn ( columnIndex ) ; column . setDefaultExpression ( def ) ; setColumnTypeVars ( columnIndex ) ; } | Sets the SQL default value for a columm . |
154,460 | void resetDefaultsFlag ( ) { hasDefaultValues = false ; for ( int i = 0 ; i < colDefaults . length ; i ++ ) { hasDefaultValues = hasDefaultValues || colDefaults [ i ] != null ; } } | sets the flag for the presence of any default expression |
154,461 | Index getIndexForColumn ( int col ) { int i = bestIndexForColumn [ col ] ; return i == - 1 ? null : this . indexList [ i ] ; } | Finds an existing index for a column |
154,462 | public void createPrimaryKey ( HsqlName indexName , int [ ] columns , boolean columnsNotNull ) { if ( primaryKeyCols != null ) { throw Error . runtimeError ( ErrorCode . U_S0500 , "Table" ) ; } if ( columns == null ) { columns = ValuePool . emptyIntArray ; } else { for ( int i = 0 ; i < columns . length ; i ++ ) { getC... | Creates a single or multi - column primary key and index . sets the colTypes array . Finalises the creation of the table . ( fredt |
154,463 | void addTrigger ( TriggerDef td , HsqlName otherName ) { int index = triggerList . length ; if ( otherName != null ) { int pos = getTriggerIndex ( otherName . name ) ; if ( pos != - 1 ) { index = pos + 1 ; } } triggerList = ( TriggerDef [ ] ) ArrayUtil . toAdjustedArray ( triggerList , td , index , 1 ) ; TriggerDef [ ]... | Adds a trigger . |
154,464 | TriggerDef getTrigger ( String name ) { for ( int i = triggerList . length - 1 ; i >= 0 ; i -- ) { if ( triggerList [ i ] . name . name . equals ( name ) ) { return triggerList [ i ] ; } } return null ; } | Returns a trigger . |
154,465 | void removeTrigger ( String name ) { TriggerDef td = null ; for ( int i = 0 ; i < triggerList . length ; i ++ ) { td = triggerList [ i ] ; if ( td . name . name . equals ( name ) ) { td . terminate ( ) ; triggerList = ( TriggerDef [ ] ) ArrayUtil . toAdjustedArray ( triggerList , null , i , - 1 ) ; break ; } } if ( td ... | Drops a trigger . |
154,466 | void releaseTriggers ( ) { for ( int i = 0 ; i < TriggerDef . NUM_TRIGS ; i ++ ) { for ( int j = 0 ; j < triggerLists [ i ] . length ; j ++ ) { triggerLists [ i ] [ j ] . terminate ( ) ; } triggerLists [ i ] = TriggerDef . emptyArray ; } } | Drops all triggers . |
154,467 | int getIndexIndex ( String indexName ) { Index [ ] indexes = indexList ; for ( int i = 0 ; i < indexes . length ; i ++ ) { if ( indexName . equals ( indexes [ i ] . getName ( ) . name ) ) { return i ; } } return - 1 ; } | Returns the index of the Index object of the given name or - 1 if not found . |
154,468 | Index getIndex ( String indexName ) { Index [ ] indexes = indexList ; int i = getIndexIndex ( indexName ) ; return i == - 1 ? null : indexes [ i ] ; } | Returns the Index object of the given name or null if not found . |
154,469 | int getConstraintIndex ( String constraintName ) { for ( int i = 0 , size = constraintList . length ; i < size ; i ++ ) { if ( constraintList [ i ] . getName ( ) . name . equals ( constraintName ) ) { return i ; } } return - 1 ; } | Return the position of the constraint within the list |
154,470 | public Constraint getConstraint ( String constraintName ) { int i = getConstraintIndex ( constraintName ) ; return ( i < 0 ) ? null : constraintList [ i ] ; } | return the named constriant |
154,471 | Index createIndexForColumns ( int [ ] columns ) { HsqlName indexName = database . nameManager . newAutoName ( "IDX_T" , getSchemaName ( ) , getName ( ) , SchemaObject . INDEX ) ; try { Index index = createAndAddIndexStructure ( indexName , columns , null , null , false , false , false , false ) ; return index ; } catch... | Used to create an index automatically for system tables . |
154,472 | void enforceRowConstraints ( Session session , Object [ ] data ) { for ( int i = 0 ; i < defaultColumnMap . length ; i ++ ) { Type type = colTypes [ i ] ; data [ i ] = type . convertToTypeLimits ( session , data [ i ] ) ; if ( type . isDomainType ( ) ) { Constraint [ ] constraints = type . userTypeModifier . getConstra... | Enforce max field sizes according to SQL column definition . SQL92 13 . 8 |
154,473 | Index getIndexForColumns ( int [ ] cols ) { int i = bestIndexForColumn [ cols [ 0 ] ] ; if ( i > - 1 ) { return indexList [ i ] ; } switch ( tableType ) { case TableBase . SYSTEM_SUBQUERY : case TableBase . SYSTEM_TABLE : case TableBase . VIEW_TABLE : case TableBase . TEMP_TABLE : { Index index = createIndexForColumns ... | Finds an existing index for a column group |
154,474 | Index getIndexForColumns ( OrderedIntHashSet set ) { int maxMatchCount = 0 ; Index selected = null ; if ( set . isEmpty ( ) ) { return null ; } for ( int i = 0 , count = indexList . length ; i < count ; i ++ ) { Index currentindex = getIndex ( i ) ; int [ ] indexcols = currentindex . getColumns ( ) ; int matchCount = s... | Finds an existing index for a column set or create one for temporary tables |
154,475 | public final int [ ] getIndexRootsArray ( ) { PersistentStore store = database . persistentStoreCollection . getStore ( this ) ; int [ ] roots = new int [ getIndexCount ( ) ] ; for ( int i = 0 ; i < getIndexCount ( ) ; i ++ ) { CachedObject accessor = store . getAccessor ( indexList [ i ] ) ; roots [ i ] = accessor == ... | Return the list of file pointers to root nodes for this table s indexes . |
154,476 | void setIndexRoots ( Session session , String s ) { if ( ! isCached ) { throw Error . error ( ErrorCode . X_42501 , tableName . name ) ; } ParserDQL p = new ParserDQL ( session , new Scanner ( s ) ) ; int [ ] roots = new int [ getIndexCount ( ) ] ; p . read ( ) ; for ( int i = 0 ; i < getIndexCount ( ) ; i ++ ) { int v... | Sets the index roots and next identity . |
154,477 | public void dropIndex ( Session session , String indexname ) { int todrop = getIndexIndex ( indexname ) ; indexList = ( Index [ ] ) ArrayUtil . toAdjustedArray ( indexList , null , todrop , - 1 ) ; for ( int i = 0 ; i < indexList . length ; i ++ ) { indexList [ i ] . setPosition ( i ) ; } setBestRowIdentifiers ( ) ; if... | Performs Table structure modification and changes to the index nodes to remove a given index from a MEMORY or TEXT table . Not for PK index . |
154,478 | void insertRow ( Session session , PersistentStore store , Object [ ] data ) { setIdentityColumn ( session , data ) ; if ( triggerLists [ Trigger . INSERT_BEFORE ] . length != 0 ) { fireBeforeTriggers ( session , Trigger . INSERT_BEFORE , null , data , null ) ; } if ( isView ) { return ; } checkRowDataInsert ( session ... | Mid level method for inserting rows . Performs constraint checks and fires row level triggers . |
154,479 | void insertIntoTable ( Session session , Result result ) { PersistentStore store = session . sessionData . getRowStore ( this ) ; RowSetNavigator nav = result . initialiseNavigator ( ) ; while ( nav . hasNext ( ) ) { Object [ ] data = nav . getNext ( ) ; Object [ ] newData = ( Object [ ] ) ArrayUtil . resizeArrayIfDiff... | Multi - row insert method . Used for CREATE TABLE AS ... queries . |
154,480 | private Row insertNoCheck ( Session session , PersistentStore store , Object [ ] data ) { Row row = ( Row ) store . getNewCachedObject ( session , data ) ; store . indexRow ( session , row ) ; session . addInsertAction ( this , row ) ; return row ; } | Low level method for row insert . UNIQUE or PRIMARY constraints are enforced by attempting to add the row to the indexes . |
154,481 | public int insertSys ( PersistentStore store , Result ins ) { RowSetNavigator nav = ins . getNavigator ( ) ; int count = 0 ; while ( nav . hasNext ( ) ) { insertSys ( store , nav . getNext ( ) ) ; count ++ ; } return count ; } | Used for system table inserts . No checks . No identity columns . |
154,482 | void insertResult ( PersistentStore store , Result ins ) { RowSetNavigator nav = ins . initialiseNavigator ( ) ; while ( nav . hasNext ( ) ) { Object [ ] data = nav . getNext ( ) ; Object [ ] newData = ( Object [ ] ) ArrayUtil . resizeArrayIfDifferent ( data , getColumnCount ( ) ) ; insertData ( store , newData ) ; } } | Used for subquery inserts . No checks . No identity columns . |
154,483 | public void insertFromScript ( PersistentStore store , Object [ ] data ) { systemUpdateIdentityValue ( data ) ; insertData ( store , data ) ; } | Not for general use . Used by ScriptReader to unconditionally insert a row into the table when the . script file is read . |
154,484 | protected void systemUpdateIdentityValue ( Object [ ] data ) { if ( identityColumn != - 1 ) { Number id = ( Number ) data [ identityColumn ] ; if ( id != null ) { identitySequence . systemUpdate ( id . longValue ( ) ) ; } } } | If there is an identity column in the table sets the max identity value . |
154,485 | void deleteNoRefCheck ( Session session , Row row ) { Object [ ] data = row . getData ( ) ; fireBeforeTriggers ( session , Trigger . DELETE_BEFORE , data , null , null ) ; if ( isView ) { return ; } deleteNoCheck ( session , row ) ; } | Mid level row delete method . Fires triggers but no integrity constraint checks . |
154,486 | private void deleteNoCheck ( Session session , Row row ) { if ( row . isDeleted ( session ) ) { return ; } session . addDeleteAction ( this , row ) ; } | Low level row delete method . Removes the row from the indexes and from the Cache . |
154,487 | public void deleteNoCheckFromLog ( Session session , Object [ ] data ) { Row row = null ; PersistentStore store = session . sessionData . getRowStore ( this ) ; if ( hasPrimaryKey ( ) ) { RowIterator it = getPrimaryIndex ( ) . findFirstRow ( session , store , data , primaryKeyColsSequence ) ; row = it . getNextRow ( ) ... | For log statements . Delete a single row . |
154,488 | public void addTTL ( int ttlValue , String ttlUnit , String ttlColumn , int batchSize , int maxFrequency , String streamName ) { dropTTL ( ) ; timeToLive = new TimeToLiveVoltDB ( ttlValue , ttlUnit , getColumn ( findColumn ( ttlColumn ) ) , batchSize , maxFrequency , streamName ) ; } | A VoltDB extension to support TTL |
154,489 | static public int getStart ( int field ) { Integer iObject = ( Integer ) starts . get ( new Integer ( field ) ) ; if ( iObject == null ) { throw new IllegalArgumentException ( RB . singleton . getString ( RB . UNEXPECTED_HEADER_KEY , field ) ) ; } return iObject . intValue ( ) ; } | not some problem with a Header or generating or reading a Header . |
154,490 | VoltTable executePrecompiledSQL ( Statement catStmt , Object [ ] params , boolean replicated ) throws VoltAbortException { SQLStmt stmt = new SQLStmt ( catStmt . getSqltext ( ) ) ; if ( replicated ) { stmt . setInCatalog ( false ) ; } m_runner . initSQLStmt ( stmt , catStmt ) ; voltQueueSQL ( stmt , params ) ; return v... | Execute a pre - compiled adHoc SQL statement throw exception if not . |
154,491 | protected static void printLogStatic ( String className , String msg , Object ... args ) { if ( args != null ) { msg = String . format ( msg , args ) ; } String header = String . format ( "%s [%s] " , ZonedDateTime . now ( ) . format ( TIME_FORMAT ) , className ) ; System . out . println ( String . format ( "%s%s" , he... | The static method to print a log message to the console . |
154,492 | StatementSimple compileSetStatement ( RangeVariable rangeVars [ ] ) { read ( ) ; OrderedHashSet colNames = new OrderedHashSet ( ) ; HsqlArrayList exprList = new HsqlArrayList ( ) ; readSetClauseList ( rangeVars , colNames , exprList ) ; if ( exprList . size ( ) > 1 ) { throw Error . error ( ErrorCode . X_42602 ) ; } Ex... | Creates SET Statement for PSM from this parse context . |
154,493 | StatementSchema compileCreateProcedureOrFunction ( ) { int routineType = token . tokenType == Tokens . PROCEDURE ? SchemaObject . PROCEDURE : SchemaObject . FUNCTION ; HsqlName name ; read ( ) ; name = readNewSchemaObjectNameNoCheck ( routineType ) ; Routine routine = new Routine ( routineType ) ; routine . setName ( n... | SQL - invoked routine |
154,494 | void close ( boolean script ) { closeLog ( ) ; deleteNewAndOldFiles ( ) ; writeScript ( script ) ; closeAllTextCaches ( script ) ; if ( cache != null ) { cache . close ( true ) ; } properties . setProperty ( HsqlDatabaseProperties . db_version , HsqlDatabaseProperties . THIS_VERSION ) ; properties . setProperty ( HsqlD... | Close all the database files . If script argument is true no . data or . backup file will remain and the . script file will contain all the data of the cached tables as well as memory tables . |
154,495 | void deleteNewAndOldFiles ( ) { fa . removeElement ( fileName + ".data" + ".old" ) ; fa . removeElement ( fileName + ".data" + ".new" ) ; fa . removeElement ( fileName + ".backup" + ".new" ) ; fa . removeElement ( scriptFileName + ".new" ) ; } | Deletes the leftovers from any previous unfinished operations . |
154,496 | boolean forceDefrag ( ) { long megas = properties . getIntegerProperty ( HsqlDatabaseProperties . hsqldb_defrag_limit , 200 ) ; long defraglimit = megas * 1024L * 1024 ; long lostSize = cache . freeBlocks . getLostBlocksSize ( ) ; return lostSize > defraglimit ; } | Returns true if lost space is above the threshold |
154,497 | DataFileCache getCache ( ) { if ( cache == null ) { cache = new DataFileCache ( database , fileName ) ; cache . open ( filesReadOnly ) ; } return cache ; } | Responsible for creating the cache instance . |
154,498 | void setScriptType ( int type ) { if ( database . isStoredFileAccess ( ) ) { return ; } boolean needsCheckpoint = scriptFormat != type ; scriptFormat = type ; properties . setProperty ( HsqlDatabaseProperties . hsqldb_script_format , String . valueOf ( scriptFormat ) ) ; if ( needsCheckpoint ) { database . logger . nee... | Changing the script format results in a checkpoint with the . script file written in the new format . |
154,499 | private void writeScript ( boolean full ) { deleteNewScript ( ) ; ScriptWriterBase scw = ScriptWriterBase . newScriptWriter ( database , scriptFileName + ".new" , full , true , scriptFormat ) ; scw . writeAll ( ) ; scw . close ( ) ; } | Write the . script file as . script . new . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.