idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
154,900
public ResultSet getVersionColumns ( String catalog , String schema , String table ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; }
Retrieves a description of a table s columns that are automatically updated when any value in a row is updated .
154,901
public boolean supportsConvert ( int fromType , int toType ) throws SQLException { checkClosed ( ) ; switch ( fromType ) { case java . sql . Types . VARCHAR : case java . sql . Types . VARBINARY : case java . sql . Types . TIMESTAMP : case java . sql . Types . OTHER : switch ( toType ) { case java . sql . Types . VARCH...
Retrieves whether this database supports the JDBC scalar function CONVERT for conversions between the JDBC types fromType and toType .
154,902
public boolean supportsResultSetType ( int type ) throws SQLException { checkClosed ( ) ; if ( type == ResultSet . TYPE_SCROLL_INSENSITIVE ) return true ; return false ; }
Retrieves whether this database supports the given result set type .
154,903
public static boolean isInProcessDatabaseType ( String url ) { if ( url == S_FILE || url == S_RES || url == S_MEM ) { return true ; } return false ; }
Returns true if type represents an in - process connection to database .
154,904
public T nextReady ( long systemCurrentTimeMillis ) { if ( delayed . size ( ) == 0 ) { return null ; } if ( delayed . firstKey ( ) > systemCurrentTimeMillis ) { return null ; } Entry < Long , Object [ ] > entry = delayed . pollFirstEntry ( ) ; Object [ ] values = entry . getValue ( ) ; @ SuppressWarnings ( "unchecked" ...
Return the next object that is safe for delivery or null if there are no safe objects to deliver .
154,905
private static byte [ ] readCatalog ( String catalogUrl ) throws IOException { assert ( catalogUrl != null ) ; final int MAX_CATALOG_SIZE = 40 * 1024 * 1024 ; InputStream fin = null ; try { URL url = new URL ( catalogUrl ) ; fin = url . openStream ( ) ; } catch ( MalformedURLException ex ) { fin = new FileInputStream (...
Read catalog bytes from URL
154,906
synchronized public void close ( ) { closed = true ; if ( sqw != null ) { try { if ( layoutHeaderChecked && layout != null && layout . getFooter ( ) != null ) { sendLayoutMessage ( layout . getFooter ( ) ) ; } sqw . close ( ) ; sqw = null ; } catch ( java . io . IOException ex ) { sqw = null ; } } }
Release any resources held by this SyslogAppender .
154,907
public static int getFacility ( String facilityName ) { if ( facilityName != null ) { facilityName = facilityName . trim ( ) ; } if ( "KERN" . equalsIgnoreCase ( facilityName ) ) { return LOG_KERN ; } else if ( "USER" . equalsIgnoreCase ( facilityName ) ) { return LOG_USER ; } else if ( "MAIL" . equalsIgnoreCase ( faci...
Returns the integer value corresponding to the named syslog facility or - 1 if it couldn t be recognized .
154,908
public void activateOptions ( ) { if ( header ) { getLocalHostname ( ) ; } if ( layout != null && layout . getHeader ( ) != null ) { sendLayoutMessage ( layout . getHeader ( ) ) ; } layoutHeaderChecked = true ; }
This method returns immediately as options are activated when they are set .
154,909
private String getPacketHeader ( final long timeStamp ) { if ( header ) { StringBuffer buf = new StringBuffer ( dateFormat . format ( new Date ( timeStamp ) ) ) ; if ( buf . charAt ( 4 ) == '0' ) { buf . setCharAt ( 4 , ' ' ) ; } buf . append ( getLocalHostname ( ) ) ; buf . append ( ' ' ) ; return buf . toString ( ) ;...
Gets HEADER portion of packet .
154,910
private void sendLayoutMessage ( final String msg ) { if ( sqw != null ) { String packet = msg ; String hdr = getPacketHeader ( new Date ( ) . getTime ( ) ) ; if ( facilityPrinting || hdr . length ( ) > 0 ) { StringBuffer buf = new StringBuffer ( hdr ) ; if ( facilityPrinting ) { buf . append ( facilityStr ) ; } buf . ...
Set header or footer of layout .
154,911
protected byte [ ] getGZipData ( ) throws SQLException { byte [ ] bytes = gZipData ( ) ; if ( bytes != null ) { return bytes ; } if ( ( this . outputStream == null ) || ! this . outputStream . isClosed ( ) || this . outputStream . isFreed ( ) ) { throw Exceptions . notReadable ( ) ; } try { setGZipData ( this . outputS...
Retrieves this object s SQLXML value as a gzipped array of bytes possibly by terminating any in - progress write operations and converting accumulated intermediate data .
154,912
protected synchronized void close ( ) { this . closed = true ; setReadable ( false ) ; setWritable ( false ) ; freeOutputStream ( ) ; freeInputStream ( ) ; this . gzdata = null ; }
closes this object and releases the resources that it holds .
154,913
protected < T extends Result > T createResult ( Class < T > resultClass ) throws SQLException { checkWritable ( ) ; setWritable ( false ) ; setReadable ( true ) ; if ( JAXBResult . class . isAssignableFrom ( resultClass ) ) { } else if ( ( resultClass == null ) || StreamResult . class . isAssignableFrom ( resultClass )...
Retrieves a new Result for setting the XML value designated by this SQLXML instance .
154,914
@ SuppressWarnings ( "unchecked" ) protected < T extends Result > T createSAXResult ( Class < T > resultClass ) throws SQLException { SAXResult result = null ; try { result = ( resultClass == null ) ? new SAXResult ( ) : ( SAXResult ) resultClass . newInstance ( ) ; } catch ( SecurityException ex ) { throw Exceptions ....
Retrieves a new SAXResult for setting the XML value designated by this SQLXML instance .
154,915
public List < AbstractExpression > bindingToIndexedExpression ( AbstractExpression expr ) { if ( equals ( expr ) ) { return s_reusableImmutableEmptyBinding ; } return null ; }
Otherwise there is no binding possible indicated by a null return .
154,916
public static Client getClient ( ClientConfig config , String [ ] servers , int port ) throws Exception { config . setTopologyChangeAware ( true ) ; final Client client = ClientFactory . createClient ( config ) ; for ( String server : servers ) { try { client . createConnection ( server . trim ( ) , port ) ; break ; } ...
Get connection to servers in cluster .
154,917
public synchronized void addAdapter ( int pid , InternalClientResponseAdapter adapter ) { final ImmutableMap . Builder < Integer , InternalClientResponseAdapter > builder = ImmutableMap . builder ( ) ; builder . putAll ( m_adapters ) ; builder . put ( pid , adapter ) ; m_adapters = builder . build ( ) ; }
Synchronized in case multiple partitions are added concurrently .
154,918
public boolean hasTable ( String name ) { Table table = getCatalogContext ( ) . tables . get ( name ) ; return ( table != null ) ; }
Returns true if a table with the given name exists in the server catalog .
154,919
public boolean callProcedure ( InternalConnectionContext caller , Function < Integer , Boolean > backPressurePredicate , InternalConnectionStatsCollector statsCollector , ProcedureCallback procCallback , String proc , Object ... fieldList ) { Procedure catProc = InvocationDispatcher . getProcedureFromName ( proc , getC...
Use null backPressurePredicate for no back pressure
154,920
synchronized void registerService ( Promotable service ) { m_services . add ( service ) ; if ( m_isLeader ) { try { service . acceptPromotion ( ) ; } catch ( Exception e ) { VoltDB . crashLocalVoltDB ( "Unable to promote global service." , true , e ) ; } } }
Add a service to be notified if this node becomes the global leader
154,921
void resolveTypesForCaseWhen ( Session session ) { if ( dataType != null ) { return ; } Expression expr = this ; while ( expr . opType == OpTypes . CASEWHEN ) { expr . nodes [ LEFT ] . resolveTypes ( session , expr ) ; if ( expr . nodes [ LEFT ] . isParam ) { expr . nodes [ LEFT ] . dataType = Type . SQL_BOOLEAN ; } ex...
For CASE WHEN and its special cases section 9 . 3 of the SQL standard on type aggregation is implemented .
154,922
public static GeographyPointValue fromWKT ( String param ) { if ( param == null ) { throw new IllegalArgumentException ( "Null well known text argument to GeographyPointValue constructor." ) ; } Matcher m = wktPattern . matcher ( param ) ; if ( m . find ( ) ) { double longitude = toDouble ( m . group ( 1 ) , m . group ...
Create a GeographyPointValue from a well - known text string .
154,923
String formatLngLat ( ) { DecimalFormat df = new DecimalFormat ( "##0.0###########" ) ; double lng = ( Math . abs ( m_longitude ) < EPSILON ) ? 0 : m_longitude ; double lat = ( Math . abs ( m_latitude ) < EPSILON ) ? 0 : m_latitude ; return df . format ( lng ) + " " + df . format ( lat ) ; }
Format the coordinates for this point . Use 12 digits of precision after the decimal point .
154,924
public static GeographyPointValue unflattenFromBuffer ( ByteBuffer inBuffer , int offset ) { double lng = inBuffer . getDouble ( offset ) ; double lat = inBuffer . getDouble ( offset + BYTES_IN_A_COORD ) ; if ( lat == 360.0 && lng == 360.0 ) { return null ; } return new GeographyPointValue ( lng , lat ) ; }
Deserializes a point from a ByteBuffer at an absolute offset .
154,925
private static double normalize ( double v , double range ) { double a = v - Math . floor ( ( v + ( range / 2 ) ) / range ) * range ; if ( Math . abs ( a ) == 180.0 && ( a * v ) < 0 ) { a *= - 1 ; } return a + 0.0 ; }
by subtracting multiples of 360 .
154,926
public GeographyPointValue mul ( double alpha ) { return GeographyPointValue . normalizeLngLat ( getLongitude ( ) * alpha + 0.0 , getLatitude ( ) * alpha + 0.0 ) ; }
Return a point scaled by the given alpha value .
154,927
public GeographyPointValue rotate ( double phi , GeographyPointValue center ) { double sinphi = Math . sin ( 2 * Math . PI * phi / 360.0 ) ; double cosphi = Math . cos ( 2 * Math . PI * phi / 360.0 ) ; double longitude = getLongitude ( ) - center . getLongitude ( ) ; double latitude = getLatitude ( ) - center . getLati...
Return a new point which is this point rotated by the angle phi around a given center point .
154,928
public static void createPersistentZKNodes ( ZooKeeper zk ) { LinkedList < ZKUtil . StringCallback > callbacks = new LinkedList < ZKUtil . StringCallback > ( ) ; for ( int i = 0 ; i < VoltZK . ZK_HIERARCHY . length ; i ++ ) { ZKUtil . StringCallback cb = new ZKUtil . StringCallback ( ) ; callbacks . add ( cb ) ; zk . c...
Race to create the persistent nodes .
154,929
public static List < MailboxNodeContent > parseMailboxContents ( List < String > jsons ) throws JSONException { ArrayList < MailboxNodeContent > objects = new ArrayList < MailboxNodeContent > ( jsons . size ( ) ) ; for ( String json : jsons ) { MailboxNodeContent content = null ; JSONObject jsObj = new JSONObject ( jso...
Helper method for parsing mailbox node contents into Java objects .
154,930
public static boolean createMigratePartitionLeaderInfo ( ZooKeeper zk , MigratePartitionLeaderInfo info ) { try { zk . create ( migrate_partition_leader_info , info . toBytes ( ) , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException e ) { if ( e . code ( ) == KeeperException . Code . NODEEXIST...
Save MigratePartitionLeader information for error handling
154,931
public static MigratePartitionLeaderInfo getMigratePartitionLeaderInfo ( ZooKeeper zk ) { try { byte [ ] data = zk . getData ( migrate_partition_leader_info , null , null ) ; if ( data != null ) { MigratePartitionLeaderInfo info = new MigratePartitionLeaderInfo ( data ) ; return info ; } } catch ( KeeperException | Int...
get MigratePartitionLeader information
154,932
private boolean convertDateTimeLiteral ( Session session , Expression a , Expression b ) { if ( a . dataType . isDateTimeType ( ) ) { } else if ( b . dataType . isDateTimeType ( ) ) { Expression c = a ; a = b ; b = c ; } else { return false ; } if ( a . dataType . isDateTimeTypeWithZone ( ) ) { return false ; } if ( b ...
for compatibility convert a datetime character string to a datetime value for comparison
154,933
void distributeOr ( ) { if ( opType != OpTypes . OR ) { return ; } if ( nodes [ LEFT ] . opType == OpTypes . AND ) { opType = OpTypes . AND ; Expression temp = new ExpressionLogical ( OpTypes . OR , nodes [ LEFT ] . nodes [ RIGHT ] , nodes [ RIGHT ] ) ; nodes [ LEFT ] . opType = OpTypes . OR ; nodes [ LEFT ] . nodes [ ...
Converts an OR containing an AND to an AND
154,934
boolean isSimpleBound ( ) { if ( opType == OpTypes . IS_NULL ) { return true ; } if ( nodes [ RIGHT ] != null ) { if ( nodes [ RIGHT ] . opType == OpTypes . VALUE ) { return true ; } if ( nodes [ RIGHT ] . opType == OpTypes . SQL_FUNCTION ) { if ( ( ( FunctionSQL ) nodes [ RIGHT ] ) . isValueFunction ( ) ) { return tru...
Called only on comparison expressions after reordering which have a COLUMN left leaf
154,935
void swapCondition ( ) { int i = OpTypes . EQUAL ; switch ( opType ) { case OpTypes . GREATER_EQUAL : i = OpTypes . SMALLER_EQUAL ; break ; case OpTypes . SMALLER_EQUAL : i = OpTypes . GREATER_EQUAL ; break ; case OpTypes . SMALLER : i = OpTypes . GREATER ; break ; case OpTypes . GREATER : i = OpTypes . SMALLER ; break...
Swap the condition with its complement
154,936
private boolean voltConvertBinaryIntegerLiteral ( Session session , Expression lhs , Expression rhs ) { Expression nonIntegralExpr ; int whichChild ; if ( lhs . dataType . isIntegralType ( ) ) { nonIntegralExpr = rhs ; whichChild = RIGHT ; } else if ( rhs . dataType . isIntegralType ( ) ) { nonIntegralExpr = lhs ; whic...
If one child is an integer and the other is a VARBINARY literal try to convert the literal to an integer .
154,937
public final void delete ( Row row ) { for ( int i = indexList . length - 1 ; i >= 0 ; i -- ) { indexList [ i ] . delete ( this , row ) ; } remove ( row . getPos ( ) ) ; }
Basic delete with no logging or referential checks .
154,938
public int compare ( final Object a , final Object b ) { final long awhen = ( ( Task ) ( a ) ) . getNextScheduled ( ) ; final long bwhen = ( ( Task ) ( b ) ) . getNextScheduled ( ) ; return ( awhen < bwhen ) ? - 1 : ( awhen == bwhen ) ? 0 : 1 ; }
Required to back the priority queue for scheduled tasks .
154,939
public Object scheduleAfter ( final long delay , final Runnable runnable ) throws IllegalArgumentException { if ( runnable == null ) { throw new IllegalArgumentException ( "runnable == null" ) ; } return this . addTask ( now ( ) + delay , runnable , 0 , false ) ; }
Causes the specified Runnable to be executed once in the background after the specified delay .
154,940
public Object scheduleAt ( final Date date , final Runnable runnable ) throws IllegalArgumentException { if ( date == null ) { throw new IllegalArgumentException ( "date == null" ) ; } else if ( runnable == null ) { throw new IllegalArgumentException ( "runnable == null" ) ; } return this . addTask ( date . getTime ( )...
Causes the specified Runnable to be executed once in the background at the specified time .
154,941
public Object schedulePeriodicallyAt ( final Date date , final long period , final Runnable runnable , final boolean relative ) throws IllegalArgumentException { if ( date == null ) { throw new IllegalArgumentException ( "date == null" ) ; } else if ( period <= 0 ) { throw new IllegalArgumentException ( "period <= 0" )...
Causes the specified Runnable to be executed periodically in the background starting at the specified time .
154,942
public Object schedulePeriodicallyAfter ( final long delay , final long period , final Runnable runnable , final boolean relative ) throws IllegalArgumentException { if ( period <= 0 ) { throw new IllegalArgumentException ( "period <= 0" ) ; } else if ( runnable == null ) { throw new IllegalArgumentException ( "runnabl...
Causes the specified Runnable to be executed periodically in the background starting after the specified delay .
154,943
public synchronized void shutdownImmediately ( ) { if ( ! this . isShutdown ) { final Thread runner = this . taskRunnerThread ; this . isShutdown = true ; if ( runner != null && runner . isAlive ( ) ) { runner . interrupt ( ) ; } this . taskQueue . cancelAllTasks ( ) ; } }
Shuts down this timer immediately interrupting the wait state associated with the current head of the task queue or the wait state internal to the currently executing task if any such state is currently in effect .
154,944
public static boolean isFixedRate ( final Object task ) { if ( task instanceof Task ) { final Task ltask = ( Task ) task ; return ( ltask . relative && ltask . period > 0 ) ; } else { return false ; } }
Retrieves whether the specified argument references a task scheduled periodically using fixed rate scheduling .
154,945
public static boolean isFixedDelay ( final Object task ) { if ( task instanceof Task ) { final Task ltask = ( Task ) task ; return ( ! ltask . relative && ltask . period > 0 ) ; } else { return false ; } }
Retrieves whether the specified argument references a task scheduled periodically using fixed delay scheduling .
154,946
public static Date getLastScheduled ( Object task ) { if ( task instanceof Task ) { final Task ltask = ( Task ) task ; final long last = ltask . getLastScheduled ( ) ; return ( last == 0 ) ? null : new Date ( last ) ; } else { return null ; } }
Retrieves the last time the referenced task was executed as a Date object . If the task has never been executed null is returned .
154,947
public static Date getNextScheduled ( Object task ) { if ( task instanceof Task ) { final Task ltask = ( Task ) task ; final long next = ltask . isCancelled ( ) ? 0 : ltask . getNextScheduled ( ) ; return next == 0 ? null : new Date ( next ) ; } else { return null ; } }
Retrieves the next time the referenced task is due to be executed as a Date object . If the referenced task is cancelled null is returned .
154,948
protected Task addTask ( final long first , final Runnable runnable , final long period , boolean relative ) { if ( this . isShutdown ) { throw new IllegalStateException ( "shutdown" ) ; } final Task task = new Task ( first , runnable , period , relative ) ; this . taskQueue . addTask ( task ) ; this . restart ( ) ; re...
Adds to the task queue a new Task object encapsulating the supplied Runnable and scheduling arguments .
154,949
protected Task nextTask ( ) { try { while ( ! this . isShutdown || Thread . interrupted ( ) ) { long now ; long next ; long wait ; Task task ; synchronized ( this . taskQueue ) { task = this . taskQueue . peekTask ( ) ; if ( task == null ) { break ; } now = System . currentTimeMillis ( ) ; next = task . next ; wait = (...
Retrieves the next task to execute or null if this timer is shutdown the current thread is interrupted or there are no queued tasks .
154,950
ExecutionEngine initializeEE ( ) { String hostname = CoreUtils . getHostnameOrAddress ( ) ; HashinatorConfig hashinatorConfig = TheHashinator . getCurrentConfig ( ) ; ExecutionEngine eeTemp = null ; Deployment deploy = m_context . cluster . getDeployment ( ) . get ( "deployment" ) ; final int defaultDrBufferSize = Inte...
Create a native VoltDB execution engine
154,951
private static void handleUndoLog ( List < UndoAction > undoLog , boolean undo ) { if ( undoLog == null ) { return ; } if ( undo ) { undoLog = Lists . reverse ( undoLog ) ; } for ( UndoAction action : undoLog ) { if ( undo ) { action . undo ( ) ; } else { action . release ( ) ; } } if ( undo ) { undoLog . clear ( ) ; }...
Java level related stuffs that are also needed to roll back
154,952
public boolean updateCatalog ( String diffCmds , CatalogContext context , boolean requiresSnapshotIsolationboolean , boolean isMPI , long txnId , long uniqueId , long spHandle , boolean isReplay , boolean requireCatalogDiffCmdsApplyToEE , boolean requiresNewExportGeneration ) { CatalogContext oldContext = m_context ; m...
Update the catalog . If we re the MPI don t bother with the EE .
154,953
public boolean updateSettings ( CatalogContext context ) { m_context = context ; m_loadedProcedures . loadProcedures ( m_context ) ; m_ee . loadFunctions ( m_context ) ; return true ; }
Update the system settings
154,954
public long [ ] validatePartitioning ( long [ ] tableIds , byte [ ] hashinatorConfig ) { ByteBuffer paramBuffer = m_ee . getParamBufferForExecuteTask ( 4 + ( 8 * tableIds . length ) + 4 + hashinatorConfig . length ) ; paramBuffer . putInt ( tableIds . length ) ; for ( long tableId : tableIds ) { paramBuffer . putLong (...
For the specified list of table ids return the number of mispartitioned rows using the provided hashinator config
154,955
public void generateDREvent ( EventType type , long txnId , long uniqueId , long lastCommittedSpHandle , long spHandle , byte [ ] payloads ) { m_ee . quiesce ( lastCommittedSpHandle ) ; ByteBuffer paramBuffer = m_ee . getParamBufferForExecuteTask ( 32 + 16 + payloads . length ) ; paramBuffer . putInt ( type . ordinal (...
Generate a in - stream DR event which pushes an event buffer to topend
154,956
public boolean areRepairLogsComplete ( ) { for ( Entry < Long , ReplicaRepairStruct > entry : m_replicaRepairStructs . entrySet ( ) ) { if ( ! entry . getValue ( ) . logsComplete ( ) ) { return false ; } } return true ; }
Have all survivors supplied a full repair log?
154,957
public void repairSurvivors ( ) { if ( this . m_promotionResult . isCancelled ( ) ) { repairLogger . debug ( m_whoami + "skipping repair message creation for cancelled Term." ) ; return ; } if ( repairLogger . isDebugEnabled ( ) ) { repairLogger . debug ( m_whoami + "received all repair logs and is repairing surviving ...
Send missed - messages to survivors . Exciting!
154,958
void addToRepairLog ( Iv2RepairLogResponseMessage msg ) { if ( msg . getPayload ( ) == null ) { return ; } if ( msg . getTxnId ( ) <= m_maxSeenCompleteTxnId ) { return ; } Iv2RepairLogResponseMessage prev = m_repairLogUnion . floor ( msg ) ; if ( prev != null && ( prev . getTxnId ( ) != msg . getTxnId ( ) ) ) { prev = ...
replace old messages with complete transaction messages .
154,959
static String getSchemaPath ( String projectFilePath , String path ) throws IOException { File file = null ; if ( path . contains ( ".jar!" ) ) { String ddlText = null ; ddlText = VoltCompilerUtils . readFileFromJarfile ( path ) ; file = VoltProjectBuilder . writeStringToTempFile ( ddlText ) ; } else { file = new File ...
Get the path of a schema file optionally relative to a project . xml file s path .
154,960
public void loadFunctions ( CatalogContext catalogContext ) { final CatalogMap < Function > catalogFunctions = catalogContext . database . getFunctions ( ) ; for ( UserDefinedFunctionRunner runner : m_udfs . values ( ) ) { if ( catalogFunctions . get ( runner . m_functionName ) == null ) { FunctionForVoltDB . deregiste...
Load all the UDFs recorded in the catalog . Instantiate and register them in the system .
154,961
static String readFile ( String file ) { try { FileReader reader = new FileReader ( file ) ; BufferedReader read = new BufferedReader ( reader ) ; StringBuffer b = new StringBuffer ( ) ; String s = null ; int count = 0 ; while ( ( s = read . readLine ( ) ) != null ) { count ++ ; b . append ( s ) ; b . append ( '\n' ) ;...
Redid this file to remove sizing requirements and to make it faster Speeded it up 10 fold .
154,962
static String [ ] getServersFromURL ( String url ) { String prefix = URL_PREFIX + "//" ; int end = url . length ( ) ; if ( url . indexOf ( "?" ) > 0 ) { end = url . indexOf ( "?" ) ; } String servstring = url . substring ( prefix . length ( ) , end ) ; return servstring . split ( "," ) ; }
Static so it s unit - testable yes lazy me
154,963
private void initializeGenerationFromDisk ( final CatalogMap < Connector > connectors , final ExportDataProcessor processor , File [ ] files , List < Pair < Integer , Integer > > localPartitionsToSites , long genId ) { List < Integer > onDiskPartitions = new ArrayList < Integer > ( ) ; NavigableSet < Table > streams = ...
Initialize generation from disk creating data sources from the PBD files .
154,964
void initializeGenerationFromCatalog ( CatalogContext catalogContext , final CatalogMap < Connector > connectors , final ExportDataProcessor processor , int hostId , List < Pair < Integer , Integer > > localPartitionsToSites , boolean isCatalogUpdate ) { m_catalogVersion = catalogContext . catalogVersion ; if ( exportL...
Initialize generation from catalog .
154,965
private void updateStreamStatus ( Set < String > exportedTables ) { synchronized ( m_dataSourcesByPartition ) { for ( Iterator < Map < String , ExportDataSource > > it = m_dataSourcesByPartition . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map < String , ExportDataSource > sources = it . next ( ) ; for ( String...
Mark a DataSource as dropped if its not present in the connectors .
154,966
private void sendDummyTakeMastershipResponse ( long sourceHsid , long requestId , int partitionId , byte [ ] signatureBytes ) { int msgLen = 1 + 4 + 4 + signatureBytes . length + 8 ; ByteBuffer buf = ByteBuffer . allocate ( msgLen ) ; buf . put ( ExportManager . TAKE_MASTERSHIP_RESPONSE ) ; buf . putInt ( partitionId )...
Auto reply a response when the requested stream is no longer exists
154,967
public void updateAckMailboxes ( int partition , Set < Long > newHSIds ) { ImmutableList < Long > replicaHSIds = m_replicasHSIds . get ( partition ) ; synchronized ( m_dataSourcesByPartition ) { Map < String , ExportDataSource > partitionMap = m_dataSourcesByPartition . get ( partition ) ; if ( partitionMap == null ) {...
Access by multiple threads
154,968
private void addDataSources ( Table table , int hostId , List < Pair < Integer , Integer > > localPartitionsToSites , Set < Integer > partitionsInUse , final ExportDataProcessor processor , final long genId , boolean isCatalogUpdate ) { for ( Pair < Integer , Integer > partitionAndSiteId : localPartitionsToSites ) { in...
Add datasources for a catalog table in all partitions
154,969
public void onSourceDrained ( int partitionId , String tableName ) { ExportDataSource source ; synchronized ( m_dataSourcesByPartition ) { Map < String , ExportDataSource > sources = m_dataSourcesByPartition . get ( partitionId ) ; if ( sources == null ) { if ( ! m_removingPartitions . contains ( partitionId ) ) { expo...
The Export Data Source reports it is drained on an unused partition .
154,970
public void add ( int index , Object element ) { if ( index > elementCount ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + ">" + elementCount ) ; } if ( index < 0 ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " < 0" ) ; } if ( elementCount >= elementData . lengt...
Inserts an element at the given index
154,971
public boolean add ( Object element ) { if ( elementCount >= elementData . length ) { increaseCapacity ( ) ; } elementData [ elementCount ] = element ; elementCount ++ ; return true ; }
Appends an element to the end of the list
154,972
public Object get ( int index ) { if ( index >= elementCount ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " >= " + elementCount ) ; } if ( index < 0 ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " < 0" ) ; } return elementData [ index ] ; }
Gets the element at given position
154,973
public Object remove ( int index ) { if ( index >= elementCount ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " >= " + elementCount ) ; } if ( index < 0 ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " < 0" ) ; } Object removedObj = elementData [ index ] ; for ...
Removes and returns the element at given position
154,974
public Object set ( int index , Object element ) { if ( index >= elementCount ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " >= " + elementCount ) ; } if ( index < 0 ) { throw new IndexOutOfBoundsException ( "Index out of bounds: " + index + " < 0" ) ; } Object replacedObj = elementData [...
Replaces the element at given position
154,975
public static boolean bufEquals ( byte onearray [ ] , byte twoarray [ ] ) { if ( onearray == twoarray ) return true ; boolean ret = ( onearray . length == twoarray . length ) ; if ( ! ret ) { return ret ; } for ( int idx = 0 ; idx < onearray . length ; idx ++ ) { if ( onearray [ idx ] != twoarray [ idx ] ) { return fal...
equals function that actually compares two buffers .
154,976
public Connection getConnection ( String curDriverIn , String curCharsetIn , String curTrustStoreIn ) throws ClassNotFoundException , MalformedURLException , SQLException { String curDriver = curDriverIn ; String curCharset = curCharsetIn ; String curTrustStore = curTrustStoreIn ; Properties sysProps = System . getProp...
Gets a JDBC Connection using the data of this RCData object with specified override elements
154,977
static public String tiToString ( int ti ) { switch ( ti ) { case Connection . TRANSACTION_READ_UNCOMMITTED : return "TRANSACTION_READ_UNCOMMITTED" ; case Connection . TRANSACTION_READ_COMMITTED : return "TRANSACTION_READ_COMMITTED" ; case Connection . TRANSACTION_REPEATABLE_READ : return "TRANSACTION_REPEATABLE_READ" ...
Return String for numerical java . sql . Connection Transaction level .
154,978
protected void handleJSONMessageAsDummy ( JSONObject obj ) throws Exception { hostLog . info ( "Generating dummy response for ops request " + obj ) ; sendOpsResponse ( null , obj , OPS_DUMMY ) ; }
For OPS actions generate a dummy response to the distributed work to avoid startup initialization dependencies . Startup can take a long time and we don t want to prevent other agents from making progress
154,979
public void performOpsAction ( final Connection c , final long clientHandle , final OpsSelector selector , final ParameterSet params ) throws Exception { m_es . submit ( new Runnable ( ) { public void run ( ) { try { collectStatsImpl ( c , clientHandle , selector , params ) ; } catch ( Exception e ) { hostLog . warn ( ...
Perform the action associated with this agent using the provided ParameterSet . This is the entry point to the OPS system .
154,980
protected void distributeOpsWork ( PendingOpsRequest newRequest , JSONObject obj ) throws Exception { if ( m_pendingRequests . size ( ) > MAX_IN_FLIGHT_REQUESTS ) { Iterator < Entry < Long , PendingOpsRequest > > iter = m_pendingRequests . entrySet ( ) . iterator ( ) ; final long now = System . currentTimeMillis ( ) ; ...
For OPS actions which run on every node this method will distribute the necessary parameters to its peers on the other cluster nodes . Additionally it will pre - check for excessive outstanding requests and initialize the tracking and timeout of the new request . Subclasses of OpsAgent should use this when they need th...
154,981
protected void sendClientResponse ( PendingOpsRequest request ) { byte statusCode = ClientResponse . SUCCESS ; String statusString = null ; VoltTable responseTables [ ] = request . aggregateTables ; if ( responseTables == null || responseTables . length == 0 ) { responseTables = new VoltTable [ 0 ] ; statusCode = Clien...
Send the final response stored in the PendingOpsRequest to the client which initiated the action . Will be called automagically after aggregating cluster - wide responses but may be called directly by subclasses if necessary .
154,982
private void sendOpsResponse ( VoltTable [ ] results , JSONObject obj , byte payloadType ) throws Exception { long requestId = obj . getLong ( "requestId" ) ; long returnAddress = obj . getLong ( "returnAddress" ) ; if ( results == null ) { ByteBuffer responseBuffer = ByteBuffer . allocate ( 8 ) ; responseBuffer . putL...
Return the results of distributed work to the original requesting agent . Used by subclasses to respond after they ve done their local work .
154,983
private static void addUDFDependences ( Function function , Statement catalogStmt ) { Procedure procedure = ( Procedure ) catalogStmt . getParent ( ) ; addFunctionDependence ( function , procedure , catalogStmt ) ; addStatementDependence ( function , catalogStmt ) ; }
Add all statement dependences both ways .
154,984
private static void addFunctionDependence ( Function function , Procedure procedure , Statement catalogStmt ) { String funcDeps = function . getStmtdependers ( ) ; Set < String > stmtSet = new TreeSet < > ( ) ; for ( String stmtName : funcDeps . split ( "," ) ) { if ( ! stmtName . isEmpty ( ) ) { stmtSet . add ( stmtNa...
Add a dependence to a function of a statement . The function s dependence string is altered with this function .
154,985
private static void addStatementDependence ( Function function , Statement catalogStmt ) { String fnDeps = catalogStmt . getFunctiondependees ( ) ; Set < String > fnSet = new TreeSet < > ( ) ; for ( String fnName : fnDeps . split ( "," ) ) { if ( ! fnName . isEmpty ( ) ) { fnSet . add ( fnName ) ; } } String functionNa...
Add a dependence of a statement to a function . The statement s dependence string is altered with this function .
154,986
static boolean fragmentReferencesPersistentTable ( AbstractPlanNode node ) { if ( node == null ) return false ; if ( node instanceof AbstractScanPlanNode ) return true ; if ( node instanceof InsertPlanNode ) return true ; if ( node instanceof DeletePlanNode ) return true ; if ( node instanceof UpdatePlanNode ) return t...
Check through a plan graph and return true if it ever touches a persistent table .
154,987
public static Procedure compileNibbleDeleteProcedure ( Table catTable , String procName , Column col , ComparisonOperation comp ) { Procedure newCatProc = addProcedure ( catTable , procName ) ; String countingQuery = genSelectSqlForNibbleDelete ( catTable , col , comp ) ; addStatement ( catTable , newCatProc , counting...
Generate small deletion queries by using count - select - delete pattern .
154,988
public static Procedure compileMigrateProcedure ( Table table , String procName , Column column , ComparisonOperation comparison ) { Procedure proc = addProcedure ( table , procName ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "SELECT COUNT(*) FROM " + table . getTypeName ( ) ) ; sb . append ( " WHERE n...
Generate migrate queries by using count - select - migrate pattern .
154,989
public static < E > Collection < E > constrainedCollection ( Collection < E > collection , Constraint < ? super E > constraint ) { return new ConstrainedCollection < E > ( collection , constraint ) ; }
Returns a constrained view of the specified collection using the specified constraint . Any operations that add new elements to the collection will call the provided constraint . However this method does not verify that existing elements satisfy the constraint .
154,990
public static < E > Set < E > constrainedSet ( Set < E > set , Constraint < ? super E > constraint ) { return new ConstrainedSet < E > ( set , constraint ) ; }
Returns a constrained view of the specified set using the specified constraint . Any operations that add new elements to the set will call the provided constraint . However this method does not verify that existing elements satisfy the constraint .
154,991
public static < E > SortedSet < E > constrainedSortedSet ( SortedSet < E > sortedSet , Constraint < ? super E > constraint ) { return new ConstrainedSortedSet < E > ( sortedSet , constraint ) ; }
Returns a constrained view of the specified sorted set using the specified constraint . Any operations that add new elements to the sorted set will call the provided constraint . However this method does not verify that existing elements satisfy the constraint .
154,992
public static < E > List < E > constrainedList ( List < E > list , Constraint < ? super E > constraint ) { return ( list instanceof RandomAccess ) ? new ConstrainedRandomAccessList < E > ( list , constraint ) : new ConstrainedList < E > ( list , constraint ) ; }
Returns a constrained view of the specified list using the specified constraint . Any operations that add new elements to the list will call the provided constraint . However this method does not verify that existing elements satisfy the constraint .
154,993
private static < E > ListIterator < E > constrainedListIterator ( ListIterator < E > listIterator , Constraint < ? super E > constraint ) { return new ConstrainedListIterator < E > ( listIterator , constraint ) ; }
Returns a constrained view of the specified list iterator using the specified constraint . Any operations that would add new elements to the underlying list will be verified by the constraint .
154,994
public final Index createIndex ( PersistentStore store , HsqlName name , int [ ] columns , boolean [ ] descending , boolean [ ] nullsLast , boolean unique , boolean migrating , boolean constraint , boolean forward ) { Index newIndex = createAndAddIndexStructure ( name , columns , descending , nullsLast , unique , migra...
Create new memory - resident index . For MEMORY and TEXT tables .
154,995
public Type getCombinedType ( Type other , int operation ) { if ( operation != OpTypes . CONCAT ) { return getAggregateType ( other ) ; } Type newType ; long newPrecision = precision + other . precision ; switch ( other . typeCode ) { case Types . SQL_ALL_TYPES : return this ; case Types . SQL_BIT : newType = this ; br...
Returns type for concat
154,996
public VoltTable [ ] run ( SystemProcedureExecutionContext ctx ) { if ( ctx . isLowestSiteId ( ) ) { VoltDBInterface voltdb = VoltDB . instance ( ) ; OperationMode opMode = voltdb . getMode ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "voltdb opmode is " + opMode ) ; } ZooKeeper zk = voltdb . getHostMessenger ...
Enter admin mode
154,997
public void setGeneratedColumnInfo ( int generate , ResultMetaData meta ) { if ( type != StatementTypes . INSERT ) { return ; } int colIndex = baseTable . getIdentityColumnIndex ( ) ; if ( colIndex == - 1 ) { return ; } switch ( generate ) { case ResultConstants . RETURN_NO_GENERATED_KEYS : return ; case ResultConstant...
For the creation of the statement
154,998
void checkAccessRights ( Session session ) { if ( targetTable != null && ! targetTable . isTemp ( ) ) { targetTable . checkDataReadOnly ( ) ; session . checkReadWrite ( ) ; } if ( session . isAdmin ( ) ) { return ; } for ( int i = 0 ; i < sequences . length ; i ++ ) { session . getGrantee ( ) . checkAccess ( sequences ...
Determines if the authorizations are adequate to execute the compiled object . Completion requires the list of all database objects in a compiled statement .
154,999
public ResultMetaData getResultMetaData ( ) { switch ( type ) { case StatementTypes . DELETE_WHERE : case StatementTypes . INSERT : case StatementTypes . UPDATE_WHERE : case StatementTypes . MIGRATE_WHERE : return ResultMetaData . emptyResultMetaData ; default : throw Error . runtimeError ( ErrorCode . U_S0500 , "Compi...
Returns the metadata which is empty if the CompiledStatement does not generate a Result .