idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
155,800
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 ) ; for ( int...
Respond with a dummy fragment response .
155,801
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
155,802
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 ( "PARTITION_KEY...
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 .
155,803
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
155,804
public void allocateLobForResult ( ResultLob result , InputStream inputStream ) { long resultLobId = result . getLobID ( ) ; CountdownInputStream countStream ; switch ( result . getSubType ( ) ) { case ResultLob . LobResultTypes . REQUEST_CREATE_BYTES : { long blobId ; long blobLength = result . getBlockLength ( ) ; if...
allocate storage for a new LOB
155,805
public void resolveColumnIndexes ( ) { IndexScanPlanNode index_scan = ( IndexScanPlanNode ) getInlinePlanNode ( PlanNodeType . INDEXSCAN ) ; assert ( m_children . size ( ) == 2 && index_scan == null ) ; for ( AbstractPlanNode child : m_children ) { child . resolveColumnIndexes ( ) ; } final NodeSchema outer_schema = m_...
order and TVE indexes for the output SchemaColumns .
155,806
public void resolveSortDirection ( ) { AbstractPlanNode outerTable = m_children . get ( 0 ) ; if ( m_joinType == JoinType . FULL ) { m_sortDirection = SortDirectionType . INVALID ; return ; } if ( outerTable instanceof IndexSortablePlanNode ) { m_sortDirection = ( ( IndexSortablePlanNode ) outerTable ) . indexUse ( ) ....
right now only consider the sort direction on the outer table
155,807
protected long discountEstimatedProcessedTupleCount ( AbstractPlanNode childNode ) { AbstractExpression predicate = null ; if ( childNode instanceof AbstractScanPlanNode ) { predicate = ( ( AbstractScanPlanNode ) childNode ) . getPredicate ( ) ; } else if ( childNode instanceof NestLoopPlanNode ) { predicate = ( ( Nest...
Discount join node child estimates based on the number of its filters
155,808
public Serializable getObject ( ) { try { return InOutUtil . deserialize ( data ) ; } catch ( Exception e ) { throw Error . error ( ErrorCode . X_22521 , e . toString ( ) ) ; } }
This method is called from classes implementing the JDBC interfaces . Inside the engine it is used for conversion from a value of type OTHER to another type . It will throw if the OTHER is an instance of a classe that is not available .
155,809
static char [ ] [ ] createReplacementArray ( Map < Character , String > map ) { checkNotNull ( map ) ; if ( map . isEmpty ( ) ) { return EMPTY_REPLACEMENT_ARRAY ; } char max = Collections . max ( map . keySet ( ) ) ; char [ ] [ ] replacements = new char [ max + 1 ] [ ] ; for ( char c : map . keySet ( ) ) { replacements...
original character value .
155,810
public int getPrecision ( int param ) throws SQLException { checkRange ( param ) ; Type type = rmd . columnTypes [ -- param ] ; if ( type . isDateTimeType ( ) ) { return type . displaySize ( ) ; } else { long size = type . precision ; if ( size > Integer . MAX_VALUE ) { size = 0 ; } return ( int ) size ; } }
Retrieves the designated parameter s specified column size .
155,811
public String getParameterTypeName ( int param ) throws SQLException { checkRange ( param ) ; return rmd . columnTypes [ -- param ] . getNameString ( ) ; }
Retrieves the designated parameter s database - specific type name .
155,812
protected static TaskLog initializeTaskLog ( String voltroot , int pid ) { File overflowDir = new File ( voltroot , "join_overflow" ) ; return ProClass . newInstanceOf ( "org.voltdb.rejoin.TaskLogImpl" , "Join" , ProClass . HANDLER_LOG , pid , overflowDir ) ; }
Load the pro task log
155,813
protected void restoreBlock ( RestoreWork rejoinWork , SiteProcedureConnection siteConnection ) { kickWatchdog ( true ) ; rejoinWork . restore ( siteConnection ) ; }
Received a datablock . Reset the watchdog timer and hand the block to the Site .
155,814
protected void returnToTaskQueue ( boolean sourcesReady ) { if ( sourcesReady ) { m_taskQueue . offer ( this ) ; } else { VoltDB . instance ( ) . scheduleWork ( new ReturnToTaskQueueAction ( ) , 1 , - 1 , TimeUnit . MILLISECONDS ) ; } }
or after waiting a few milliseconds
155,815
static void putLong ( ByteBuffer buffer , long value ) { value = ( value << 1 ) ^ ( value >> 63 ) ; if ( value >>> 7 == 0 ) { buffer . put ( ( byte ) value ) ; } else { buffer . put ( ( byte ) ( ( value & 0x7F ) | 0x80 ) ) ; if ( value >>> 14 == 0 ) { buffer . put ( ( byte ) ( value >>> 7 ) ) ; } else { buffer . put ( ...
Writes a long value to the given buffer in LEB128 ZigZag encoded format
155,816
static void putInt ( ByteBuffer buffer , int value ) { value = ( value << 1 ) ^ ( value >> 31 ) ; if ( value >>> 7 == 0 ) { buffer . put ( ( byte ) value ) ; } else { buffer . put ( ( byte ) ( ( value & 0x7F ) | 0x80 ) ) ; if ( value >>> 14 == 0 ) { buffer . put ( ( byte ) ( value >>> 7 ) ) ; } else { buffer . put ( ( ...
Writes an int value to the given buffer in LEB128 - 64b9B ZigZag encoded format
155,817
static long getLong ( ByteBuffer buffer ) { long v = buffer . get ( ) ; long value = v & 0x7F ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 7 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 14 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & ...
Read an LEB128 - 64b9B ZigZag encoded long value from the given buffer
155,818
static int getInt ( ByteBuffer buffer ) { int v = buffer . get ( ) ; int value = v & 0x7F ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 7 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 14 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F...
Read an LEB128 - 64b9B ZigZag encoded int value from the given buffer
155,819
static public void main ( String [ ] sa ) throws IOException , TarMalformatException { if ( sa . length < 1 ) { System . out . println ( RB . singleton . getString ( RB . TARREADER_SYNTAX , TarReader . class . getName ( ) ) ) ; System . out . println ( RB . singleton . getString ( RB . LISTING_FORMAT ) ) ; System . exi...
Reads a specified tar file or stdin in order to either list or extract the file tar entries depending on the first argument being t or x using default read buffer blocks .
155,820
public static Date getDateFromUniqueId ( long uniqueId ) { long time = uniqueId >> ( COUNTER_BITS + PARTITIONID_BITS ) ; time += VOLT_EPOCH ; return new Date ( time ) ; }
Given a unique id return the time of its creation by examining the embedded timestamp .
155,821
public static Object createObject ( String classname ) throws ParseException { Class < ? > cl ; try { cl = Class . forName ( classname ) ; } catch ( ClassNotFoundException cnfe ) { throw new ParseException ( "Unable to find the class: " + classname ) ; } try { return cl . newInstance ( ) ; } catch ( Exception e ) { thr...
Create an Object from the classname and empty constructor .
155,822
public static Number createNumber ( String str ) throws ParseException { try { if ( str . indexOf ( '.' ) != - 1 ) { return Double . valueOf ( str ) ; } return Long . valueOf ( str ) ; } catch ( NumberFormatException e ) { throw new ParseException ( e . getMessage ( ) ) ; } }
Create a number from a String . If a . is present it creates a Double otherwise a Long .
155,823
private boolean fixupACL ( List < Id > authInfo , List < ACL > acl ) { if ( skipACL ) { return true ; } if ( acl == null || acl . size ( ) == 0 ) { return false ; } Iterator < ACL > it = acl . iterator ( ) ; LinkedList < ACL > toAdd = null ; while ( it . hasNext ( ) ) { ACL a = it . next ( ) ; Id id = a . getId ( ) ; i...
This method checks out the acl making sure it isn t null or empty it has valid schemes and ids and expanding any relative ids that depend on the requestor s authentication information .
155,824
public boolean authenticate ( ClientAuthScheme scheme , String fromAddress ) { if ( m_done ) throw new IllegalStateException ( "this authentication request has a result" ) ; boolean authenticated = false ; try { authenticated = authenticateImpl ( scheme , fromAddress ) ; } catch ( Exception ex ) { m_authenticationFailu...
Perform the authentication request
155,825
public long run ( String symbol , TimestampType time , long seq_number , String exchange , int bidPrice , int bidSize , int askPrice , int askSize ) throws VoltAbortException { Integer bidPriceSafe = askPrice > 0 ? askPrice : null ; Integer askPriceSafe = askPrice > 0 ? askPrice : null ; voltQueueSQL ( insertTick , sym...
main method the procedure starts here .
155,826
public static < K extends Comparable < ? > , V > Builder < K , V > builder ( ) { return new Builder < K , V > ( ) ; }
Returns a new builder for an immutable range map .
155,827
void setLeaderState ( boolean isLeader ) { m_isLeader = isLeader ; if ( m_isLeader ) { if ( ! m_logSP . isEmpty ( ) ) { truncate ( m_logSP . getLast ( ) . getHandle ( ) , IS_SP ) ; } } }
leaders log differently
155,828
public void deliver ( VoltMessage msg ) { if ( ! m_isLeader && msg instanceof Iv2InitiateTaskMessage ) { final Iv2InitiateTaskMessage m = ( Iv2InitiateTaskMessage ) msg ; if ( m . isReadOnly ( ) ) { return ; } m_lastSpHandle = m . getSpHandle ( ) ; truncate ( m . getTruncationHandle ( ) , IS_SP ) ; if ( "@MigratePartit...
the repairLog if the message includes a truncation hint .
155,829
private void truncate ( long handle , boolean isSP ) { if ( handle == Long . MIN_VALUE ) { return ; } Deque < RepairLog . Item > deq = null ; if ( isSP ) { deq = m_logSP ; if ( m_truncationHandle < handle ) { m_truncationHandle = handle ; notifyTxnCommitInterests ( handle ) ; } } else { deq = m_logMP ; } RepairLog . It...
trim unnecessary log messages .
155,830
public List < Iv2RepairLogResponseMessage > contents ( long requestId , boolean forMPI ) { List < Item > items = new LinkedList < Item > ( ) ; items . addAll ( m_logMP ) ; if ( ! forMPI ) { items . addAll ( m_logSP ) ; } Collections . sort ( items , m_handleComparator ) ; int ofTotal = items . size ( ) + 1 ; if ( repai...
produce the contents of the repair log .
155,831
public final synchronized void endProcedure ( boolean aborted , boolean failed , SingleCallStatsToken statsToken ) { if ( aborted ) { m_procStatsData . m_abortCount ++ ; } if ( failed ) { m_procStatsData . m_failureCount ++ ; } m_procStatsData . m_invocations ++ ; if ( ! statsToken . samplingProcedure ( ) ) { return ; ...
Called after a procedure is finished executing . Compares the start and end time and calculates the statistics .
155,832
public final synchronized void endFragment ( String stmtName , boolean isCoordinatorTask , boolean failed , boolean sampledStmt , long duration , int resultSize , int parameterSetSize ) { if ( stmtName == null ) { return ; } StatementStats stmtStats = m_stmtStatsMap . get ( stmtName ) ; if ( stmtStats == null ) { retur...
This function will be called after a statement finish running . It updates the data structures to maintain the statistics .
155,833
public synchronized Session newSession ( Database db , User user , boolean readonly , boolean forLog , int timeZoneSeconds ) { Session s = new Session ( db , user , ! forLog , ! forLog , readonly , sessionIdCount , timeZoneSeconds ) ; s . isProcessingLog = forLog ; sessionMap . put ( sessionIdCount , s ) ; sessionIdCou...
Binds the specified Session object into this SessionManager s active Session registry . This method is typically called internally as the final step when a successful connection has been made .
155,834
public Session getSysSessionForScript ( Database db ) { Session session = new Session ( db , db . getUserManager ( ) . getSysUser ( ) , false , false , false , 0 , 0 ) ; session . isProcessingScript = true ; return session ; }
Retrieves a new SYS Session .
155,835
public synchronized void closeAllSessions ( ) { Session [ ] sessions = getAllSessions ( ) ; for ( int i = 0 ; i < sessions . length ; i ++ ) { sessions [ i ] . close ( ) ; } }
Closes all Sessions registered with this SessionManager .
155,836
public HostAndPort withDefaultPort ( int defaultPort ) { checkArgument ( isValidPort ( defaultPort ) ) ; if ( hasPort ( ) || port == defaultPort ) { return this ; } return new HostAndPort ( host , defaultPort , hasBracketlessColons ) ; }
Provide a default port if the parsed string contained only a host .
155,837
public Runnable writeCatalogJarToFile ( String path , String name , CatalogJarWriteMode mode ) throws IOException { File catalogFile = new VoltFile ( path , name ) ; File catalogTmpFile = new VoltFile ( path , name + ".tmp" ) ; if ( mode == CatalogJarWriteMode . CATALOG_UPDATE ) { catalogFile . delete ( ) ; catalogTmpF...
Write replace or update the catalog jar based on different cases . This function assumes any IOException should lead to fatal crash .
155,838
public Class < ? > classForProcedureOrUDF ( String procedureClassName ) throws LinkageError , ExceptionInInitializerError , ClassNotFoundException { return classForProcedureOrUDF ( procedureClassName , m_catalogInfo . m_jarfile . getLoader ( ) ) ; }
Given a class name in the catalog jar loads it from the jar even if the jar is served from an URL and isn t in the classpath .
155,839
public DeploymentType getDeployment ( ) { if ( m_memoizedDeployment == null ) { m_memoizedDeployment = CatalogUtil . getDeployment ( new ByteArrayInputStream ( m_catalogInfo . m_deploymentBytes ) ) ; if ( m_memoizedDeployment == null ) { VoltDB . crashLocalVoltDB ( "The internal deployment bytes are invalid. This shou...
Get the JAXB XML Deployment object which is memoized
155,840
public boolean removeAfter ( Node node ) { if ( node == null || node . next == null ) { return false ; } if ( node . next == last ) { last = node ; } node . next = node . next . next ; return true ; }
Removes the given node to allow removel from iterators
155,841
protected ProcedurePartitionData parseCreateProcedureClauses ( ProcedureDescriptor descriptor , String clauses ) throws VoltCompilerException { if ( clauses == null || clauses . isEmpty ( ) ) { return null ; } ProcedurePartitionData data = null ; Matcher matcher = SQLParser . matchAnyCreateProcedureStatementClause ( cl...
Parse and validate the substring containing ALLOW and PARTITION clauses for CREATE PROCEDURE .
155,842
public static void interactWithTheUser ( ) throws Exception { final SQLConsoleReader interactiveReader = new SQLConsoleReader ( new FileInputStream ( FileDescriptor . in ) , System . out ) ; interactiveReader . setBellEnabled ( false ) ; FileHistory historyFile = null ; try { historyFile = new FileHistory ( new File ( ...
The main loop for interactive mode .
155,843
static void executeScriptFiles ( List < FileInfo > filesInfo , SQLCommandLineReader parentLineReader , DDLParserCallback callback ) throws IOException { LineReaderAdapter adapter = null ; SQLCommandLineReader reader = null ; StringBuilder statements = new StringBuilder ( ) ; if ( ! m_interactive && callback == null ) {...
Reads a script file and executes its content . Note that the script file could be an inline batch i . e . a here document that is coming from the same input stream as the file directive .
155,844
private static void printUsage ( String msg ) { System . out . print ( msg ) ; System . out . println ( "\n" ) ; m_exitCode = - 1 ; printUsage ( ) ; }
General application support
155,845
static void printHelp ( OutputStream prtStr ) { try { InputStream is = SQLCommand . class . getResourceAsStream ( m_readme ) ; while ( is . available ( ) > 0 ) { byte [ ] bytes = new byte [ is . available ( ) ] ; is . read ( bytes , 0 , bytes . length ) ; prtStr . write ( bytes ) ; } } catch ( Exception x ) { System . ...
Default visibility is for test purposes .
155,846
public static void main ( String args [ ] ) { System . setProperty ( "voltdb_no_logging" , "true" ) ; int exitCode = mainWithReturnCode ( args ) ; System . exit ( exitCode ) ; }
Application entry point
155,847
private synchronized void checkTimeout ( final long timeoutMs ) { final Entry < Integer , SendWork > oldest = m_outstandingWork . firstEntry ( ) ; if ( oldest != null ) { final long now = System . currentTimeMillis ( ) ; SendWork work = oldest . getValue ( ) ; if ( ( now - work . m_ts ) > timeoutMs ) { StreamSnapshotTi...
Called by the watchdog from the periodic work thread to check if the oldest unacked block is older than the timeout interval .
155,848
synchronized void clearOutstanding ( ) { if ( m_outstandingWork . isEmpty ( ) && ( m_outstandingWorkCount . get ( ) == 0 ) ) { return ; } rejoinLog . trace ( "Clearing outstanding work." ) ; for ( Entry < Integer , SendWork > e : m_outstandingWork . entrySet ( ) ) { e . getValue ( ) . discard ( ) ; } m_outstandingWork ...
Idempotent synchronized method to perform all cleanup of outstanding work so buffers aren t leaked .
155,849
public synchronized void receiveAck ( int blockIndex ) { SendWork work = m_outstandingWork . get ( blockIndex ) ; if ( work == null || work . m_ackCounter == null ) { rejoinLog . warn ( "Received invalid blockIndex ack for targetId " + m_targetId + " for index " + String . valueOf ( blockIndex ) + ( ( work == null ) ? ...
Synchronized method to handle the arrival of an Ack .
155,850
synchronized ListenableFuture < Boolean > send ( StreamSnapshotMessageType type , int blockIndex , BBContainer chunk , boolean replicatedTable ) { SettableFuture < Boolean > sendFuture = SettableFuture . create ( ) ; rejoinLog . trace ( "Sending block " + blockIndex + " of type " + ( replicatedTable ? "REPLICATED " : "...
Send data to the rejoining node tracking what was sent for ack tracking . Synchronized to protect access to m_outstandingWork and to keep m_outstandingWorkCount in sync with m_outstandingWork .
155,851
public static String toSchemaWithoutInlineBatches ( String schema ) { StringBuilder sb = new StringBuilder ( schema ) ; int i = sb . indexOf ( batchSpecificComments ) ; if ( i != - 1 ) { sb . delete ( i , i + batchSpecificComments . length ( ) ) ; } i = sb . indexOf ( startBatch ) ; if ( i != - 1 ) { sb . delete ( i , ...
Given a schema strips out inline batch statements and associated comments .
155,852
final void shutdown ( ) throws InterruptedException { m_timeoutReaperHandle . cancel ( false ) ; m_ex . shutdown ( ) ; if ( CoreUtils . isJunitTest ( ) ) { m_ex . awaitTermination ( 1 , TimeUnit . SECONDS ) ; } else { m_ex . awaitTermination ( 365 , TimeUnit . DAYS ) ; } m_network . shutdown ( ) ; if ( m_cipherService ...
Shutdown the VoltNetwork allowing the Ports to close and free resources like memory pools
155,853
public long getPartitionForParameter ( byte typeValue , Object value ) { if ( m_hashinator == null ) { return - 1 ; } return m_hashinator . getHashedPartitionForParameter ( typeValue , value ) ; }
This is used by clients such as CSVLoader which puts processing into buckets .
155,854
private void refreshPartitionKeys ( boolean topologyUpdate ) { long interval = System . currentTimeMillis ( ) - m_lastPartitionKeyFetched . get ( ) ; if ( ! m_useClientAffinity && interval < PARTITION_KEYS_INFO_REFRESH_FREQUENCY ) { return ; } try { ProcedureInvocation invocation = new ProcedureInvocation ( m_sysHandle...
Set up partitions .
155,855
public void addSortExpressions ( List < AbstractExpression > sortExprs , List < SortDirectionType > sortDirs ) { assert ( sortExprs . size ( ) == sortDirs . size ( ) ) ; for ( int i = 0 ; i < sortExprs . size ( ) ; ++ i ) { addSortExpression ( sortExprs . get ( i ) , sortDirs . get ( i ) ) ; } }
Add multiple sort expressions to the order - by
155,856
public void addSortExpression ( AbstractExpression sortExpr , SortDirectionType sortDir ) { assert ( sortExpr != null ) ; m_sortExpressions . add ( sortExpr . clone ( ) ) ; m_sortDirections . add ( sortDir ) ; }
Add a sort expression to the order - by
155,857
static java . util . logging . Level getPriorityForLevel ( Level level ) { switch ( level ) { case DEBUG : return java . util . logging . Level . FINEST ; case ERROR : return java . util . logging . Level . SEVERE ; case FATAL : return java . util . logging . Level . SEVERE ; case INFO : return java . util . logging . ...
Convert the VoltLogger Level to the java . ulil . logging Level
155,858
void checkAddColumn ( ColumnSchema col ) { if ( table . isText ( ) && ! table . isEmpty ( session ) ) { throw Error . error ( ErrorCode . X_S0521 ) ; } if ( table . findColumn ( col . getName ( ) . name ) != - 1 ) { throw Error . error ( ErrorCode . X_42504 ) ; } if ( col . isPrimaryKey ( ) && table . hasPrimaryKey ( )...
Checks if the attributes of the Column argument c are compatible with the operation of adding such a Column to the Table argument table .
155,859
void makeNewTable ( OrderedHashSet dropConstraintSet , OrderedHashSet dropIndexSet ) { Table tn = table . moveDefinition ( session , table . tableType , null , null , null , - 1 , 0 , dropConstraintSet , dropIndexSet ) ; if ( tn . indexList . length == table . indexList . length ) { database . persistentStoreCollection...
Drops constriants and their indexes in table . Uses set of names .
155,860
Index addIndex ( int [ ] col , HsqlName name , boolean unique , boolean migrating ) { Index newindex ; if ( table . isEmpty ( session ) || table . isIndexingMutable ( ) ) { PersistentStore store = session . sessionData . getRowStore ( table ) ; newindex = table . createIndex ( store , name , col , null , null , unique ...
Because of the way indexes and column data are held in memory and on disk it is necessary to recreate the table when an index is added to a non - empty cached table .
155,861
void dropIndex ( String indexName ) { Index index ; index = table . getIndex ( indexName ) ; if ( table . isIndexingMutable ( ) ) { table . dropIndex ( session , indexName ) ; } else { OrderedHashSet indexSet = new OrderedHashSet ( ) ; indexSet . add ( table . getIndex ( indexName ) . getName ( ) ) ; Table tn = table ....
Because of the way indexes and column data are held in memory and on disk it is necessary to recreate the table when an index is added to or removed from a non - empty table .
155,862
void retypeColumn ( ColumnSchema oldCol , ColumnSchema newCol ) { boolean allowed = true ; int oldType = oldCol . getDataType ( ) . typeCode ; int newType = newCol . getDataType ( ) . typeCode ; if ( ! table . isEmpty ( session ) && oldType != newType ) { allowed = newCol . getDataType ( ) . canConvertFrom ( oldCol . g...
Allows changing the type or addition of an IDENTITY sequence .
155,863
void setColNullability ( ColumnSchema column , boolean nullable ) { Constraint c = null ; int colIndex = table . getColumnIndex ( column . getName ( ) . name ) ; if ( column . isNullable ( ) == nullable ) { return ; } if ( nullable ) { if ( column . isPrimaryKey ( ) ) { throw Error . error ( ErrorCode . X_42526 ) ; } t...
performs the work for changing the nullability of a column
155,864
void setColDefaultExpression ( int colIndex , Expression def ) { if ( def == null ) { table . checkColumnInFKConstraint ( colIndex , Constraint . SET_DEFAULT ) ; } table . setDefaultExpression ( colIndex , def ) ; }
performs the work for changing the default value of a column
155,865
public boolean setTableType ( Session session , int newType ) { int currentType = table . getTableType ( ) ; if ( currentType == newType ) { return false ; } switch ( newType ) { case TableBase . CACHED_TABLE : break ; case TableBase . MEMORY_TABLE : break ; default : return false ; } Table tn ; try { tn = table . move...
Changes the type of a table
155,866
Index addExprIndex ( int [ ] col , Expression [ ] indexExprs , HsqlName name , boolean unique , boolean migrating , Expression predicate ) { Index newindex ; if ( table . isEmpty ( session ) || table . isIndexingMutable ( ) ) { newindex = table . createAndAddExprIndexStructure ( name , col , indexExprs , unique , migra...
A VoltDB extended variant of addIndex that supports indexed generalized non - column expressions .
155,867
Index addIndex ( int [ ] col , HsqlName name , boolean unique , boolean migrating , Expression predicate ) { return addIndex ( col , name , unique , migrating ) . withPredicate ( predicate ) ; }
A VoltDB extended variant of addIndex that supports partial index predicate .
155,868
static public ParsedColInfo fromOrderByXml ( AbstractParsedStmt parsedStmt , VoltXMLElement orderByXml ) { ExpressionAdjuster adjuster = new ExpressionAdjuster ( ) { public AbstractExpression adjust ( AbstractExpression expr ) { ExpressionUtil . finalizeValueTypes ( expr ) ; return expr ; } } ; return fromOrderByXml ( ...
Construct a ParsedColInfo from Volt XML .
155,869
static public ParsedColInfo fromOrderByXml ( AbstractParsedStmt parsedStmt , VoltXMLElement orderByXml , ExpressionAdjuster adjuster ) { assert ( orderByXml . name . equalsIgnoreCase ( "orderby" ) ) ; String desc = orderByXml . attributes . get ( "desc" ) ; boolean descending = ( desc != null ) && ( desc . equalsIgnore...
Construct a ParsedColInfo from Volt XML . Allow caller to specify actions to finalize the parsed expression .
155,870
public SchemaColumn asSchemaColumn ( ) { String columnAlias = ( m_alias == null ) ? m_columnName : m_alias ; return new SchemaColumn ( m_tableName , m_tableAlias , m_columnName , columnAlias , m_expression , m_differentiator ) ; }
Return this as an instance of SchemaColumn
155,871
public static void crashVoltDB ( String reason , String traces [ ] , String filename , int lineno ) { VoltLogger hostLog = new VoltLogger ( "HOST" ) ; String fn = ( filename == null ) ? "unknown" : filename ; String re = ( reason == null ) ? "Fatal EE error." : reason ; hostLog . fatal ( re + " In " + fn + ":" + lineno...
Call VoltDB . crashVoltDB on behalf of the EE
155,872
public byte [ ] nextDependencyAsBytes ( final int dependencyId ) { final VoltTable vt = m_dependencyTracker . nextDependency ( dependencyId ) ; if ( vt != null ) { final ByteBuffer buf2 = PrivateVoltTableFactory . getTableDataReference ( vt ) ; int pos = buf2 . position ( ) ; byte [ ] bytes = new byte [ buf2 . limit ( ...
Called from the ExecutionEngine to request serialized dependencies .
155,873
public void loadCatalog ( long timestamp , String serializedCatalog ) { try { setupProcedure ( null ) ; m_fragmentContext = FragmentContext . CATALOG_LOAD ; coreLoadCatalog ( timestamp , getStringBytes ( serializedCatalog ) ) ; } finally { m_fragmentContext = FragmentContext . UNKNOWN ; } }
Pass the catalog to the engine
155,874
public final void updateCatalog ( final long timestamp , final boolean isStreamUpdate , final String diffCommands ) throws EEException { try { setupProcedure ( null ) ; m_fragmentContext = FragmentContext . CATALOG_UPDATE ; coreUpdateCatalog ( timestamp , isStreamUpdate , diffCommands ) ; } finally { m_fragmentContext ...
Pass diffs to apply to the EE s catalog to update it
155,875
public FastDeserializer executePlanFragments ( int numFragmentIds , long [ ] planFragmentIds , long [ ] inputDepIds , Object [ ] parameterSets , DeterminismHash determinismHash , String [ ] sqlTexts , boolean [ ] isWriteFrags , int [ ] sqlCRCs , long txnId , long spHandle , long lastCommittedSpHandle , long uniqueId , ...
Run multiple plan fragments
155,876
public synchronized void setFlushInterval ( long delay , long seconds ) { if ( m_flush != null ) { m_flush . cancel ( false ) ; m_flush = null ; } if ( seconds > 0 ) { m_flush = m_ses . scheduleAtFixedRate ( new Runnable ( ) { public void run ( ) { try { flush ( ) ; } catch ( Exception e ) { loaderLog . error ( "Failed...
Set periodic flush interval and initial delay in seconds .
155,877
public synchronized void close ( ) { if ( isClosed ) { return ; } rollback ( false ) ; try { database . logger . writeToLog ( this , Tokens . T_DISCONNECT ) ; } catch ( HsqlException e ) { } sessionData . closeAllNavigators ( ) ; sessionData . persistentStoreCollection . clearAllTables ( ) ; sessionData . closeResultCa...
Closes this Session .
155,878
public void setIsolation ( int level ) { if ( isInMidTransaction ( ) ) { throw Error . error ( ErrorCode . X_25001 ) ; } if ( level == SessionInterface . TX_READ_UNCOMMITTED ) { isReadOnly = true ; } isolationMode = level ; if ( isolationMode != isolationModeDefault ) { database . logger . writeToLog ( this , getTransa...
sets ISOLATION for the next transaction only
155,879
void checkDDLWrite ( ) { checkReadWrite ( ) ; if ( isProcessingScript || isProcessingLog ) { return ; } if ( database . isFilesReadOnly ( ) ) { throw Error . error ( ErrorCode . DATABASE_IS_READONLY ) ; } }
This is used for creating new database objects such as tables .
155,880
void addDeleteAction ( Table table , Row row ) { if ( abortTransaction ) { } database . txManager . addDeleteAction ( this , table , row ) ; }
Adds a delete action to the row and the transaction manager .
155,881
public synchronized void setAutoCommit ( boolean autocommit ) { if ( isClosed ) { return ; } if ( autocommit != isAutoCommit ) { commit ( false ) ; isAutoCommit = autocommit ; } }
Setter for the autocommit attribute .
155,882
public synchronized void commit ( boolean chain ) { if ( isClosed ) { return ; } if ( ! isTransaction ) { isReadOnly = isReadOnlyDefault ; isolationMode = isolationModeDefault ; return ; } if ( ! database . txManager . commitTransaction ( this ) ) { rollback ( false ) ; throw Error . error ( ErrorCode . X_40001 ) ; } e...
Commits any uncommited transaction this Session may have open
155,883
public synchronized void rollback ( boolean chain ) { if ( isClosed ) { return ; } if ( ! isTransaction ) { isReadOnly = isReadOnlyDefault ; isolationMode = isolationModeDefault ; return ; } try { database . logger . writeToLog ( this , Tokens . T_ROLLBACK ) ; } catch ( HsqlException e ) { } database . txManager . roll...
Rolls back any uncommited transaction this Session may have open .
155,884
public synchronized void savepoint ( String name ) { int index = sessionContext . savepoints . getIndex ( name ) ; if ( index != - 1 ) { sessionContext . savepoints . remove ( name ) ; sessionContext . savepointTimestamps . remove ( index ) ; } sessionContext . savepoints . add ( name , ValuePool . getInt ( rowActionLi...
Registers a transaction SAVEPOINT . A new SAVEPOINT with the name of an existing one replaces the old SAVEPOINT .
155,885
public synchronized void rollbackToSavepoint ( String name ) { if ( isClosed ) { return ; } int index = sessionContext . savepoints . getIndex ( name ) ; if ( index < 0 ) { throw Error . error ( ErrorCode . X_3B001 , name ) ; } database . txManager . rollbackSavepoint ( this , index ) ; try { database . logger . writeT...
Performs a partial transaction ROLLBACK to savepoint .
155,886
public synchronized void rollbackToSavepoint ( ) { if ( isClosed ) { return ; } String name = ( String ) sessionContext . savepoints . getKey ( 0 ) ; database . txManager . rollbackSavepoint ( this , 0 ) ; try { database . logger . writeToLog ( this , getSavepointRollbackSQL ( name ) ) ; } catch ( HsqlException e ) { }...
Performs a partial transaction ROLLBACK of current savepoint level .
155,887
public synchronized void releaseSavepoint ( String name ) { int index = sessionContext . savepoints . getIndex ( name ) ; if ( index < 0 ) { throw Error . error ( ErrorCode . X_3B001 , name ) ; } while ( sessionContext . savepoints . size ( ) > index ) { sessionContext . savepoints . remove ( sessionContext . savepoint...
Releases a savepoint
155,888
public void setReadOnly ( boolean readonly ) { if ( ! readonly && database . databaseReadOnly ) { throw Error . error ( ErrorCode . DATABASE_IS_READONLY ) ; } if ( isInMidTransaction ( ) ) { throw Error . error ( ErrorCode . X_25001 ) ; } isReadOnly = readonly ; }
sets READ ONLY for next transaction only
155,889
private Result executeResultUpdate ( Result cmd ) { long id = cmd . getResultId ( ) ; int actionType = cmd . getActionType ( ) ; Result result = sessionData . getDataResult ( id ) ; if ( result == null ) { return Result . newErrorResult ( Error . error ( ErrorCode . X_24501 ) ) ; } Object [ ] pvals = cmd . getParameter...
Retrieves the result of inserting updating or deleting a row from an updatable result .
155,890
HsqlName getSchemaHsqlName ( String name ) { return name == null ? currentSchema : database . schemaManager . getSchemaHsqlName ( name ) ; }
If schemaName is null return the current schema name else return the HsqlName object for the schema . If schemaName does not exist throw .
155,891
public String getSchemaName ( String name ) { return name == null ? currentSchema . name : database . schemaManager . getSchemaName ( name ) ; }
Same as above but return string
155,892
public Table defineLocalTable ( HsqlName tableName , HsqlName [ ] colNames , Type [ ] colTypes ) { assert ( localTables != null ) ; Table newTable = TableUtil . newTable ( database , TableBase . CACHED_TABLE , tableName ) ; TableUtil . setColumnsInSchemaTable ( newTable , colNames , colTypes ) ; newTable . createPrimar...
Define a local table with the given name column names and column types .
155,893
public void updateLocalTable ( HsqlName queryName , Type [ ] finalTypes ) { assert ( localTables != null ) ; Table tbl = getLocalTable ( queryName . name ) ; assert ( tbl != null ) ; TableUtil . updateColumnTypes ( tbl , finalTypes ) ; }
Update the local table with new types . This is very dubious .
155,894
void logSequences ( ) { OrderedHashSet set = sessionData . sequenceUpdateSet ; if ( set == null || set . isEmpty ( ) ) { return ; } for ( int i = 0 , size = set . size ( ) ; i < size ; i ++ ) { NumberSequence sequence = ( NumberSequence ) set . get ( i ) ; database . logger . writeSequenceStatement ( this , sequence ) ...
SEQUENCE current values
155,895
public void addLiteralSchema ( String ddlText ) throws IOException { File temp = File . createTempFile ( "literalschema" , "sql" ) ; temp . deleteOnExit ( ) ; FileWriter out = new FileWriter ( temp ) ; out . write ( ddlText ) ; out . close ( ) ; addSchema ( URLEncoder . encode ( temp . getAbsolutePath ( ) , "UTF-8" ) )...
This is test code written by Ryan even though it was committed by John .
155,896
public void addSchema ( String schemaURL ) { try { schemaURL = URLDecoder . decode ( schemaURL , "UTF-8" ) ; } catch ( final UnsupportedEncodingException e ) { e . printStackTrace ( ) ; System . exit ( - 1 ) ; } assert ( m_schemas . contains ( schemaURL ) == false ) ; final File schemaFile = new File ( schemaURL ) ; as...
Add a schema based on a URL .
155,897
private static boolean isParameterized ( VoltXMLElement elm ) { final String name = elm . name ; if ( name . equals ( "value" ) ) { return elm . getBoolAttribute ( "isparam" , false ) ; } else if ( name . equals ( "vector" ) || name . equals ( "row" ) ) { return elm . children . stream ( ) . anyMatch ( ExpressionUtil :...
Helper to check if a VoltXMLElement contains parameter .
155,898
private static String getType ( Database db , VoltXMLElement elm ) { final String type = elm . getStringAttribute ( "valuetype" , "" ) ; if ( ! type . isEmpty ( ) ) { return type ; } else if ( elm . name . equals ( "columnref" ) ) { final String tblName = elm . getStringAttribute ( "table" , "" ) ; final int colIndex =...
Get the underlying type of the VoltXMLElement node . Need reference to the catalog for PVE
155,899
private static String guessParameterType ( Database db , VoltXMLElement elm ) { if ( ! isParameterized ( elm ) || ! elm . name . equals ( "operation" ) ) { return "" ; } else { final ExpressionType op = mapOfVoltXMLOpType . get ( elm . attributes . get ( "optype" ) ) ; assert op != null ; switch ( op ) { case CONJUNCTI...
Guess from a parent node what are the parameter type of its child node should one of its child node contain parameter .