idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
155,600 | private void getFKStatement ( StringBuffer a ) { if ( ! getName ( ) . isReservedName ( ) ) { a . append ( Tokens . T_CONSTRAINT ) . append ( ' ' ) ; a . append ( getName ( ) . statementName ) ; a . append ( ' ' ) ; } a . append ( Tokens . T_FOREIGN ) . append ( ' ' ) . append ( Tokens . T_KEY ) ; int [ ] col = getRefCo... | Generates the foreign key declaration for a given Constraint object . |
155,601 | private static void getColumnList ( Table t , int [ ] col , int len , StringBuffer a ) { a . append ( '(' ) ; for ( int i = 0 ; i < len ; i ++ ) { a . append ( t . getColumn ( col [ i ] ) . getName ( ) . statementName ) ; if ( i < len - 1 ) { a . append ( ',' ) ; } } a . append ( ')' ) ; } | Generates the column definitions for a table . |
155,602 | private static String getActionString ( int action ) { switch ( action ) { case Constraint . RESTRICT : return Tokens . T_RESTRICT ; case Constraint . CASCADE : return Tokens . T_CASCADE ; case Constraint . SET_DEFAULT : return Tokens . T_SET + ' ' + Tokens . T_DEFAULT ; case Constraint . SET_NULL : return Tokens . T_S... | Returns the foreign key action rule . |
155,603 | boolean isUniqueWithColumns ( int [ ] cols ) { if ( constType != UNIQUE || core . mainCols . length != cols . length ) { return false ; } return ArrayUtil . haveEqualSets ( core . mainCols , cols , cols . length ) ; } | Compares this with another constraint column set . This is used only for UNIQUE constraints . |
155,604 | boolean isEquivalent ( Table mainTable , int [ ] mainCols , Table refTable , int [ ] refCols ) { if ( constType != Constraint . MAIN && constType != Constraint . FOREIGN_KEY ) { return false ; } if ( mainTable != core . mainTable || refTable != core . refTable ) { return false ; } return ArrayUtil . areEqualSets ( core... | Compares this with another constraint column set . This implementation only checks FOREIGN KEY constraints . |
155,605 | void updateTable ( Session session , Table oldTable , Table newTable , int colIndex , int adjust ) { if ( oldTable == core . mainTable ) { core . mainTable = newTable ; if ( core . mainIndex != null ) { core . mainIndex = core . mainTable . getIndex ( core . mainIndex . getName ( ) . name ) ; core . mainCols = ArrayUti... | Used to update constrains to reflect structural changes in a table . Prior checks must ensure that this method does not throw . |
155,606 | void checkInsert ( Session session , Table table , Object [ ] row ) { switch ( constType ) { case CHECK : if ( ! isNotNull ) { checkCheckConstraint ( session , table , row ) ; } return ; case FOREIGN_KEY : PersistentStore store = session . sessionData . getRowStore ( core . mainTable ) ; if ( ArrayUtil . hasNull ( row ... | Checks for foreign key or check constraint violation when inserting a row into the child table . |
155,607 | boolean checkHasMainRef ( Session session , Object [ ] row ) { if ( ArrayUtil . hasNull ( row , core . refCols ) ) { return false ; } PersistentStore store = session . sessionData . getRowStore ( core . mainTable ) ; boolean exists = core . mainIndex . exists ( session , store , row , core . refCols ) ; if ( ! exists )... | For the candidate table row finds any referring node in the main table . This is used to check referential integrity when updating a node . We have to make sure that the main table still holds a valid main record . returns true If a valid row is found false if there are null in the data Otherwise a INTEGRITY VIOLATION ... |
155,608 | void checkReferencedRows ( Session session , Table table , int [ ] rowColArray ) { Index mainIndex = getMainIndex ( ) ; PersistentStore store = session . sessionData . getRowStore ( table ) ; RowIterator it = table . rowIterator ( session ) ; while ( true ) { Row row = it . getNextRow ( ) ; if ( row == null ) { break ;... | Check used before creating a new foreign key cosntraint this method checks all rows of a table to ensure they all have a corresponding row in the main table . |
155,609 | static int chooseTableSize ( int setSize ) { if ( setSize == 1 ) { return 2 ; } int tableSize = Integer . highestOneBit ( setSize - 1 ) << 1 ; while ( tableSize * DESIRED_LOAD_FACTOR < setSize ) { tableSize <<= 1 ; } return tableSize ; } | Returns an array size suitable for the backing array of a hash table that uses open addressing with linear probing in its implementation . The returned size is the smallest power of two that can hold setSize elements with the desired load factor . |
155,610 | public String [ ] decode ( long generation , String tableName , List < VoltType > types , List < String > names , String [ ] to , Object [ ] fields ) throws RuntimeException { Preconditions . checkArgument ( fields != null && fields . length > m_firstFieldOffset , "null or inapropriately sized export row array" ) ; Str... | Converts an object array containing an exported row values into an array of their string representations |
155,611 | Iv2InFlight findHandle ( long ciHandle ) { assert ( ! shouldCheckThreadIdAssertion ( ) || m_expectedThreadId == Thread . currentThread ( ) . getId ( ) ) ; int partitionId = getPartIdFromHandle ( ciHandle ) ; PartitionInFlightTracker partitionStuff = m_trackerMap . get ( partitionId ) ; if ( partitionStuff == null ) { t... | Retrieve the client information for the specified handle |
155,612 | void freeOutstandingTxns ( ) { assert ( ! shouldCheckThreadIdAssertion ( ) || m_expectedThreadId == Thread . currentThread ( ) . getId ( ) ) ; for ( PartitionInFlightTracker tracker : m_trackerMap . values ( ) ) { for ( Iv2InFlight inflight : tracker . m_inFlights . values ( ) ) { m_outstandingTxns -- ; m_acg . reduceB... | When a connection goes away free all resources held by that connection This opens a small window of opportunity for mischief in that work may still be outstanding in the cluster but once the client goes away so does does the mapping to the resources allocated to it . |
155,613 | void loadSchema ( Reader reader , Database db , DdlProceduresToLoad whichProcs ) throws VoltCompiler . VoltCompilerException { int currLineNo = 1 ; DDLStatement stmt = getNextStatement ( reader , m_compiler , currLineNo ) ; while ( stmt != null ) { processVoltDBStatements ( db , whichProcs , stmt ) ; stmt = getNextStat... | Compile a DDL schema from an abstract reader |
155,614 | private String generateDDLForDRConflictsTable ( Database currentDB , Database previousDBIfAny , boolean isCurrentXDCR ) { StringBuilder sb = new StringBuilder ( ) ; if ( isCurrentXDCR ) { createDRConflictTables ( sb , previousDBIfAny ) ; } else { dropDRConflictTablesIfNeeded ( sb ) ; } return sb . toString ( ) ; } | Generate DDL to create or drop the DR conflict table |
155,615 | private void processCreateStreamStatement ( DDLStatement stmt , Database db , DdlProceduresToLoad whichProcs ) throws VoltCompilerException { String statement = stmt . statement ; Matcher statementMatcher = SQLParser . matchCreateStream ( statement ) ; if ( statementMatcher . matches ( ) ) { String tableName = checkIde... | Process a VoltDB - specific create stream DDL statement |
155,616 | private void fillTrackerFromXML ( ) { for ( VoltXMLElement e : m_schema . children ) { if ( e . name . equals ( "table" ) ) { String tableName = e . attributes . get ( "name" ) ; String partitionCol = e . attributes . get ( "partitioncolumn" ) ; String export = e . attributes . get ( "export" ) ; String drTable = e . a... | requested from the compiler |
155,617 | private static boolean indexesAreDups ( Index idx1 , Index idx2 ) { if ( idx1 . getType ( ) != idx2 . getType ( ) ) { return false ; } if ( idx1 . getCountable ( ) != idx2 . getCountable ( ) ) { return false ; } if ( idx1 . getUnique ( ) != idx2 . getUnique ( ) ) { return false ; } if ( idx1 . getAssumeunique ( ) != id... | Return true if the two indexes are identical with a different name . |
155,618 | private void addConstraintToCatalog ( Table table , VoltXMLElement node , Map < String , String > indexReplacementMap , Map < String , Index > indexMap ) throws VoltCompilerException { assert node . name . equals ( "constraint" ) ; String name = node . attributes . get ( "name" ) ; String typeName = node . attributes .... | Add a constraint on a given table to the catalog |
155,619 | private static AbstractExpression buildPartialIndexPredicate ( AbstractParsedStmt dummy , String indexName , VoltXMLElement predicateXML , Table table , VoltCompiler compiler ) throws VoltCompilerException { String tableName = table . getTypeName ( ) ; assert ( tableName != null ) ; StringBuffer msg = new StringBuffer ... | Build the abstract expression representing the partial index predicate . Verify it satisfies the rules . Throw error messages otherwise . |
155,620 | public Result getLob ( Session session , long lobID , long offset , long length ) { throw Error . runtimeError ( ErrorCode . U_S0500 , "LobManager" ) ; } | Used for SUBSTRING |
155,621 | public void close ( ) throws SQLException { try { isClosed = true ; JDBC4ClientConnectionPool . dispose ( NativeConnection ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } } | Releases this Connection object s database and JDBC resources immediately instead of waiting for them to be automatically released . |
155,622 | public Array createArrayOf ( String typeName , Object [ ] elements ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; } | Factory method for creating Array objects . |
155,623 | public Statement createStatement ( ) throws SQLException { checkClosed ( ) ; try { return new JDBC4Statement ( this ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } } | Creates a Statement object for sending SQL statements to the database . |
155,624 | public Struct createStruct ( String typeName , Object [ ] attributes ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; } | Factory method for creating Struct objects . |
155,625 | public PreparedStatement prepareStatement ( String sql , int [ ] columnIndexes ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; } | Creates a default PreparedStatement object capable of returning the auto - generated keys designated by the given array . |
155,626 | public PreparedStatement prepareStatement ( String sql , int resultSetType , int resultSetConcurrency ) throws SQLException { if ( ( resultSetType == ResultSet . TYPE_SCROLL_INSENSITIVE || resultSetType == ResultSet . TYPE_FORWARD_ONLY ) && resultSetConcurrency == ResultSet . CONCUR_READ_ONLY ) { return prepareStatemen... | Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency . |
155,627 | public PreparedStatement prepareStatement ( String sql , int resultSetType , int resultSetConcurrency , int resultSetHoldability ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; } | Creates a PreparedStatement object that will generate ResultSet objects with the given type concurrency and holdability . |
155,628 | public void rollback ( ) throws SQLException { checkClosed ( ) ; if ( props . getProperty ( ROLLBACK_THROW_EXCEPTION , "true" ) . equalsIgnoreCase ( "true" ) ) { throw SQLError . noSupport ( ) ; } } | Undoes all changes made in the current transaction and releases any database locks currently held by this Connection object . |
155,629 | public void setAutoCommit ( boolean autoCommit ) throws SQLException { checkClosed ( ) ; if ( ! autoCommit && ( props . getProperty ( COMMIT_THROW_EXCEPTION , "true" ) . equalsIgnoreCase ( "true" ) ) ) { throw SQLError . noSupport ( ) ; } else { this . autoCommit = autoCommit ; } } | Sets this connection s auto - commit mode to the given state . |
155,630 | public void setReadOnly ( boolean readOnly ) throws SQLException { checkClosed ( ) ; if ( ! Boolean . parseBoolean ( props . getProperty ( "enableSetReadOnly" , "false" ) ) ) { throw SQLError . noSupport ( ) ; } } | Puts this connection in read - only mode as a hint to the driver to enable database optimizations . |
155,631 | public void setTypeMap ( Map < String , Class < ? > > map ) throws SQLException { checkClosed ( ) ; throw SQLError . noSupport ( ) ; } | Installs the given TypeMap object as the type map for this Connection object . |
155,632 | public void saveStatistics ( ClientStats stats , String file ) throws IOException { this . NativeConnection . saveStatistics ( stats , file ) ; } | Save statistics to a file |
155,633 | private static boolean trimProcQuotas ( ZooKeeper zk , String path ) throws KeeperException , IOException , InterruptedException { if ( Quotas . quotaZookeeper . equals ( path ) ) { return true ; } List < String > children = zk . getChildren ( path , false ) ; if ( children . size ( ) == 0 ) { zk . delete ( path , - 1 ... | trim the quota tree to recover unwanted tree elements in the quota s tree |
155,634 | public static boolean delQuota ( ZooKeeper zk , String path , boolean bytes , boolean numNodes ) throws KeeperException , IOException , InterruptedException { String parentPath = Quotas . quotaZookeeper + path ; String quotaPath = Quotas . quotaZookeeper + path + "/" + Quotas . limitNode ; if ( zk . exists ( quotaPath ... | this method deletes quota for a node . |
155,635 | private static int generateCrudPKeyWhereClause ( Column partitioncolumn , Constraint pkey , StringBuilder sb ) { ArrayList < ColumnRef > indexColumns = new ArrayList < ColumnRef > ( pkey . getIndex ( ) . getColumns ( ) . size ( ) ) ; for ( ColumnRef c : pkey . getIndex ( ) . getColumns ( ) ) { indexColumns . add ( c ) ... | Helper to generate a WHERE pkey_col1 = ? pkey_col2 = ? ... ; clause . |
155,636 | private static void generateCrudExpressionColumns ( Table table , StringBuilder sb ) { boolean first = true ; ArrayList < Column > tableColumns = new ArrayList < Column > ( table . getColumns ( ) . size ( ) ) ; for ( Column c : table . getColumns ( ) ) { tableColumns . add ( c ) ; } Collections . sort ( tableColumns , ... | Helper to generate a full col1 = ? col2 = ? ... clause . |
155,637 | public InProcessVoltDBServer start ( ) { DeploymentBuilder depBuilder = new DeploymentBuilder ( sitesPerHost , 1 , 0 ) ; depBuilder . setEnableCommandLogging ( false ) ; depBuilder . setUseDDLSchema ( true ) ; depBuilder . setHTTPDPort ( 8080 ) ; depBuilder . setJSONAPIEnabled ( true ) ; VoltDB . Configuration config =... | Starts the in - process server and blocks until it is ready to accept connections . |
155,638 | public void compile ( Session session ) { if ( ! database . schemaManager . schemaExists ( compileTimeSchema . name ) ) { compileTimeSchema = session . getSchemaHsqlName ( null ) ; } session . setSchema ( compileTimeSchema . name ) ; ParserDQL p = new ParserDQL ( session , new Scanner ( statement ) ) ; p . read ( ) ; v... | Compiles the query expression and sets up the columns . |
155,639 | public static Pair < InMemoryJarfile , String > loadAndUpgradeCatalogFromJar ( byte [ ] catalogBytes , boolean isXDCR ) throws IOException { InMemoryJarfile jarfile = loadInMemoryJarFile ( catalogBytes ) ; return loadAndUpgradeCatalogFromJar ( jarfile , isXDCR ) ; } | Load a catalog from the jar bytes . |
155,640 | public static Pair < InMemoryJarfile , String > loadAndUpgradeCatalogFromJar ( InMemoryJarfile jarfile , boolean isXDCR ) throws IOException { VoltCompiler compiler = new VoltCompiler ( isXDCR ) ; String upgradedFromVersion = compiler . upgradeCatalogAsNeeded ( jarfile ) ; return new Pair < > ( jarfile , upgradedFromVe... | Load a catalog from the InMemoryJarfile . |
155,641 | public static String getSerializedCatalogStringFromJar ( InMemoryJarfile jarfile ) { byte [ ] serializedCatalogBytes = jarfile . get ( CatalogUtil . CATALOG_FILENAME ) ; String serializedCatalog = new String ( serializedCatalogBytes , Constants . UTF8ENCODING ) ; return serializedCatalog ; } | Convenience method to extract the catalog commands from an InMemoryJarfile as a string |
155,642 | public static String [ ] getBuildInfoFromJar ( InMemoryJarfile jarfile ) throws IOException { byte [ ] buildInfoBytes = jarfile . get ( CATALOG_BUILDINFO_FILENAME ) ; if ( buildInfoBytes == null ) { throw new IOException ( "Catalog build information not found - please build your application using the current version of... | Get the catalog build info from the jar bytes . Performs sanity checks on the build info and version strings . |
155,643 | public static String getAutoGenDDLFromJar ( InMemoryJarfile jarfile ) throws IOException { byte [ ] ddlBytes = jarfile . get ( VoltCompiler . AUTOGEN_DDL_FILE_NAME ) ; if ( ddlBytes == null ) { throw new IOException ( "Auto generated schema DDL not found - please make sure the database is initialized with valid schema.... | Get the auto generated DDL from the catalog jar . |
155,644 | public static InMemoryJarfile getCatalogJarWithoutDefaultArtifacts ( final InMemoryJarfile jarfile ) { InMemoryJarfile cloneJar = jarfile . deepCopy ( ) ; for ( String entry : CATALOG_DEFAULT_ARTIFACTS ) { cloneJar . remove ( entry ) ; } return cloneJar ; } | Removes the default voltdb artifact files from catalog and returns the resulltant jar file . This will contain dependency files needed for generated stored procs |
155,645 | public static InMemoryJarfile loadInMemoryJarFile ( byte [ ] catalogBytes ) throws IOException { assert ( catalogBytes != null ) ; InMemoryJarfile jarfile = new InMemoryJarfile ( catalogBytes ) ; if ( ! jarfile . containsKey ( CATALOG_FILENAME ) ) { throw new IOException ( "Database catalog not found - please build you... | Load an in - memory catalog jar file from jar bytes . |
155,646 | public static boolean isSnapshotablePersistentTableView ( Database db , Table table ) { Table materializer = table . getMaterializer ( ) ; if ( materializer == null ) { return false ; } if ( CatalogUtil . isTableExportOnly ( db , materializer ) ) { return false ; } if ( ! table . getIsreplicated ( ) && table . getParti... | Test if a table is a persistent table view and should be included in the snapshot . |
155,647 | public static boolean isSnapshotableStreamedTableView ( Database db , Table table ) { Table materializer = table . getMaterializer ( ) ; if ( materializer == null ) { return false ; } if ( ! CatalogUtil . isTableExportOnly ( db , materializer ) ) { return false ; } Column sourcePartitionColumn = materializer . getParti... | Test if a table is a streamed table view and should be included in the snapshot . |
155,648 | public static long getUniqueIdForFragment ( PlanFragment frag ) { long retval = 0 ; CatalogType parent = frag . getParent ( ) ; retval = ( ( long ) parent . getParent ( ) . getRelativeIndex ( ) ) << 32 ; retval += ( ( long ) parent . getRelativeIndex ( ) ) << 16 ; retval += frag . getRelativeIndex ( ) ; return retval ;... | Get a unique id for a plan fragment by munging the indices of it s parents and grandparents in the catalog . |
155,649 | public static < T extends CatalogType > List < T > getSortedCatalogItems ( CatalogMap < T > items , String sortFieldName ) { assert ( items != null ) ; assert ( sortFieldName != null ) ; TreeMap < Object , T > map = new TreeMap < > ( ) ; boolean hasField = false ; for ( T item : items ) { if ( hasField == false ) { has... | Given a set of catalog items return a sorted list of them sorted by the value of a specified field . The field is specified by name . If the field doesn t exist trip an assertion . This is primarily used to sort a table s columns or a procedure s parameters . |
155,650 | public static < T extends CatalogType > void getSortedCatalogItems ( CatalogMap < T > items , String sortFieldName , List < T > result ) { result . addAll ( getSortedCatalogItems ( items , sortFieldName ) ) ; } | A getSortedCatalogItems variant with the result list filled in - place |
155,651 | public static Index getPrimaryKeyIndex ( Table catalogTable ) throws Exception { Constraint catalog_constraint = null ; for ( Constraint c : catalogTable . getConstraints ( ) ) { if ( c . getType ( ) == ConstraintType . PRIMARY_KEY . getValue ( ) ) { catalog_constraint = c ; break ; } } if ( catalog_constraint == null ... | For a given Table catalog object return the PrimaryKey Index catalog object |
155,652 | public static Collection < Column > getPrimaryKeyColumns ( Table catalogTable ) { Collection < Column > columns = new ArrayList < > ( ) ; Index catalog_idx = null ; try { catalog_idx = CatalogUtil . getPrimaryKeyIndex ( catalogTable ) ; } catch ( Exception ex ) { return ( columns ) ; } assert ( catalog_idx != null ) ; ... | Return all the of the primary key columns for a particular table If the table does not have a primary key then the returned list will be empty |
155,653 | public static boolean isTableExportOnly ( org . voltdb . catalog . Database database , org . voltdb . catalog . Table table ) { int type = table . getTabletype ( ) ; if ( TableType . isInvalidType ( type ) ) { for ( Connector connector : database . getConnectors ( ) ) { for ( ConnectorTableInfo tableInfo : connector . ... | Return true if a table is a stream This function is duplicated in CatalogUtil . h |
155,654 | public static boolean isTableMaterializeViewSource ( org . voltdb . catalog . Database database , org . voltdb . catalog . Table table ) { CatalogMap < Table > tables = database . getTables ( ) ; for ( Table t : tables ) { Table matsrc = t . getMaterializer ( ) ; if ( ( matsrc != null ) && ( matsrc . getRelativeIndex (... | Return true if a table is the source table for a materialized view . |
155,655 | public static List < Table > getMaterializeViews ( org . voltdb . catalog . Database database , org . voltdb . catalog . Table table ) { ArrayList < Table > tlist = new ArrayList < > ( ) ; CatalogMap < Table > tables = database . getTables ( ) ; for ( Table t : tables ) { Table matsrc = t . getMaterializer ( ) ; if ( (... | Return list of materialized view for table . |
155,656 | public static boolean isCatalogCompatible ( String catalogVersionStr ) { if ( catalogVersionStr == null || catalogVersionStr . isEmpty ( ) ) { return false ; } Object [ ] catalogVersion = MiscUtils . parseVersionString ( catalogVersionStr ) ; if ( catalogVersion == null ) { throw new IllegalArgumentException ( "Invalid... | Check if a catalog compiled with the given version of VoltDB is compatible with the current version of VoltDB . |
155,657 | public static boolean isCatalogVersionValid ( String catalogVersionStr ) { if ( catalogVersionStr == null || catalogVersionStr . isEmpty ( ) ) { return false ; } Object [ ] catalogVersion = MiscUtils . parseVersionString ( catalogVersionStr ) ; if ( catalogVersion == null ) { return false ; } return true ; } | Check if a catalog version string is valid . |
155,658 | public static String compileDeployment ( Catalog catalog , DeploymentType deployment , boolean isPlaceHolderCatalog ) { String errmsg = null ; try { validateDeployment ( catalog , deployment ) ; if ( catalog . getClusters ( ) . get ( "cluster" ) . getDeployment ( ) . get ( "deployment" ) == null ) { catalog . getCluste... | Parse the deployment . xml file and add its data into the catalog . |
155,659 | public static DeploymentType parseDeployment ( String deploymentURL ) { InputStream deployIS = null ; try { URL deployURL = new URL ( deploymentURL ) ; deployIS = deployURL . openStream ( ) ; } catch ( MalformedURLException ex ) { try { deployIS = new FileInputStream ( deploymentURL ) ; } catch ( FileNotFoundException ... | Parses the deployment XML file . |
155,660 | public static DeploymentType parseDeploymentFromString ( String deploymentString ) { ByteArrayInputStream byteIS ; byteIS = new ByteArrayInputStream ( deploymentString . getBytes ( Constants . UTF8ENCODING ) ) ; return getDeployment ( byteIS ) ; } | Parses the deployment XML string . |
155,661 | public static String getDeployment ( DeploymentType deployment , boolean indent ) throws IOException { try { if ( m_jc == null || m_schema == null ) { throw new RuntimeException ( "Error schema validation." ) ; } Marshaller marshaller = m_jc . createMarshaller ( ) ; marshaller . setSchema ( m_schema ) ; marshaller . se... | Given the deployment object generate the XML |
155,662 | private static void validateDeployment ( Catalog catalog , DeploymentType deployment ) { if ( deployment . getSecurity ( ) != null && deployment . getSecurity ( ) . isEnabled ( ) ) { if ( deployment . getUsers ( ) == null ) { String msg = "Cannot enable security without defining at least one user in the built-in ADMINI... | Validate the contents of the deployment . xml file . This is for validating VoltDB requirements not XML schema correctness |
155,663 | private static void setClusterInfo ( Catalog catalog , DeploymentType deployment ) { ClusterType cluster = deployment . getCluster ( ) ; int kFactor = cluster . getKfactor ( ) ; Cluster catCluster = catalog . getClusters ( ) . get ( "cluster" ) ; Deployment catDeploy = catCluster . getDeployment ( ) . get ( "deployment... | Set cluster info in the catalog . |
155,664 | private static void setImportInfo ( Catalog catalog , ImportType importType ) { if ( importType == null ) { return ; } List < String > streamList = new ArrayList < > ( ) ; List < ImportConfigurationType > kafkaConfigs = new ArrayList < > ( ) ; for ( ImportConfigurationType importConfiguration : importType . getConfigur... | Set deployment time settings for import |
155,665 | private static void validateKafkaConfig ( List < ImportConfigurationType > configs ) { if ( configs . isEmpty ( ) ) { return ; } HashMap < String , HashSet < String > > groupidToTopics = new HashMap < > ( ) ; for ( ImportConfigurationType config : configs ) { String groupid = "" ; HashSet < String > topics = new HashSe... | Check whether two Kafka configurations have both the same topic and group id . If two configurations have the same group id and overlapping sets of topics a RuntimeException will be thrown . |
155,666 | private static void setSnmpInfo ( SnmpType snmpType ) { if ( snmpType == null || ! snmpType . isEnabled ( ) ) { return ; } if ( snmpType . getTarget ( ) == null || snmpType . getTarget ( ) . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( "Target must be specified for SNMP configuration." ) ; } if (... | Validate Snmp Configuration . |
155,667 | private static void mergeKafka10ImportConfigurations ( Map < String , ImportConfiguration > processorConfig ) { if ( processorConfig . isEmpty ( ) ) { return ; } Map < String , ImportConfiguration > kafka10ProcessorConfigs = new HashMap < > ( ) ; Iterator < Map . Entry < String , ImportConfiguration > > iter = processo... | aggregate Kafka10 importer configurations . One importer per brokers and kafka group . Formatters and stored procedures can vary by topics . |
155,668 | private static void setSecurityEnabled ( Catalog catalog , SecurityType security ) { Cluster cluster = catalog . getClusters ( ) . get ( "cluster" ) ; Database database = cluster . getDatabases ( ) . get ( "database" ) ; cluster . setSecurityenabled ( security . isEnabled ( ) ) ; database . setSecurityprovider ( securi... | Set the security setting in the catalog from the deployment file |
155,669 | private static void setSnapshotInfo ( Catalog catalog , SnapshotType snapshotSettings ) { Database db = catalog . getClusters ( ) . get ( "cluster" ) . getDatabases ( ) . get ( "database" ) ; SnapshotSchedule schedule = db . getSnapshotschedule ( ) . get ( "default" ) ; if ( schedule == null ) { schedule = db . getSnap... | Set the auto - snapshot settings in the catalog from the deployment file |
155,670 | private static void setupPaths ( PathsType paths ) { File voltDbRoot ; voltDbRoot = getVoltDbRoot ( paths ) ; setupSnapshotPaths ( paths . getSnapshots ( ) , voltDbRoot ) ; setupExportOverflow ( paths . getExportoverflow ( ) , voltDbRoot ) ; setupCommandLog ( paths . getCommandlog ( ) , voltDbRoot ) ; setupCommandLogSn... | Set voltroot path and set the path overrides for export overflow partition etc . |
155,671 | public static File getVoltDbRoot ( PathsType paths ) { File voltDbRoot ; if ( paths == null || paths . getVoltdbroot ( ) == null || VoltDB . instance ( ) . getVoltDBRootPath ( paths . getVoltdbroot ( ) ) == null ) { voltDbRoot = new VoltFile ( VoltDB . DBROOT ) ; if ( ! voltDbRoot . exists ( ) ) { hostLog . info ( "Cre... | Get a File object representing voltdbroot . Create directory if missing . Use paths if non - null to get override default location . |
155,672 | private static void setUsersInfo ( Catalog catalog , UsersType users ) throws RuntimeException { if ( users == null ) { return ; } Database db = catalog . getClusters ( ) . get ( "cluster" ) . getDatabases ( ) . get ( "database" ) ; SecureRandom sr = new SecureRandom ( ) ; for ( UsersType . User user : users . getUser ... | Set user info in the catalog . |
155,673 | private static Set < String > extractUserRoles ( final UsersType . User user ) { Set < String > roles = new TreeSet < > ( ) ; if ( user == null ) { return roles ; } if ( user . getRoles ( ) != null && ! user . getRoles ( ) . trim ( ) . isEmpty ( ) ) { String [ ] rolelist = user . getRoles ( ) . trim ( ) . split ( "," )... | Takes the list of roles specified in the roles user attributes and returns a set from the comma - separated list |
155,674 | public static byte [ ] makeDeploymentHash ( byte [ ] inbytes ) { MessageDigest md = null ; try { md = MessageDigest . getInstance ( "SHA-1" ) ; } catch ( NoSuchAlgorithmException e ) { VoltDB . crashLocalVoltDB ( "Bad JVM has no SHA-1 hash." , true , e ) ; } md . update ( inbytes ) ; byte [ ] hash = md . digest ( ) ; a... | This code appeared repeatedly . Extract method to take bytes for the catalog or deployment file do the irritating exception crash test jam the bytes in and get the SHA - 1 hash . |
155,675 | public static Pair < Set < String > , Set < String > > getSnapshotableTableNamesFromInMemoryJar ( InMemoryJarfile jarfile ) { Set < String > fullTableNames = new HashSet < > ( ) ; Set < String > optionalTableNames = new HashSet < > ( ) ; Catalog catalog = new Catalog ( ) ; catalog . execute ( getSerializedCatalogString... | Get all snapshot - able table names from an in - memory catalog jar file . A snapshot - able table is one that s neither an export table nor an implicitly partitioned view . |
155,676 | public static Pair < List < Table > , Set < String > > getSnapshotableTables ( Database catalog , boolean isReplicated ) { List < Table > tables = new ArrayList < > ( ) ; Set < String > optionalTableNames = new HashSet < > ( ) ; for ( Table table : catalog . getTables ( ) ) { if ( table . getIsreplicated ( ) != isRepli... | Get all snapshot - able tables from the catalog . A snapshot - able table is one that s neither an export table nor an implicitly partitioned view . |
155,677 | public static List < Table > getNormalTables ( Database catalog , boolean isReplicated ) { List < Table > tables = new ArrayList < > ( ) ; for ( Table table : catalog . getTables ( ) ) { if ( ( table . getIsreplicated ( ) == isReplicated ) && table . getMaterializer ( ) == null && ! CatalogUtil . isTableExportOnly ( ca... | Get all normal tables from the catalog . A normal table is one that s NOT a materialized view nor an export table . For the lack of a better name I call it normal . |
155,678 | public static boolean isDurableProc ( String procName ) { SystemProcedureCatalog . Config sysProc = SystemProcedureCatalog . listing . get ( procName ) ; return sysProc == null || sysProc . isDurable ( ) ; } | Return if given proc is durable if its a sysproc SystemProcedureCatalog is consulted . All non sys procs are all durable . |
155,679 | public static File createTemporaryEmptyCatalogJarFile ( boolean isXDCR ) throws IOException { File emptyJarFile = File . createTempFile ( "catalog-empty" , ".jar" ) ; emptyJarFile . deleteOnExit ( ) ; VoltCompiler compiler = new VoltCompiler ( isXDCR ) ; if ( ! compiler . compileEmptyCatalog ( emptyJarFile . getAbsolut... | Build an empty catalog jar file . |
155,680 | public static String getSignatureForTable ( String name , SortedMap < Integer , VoltType > schema ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( name ) . append ( SIGNATURE_TABLE_NAME_SEPARATOR ) ; for ( VoltType t : schema . values ( ) ) { sb . append ( t . getSignatureChar ( ) ) ; } return sb . toString... | Get a string signature for the table represented by the args |
155,681 | public static Pair < Long , String > calculateDrTableSignatureAndCrc ( Database catalog ) { SortedSet < Table > tables = Sets . newTreeSet ( ) ; tables . addAll ( getSnapshotableTables ( catalog , true ) . getFirst ( ) ) ; tables . addAll ( getSnapshotableTables ( catalog , false ) . getFirst ( ) ) ; final PureJavaCrc3... | Deterministically serializes all DR table signatures into a string and calculates the CRC checksum . |
155,682 | public static Map < String , String > deserializeCatalogSignature ( String signature ) { Map < String , String > tableSignatures = Maps . newHashMap ( ) ; for ( String oneSig : signature . split ( Pattern . quote ( SIGNATURE_DELIMITER ) ) ) { if ( ! oneSig . isEmpty ( ) ) { final String [ ] parts = oneSig . split ( Pat... | Deserializes a catalog DR table signature string into a map of table signatures . |
155,683 | public static String getLimitPartitionRowsDeleteStmt ( Table table ) { CatalogMap < Statement > map = table . getTuplelimitdeletestmt ( ) ; if ( map . isEmpty ( ) ) { return null ; } assert ( map . size ( ) == 1 ) ; return map . iterator ( ) . next ( ) . getSqltext ( ) ; } | Given a table return the DELETE statement that can be executed by a LIMIT PARTITION ROWS constraint or NULL if there isn t one . |
155,684 | public static ExportType addExportConfigToDRConflictsTable ( ExportType export ) { if ( export == null ) { export = new ExportType ( ) ; } boolean userDefineStream = false ; for ( ExportConfigurationType exportConfiguration : export . getConfiguration ( ) ) { if ( exportConfiguration . getTarget ( ) . equals ( DR_CONFL... | Add default configuration to DR conflicts export target if deployment file doesn t have the configuration |
155,685 | public synchronized void printResults ( ) throws Exception { ClientStats stats = fullStatsContext . fetch ( ) . getStats ( ) ; String display = "\nA total of %d login requests were received...\n" ; System . out . printf ( display , stats . getInvocationsCompleted ( ) ) ; System . out . printf ( "Average throughput: ... | Prints the results and statistics of the data load . |
155,686 | private void doLogin ( LoginGenerator . LoginRecord login ) { try { ClientResponse response = client . callProcedure ( "Login" , login . username , login . password , login . json ) ; long resultCode = response . getResults ( ) [ 0 ] . asScalarLong ( ) ; if ( resultCode == LOGIN_SUCCESSFUL ) acceptedLogins . incrementA... | Invoke the Login stored procedure to add a login record to the database . If the login is called multiple times for the same username the last accessed time for the login is updated . Thus this sample client can be run repeatedly without having to cycle the database . |
155,687 | public void loadDatabase ( ) throws Exception { int thread_count = 10 ; Thread [ ] loginThreads = new Thread [ thread_count ] ; for ( int i = 0 ; i < thread_count ; ++ i ) { loginThreads [ i ] = new Thread ( new LoginThread ( ) ) ; loginThreads [ i ] . start ( ) ; } fullStatsContext . fetchAndResetBaseline ( ) ; System... | Load the database with as much data as possible within the specified time range . |
155,688 | public static void main ( String [ ] args ) throws Exception { JSONClient app = new JSONClient ( ) ; app . initialize ( ) ; app . loadDatabase ( ) ; app . runQueries ( ) ; app . shutdown ( ) ; } | Main routine creates a client instance loads the database then executes example queries against the data . |
155,689 | public synchronized void reportForeignHostFailed ( int hostId ) { long initiatorSiteId = CoreUtils . getHSIdFromHostAndSite ( hostId , AGREEMENT_SITE_ID ) ; m_agreementSite . reportFault ( initiatorSiteId ) ; if ( ! m_shuttingDown ) { networkLog . warn ( String . format ( "Host %d failed. Cluster remains operational." ... | Synchronization protects m_knownFailedHosts and ensures that every failed host is only reported once |
155,690 | public void start ( ) throws Exception { CountDownLatch zkInitBarrier = new CountDownLatch ( 1 ) ; if ( m_joiner . start ( zkInitBarrier ) ) { m_network . start ( ) ; long agreementHSId = getHSIdForLocalSite ( AGREEMENT_SITE_ID ) ; HashSet < Long > agreementSites = new HashSet < Long > ( ) ; agreementSites . add ( agre... | Start the host messenger and connect to the leader or become the leader if necessary . |
155,691 | public InstanceId getInstanceId ( ) { if ( m_instanceId == null ) { try { byte [ ] data = m_zk . getData ( CoreZK . instance_id , false , null ) ; JSONObject idJSON = new JSONObject ( new String ( data , "UTF-8" ) ) ; m_instanceId = new InstanceId ( idJSON . getInt ( "coord" ) , idJSON . getLong ( "timestamp" ) ) ; } c... | Get a unique ID for this cluster |
155,692 | public void requestJoin ( SocketChannel socket , SSLEngine sslEngine , MessagingChannel messagingChannel , InetSocketAddress listeningAddress , JSONObject jo ) throws Exception { Integer hostId = selectNewHostId ( socket . socket ( ) . getInetAddress ( ) . getHostAddress ( ) ) ; prepSocketChannel ( socket ) ; ForeignHo... | Any node can serve a request to join . The coordination of generating a new host id is done via ZK |
155,693 | public void notifyOfConnection ( int hostId , SocketChannel socket , SSLEngine sslEngine , InetSocketAddress listeningAddress ) throws Exception { networkLog . info ( "Host " + getHostId ( ) + " receives a new connection from host " + hostId ) ; prepSocketChannel ( socket ) ; ForeignHost fhost = new ForeignHost ( this ... | SocketJoiner receives the request of creating a new connection from given host id create a new ForeignHost for this connection . |
155,694 | public Map < Integer , HostInfo > waitForGroupJoin ( int expectedHosts ) { Map < Integer , HostInfo > hostInfos = Maps . newTreeMap ( ) ; try { while ( true ) { ZKUtil . FutureWatcher fw = new ZKUtil . FutureWatcher ( ) ; final List < String > children = m_zk . getChildren ( CoreZK . hosts , fw ) ; final int numChildre... | Wait until all the nodes have built a mesh . |
155,695 | public String getHostnameForHostID ( int hostId ) { if ( hostId == m_localHostId ) { return CoreUtils . getHostnameOrAddress ( ) ; } Iterator < ForeignHost > it = m_foreignHosts . get ( hostId ) . iterator ( ) ; if ( it . hasNext ( ) ) { ForeignHost fh = it . next ( ) ; return fh . hostname ( ) ; } return m_knownFailed... | Given a hostid return the hostname for it |
155,696 | public void removeMailbox ( long hsId ) { synchronized ( m_mapLock ) { ImmutableMap . Builder < Long , Mailbox > b = ImmutableMap . builder ( ) ; for ( Map . Entry < Long , Mailbox > e : m_siteMailboxes . entrySet ( ) ) { if ( e . getKey ( ) . equals ( hsId ) ) { continue ; } b . put ( e . getKey ( ) , e . getValue ( )... | Discard a mailbox |
155,697 | public void waitForAllHostsToBeReady ( int expectedHosts ) { try { m_zk . create ( CoreZK . readyhosts_host , null , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL_SEQUENTIAL ) ; while ( true ) { ZKUtil . FutureWatcher fw = new ZKUtil . FutureWatcher ( ) ; int readyHosts = m_zk . getChildren ( CoreZK . readyhosts , fw ... | Block on this call until the number of ready hosts is equal to the number of expected hosts . |
155,698 | public void waitForJoiningHostsToBeReady ( int expectedHosts , int localHostId ) { try { m_zk . create ( ZKUtil . joinZKPath ( CoreZK . readyjoininghosts , Integer . toString ( localHostId ) ) , null , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; while ( true ) { ZKUtil . FutureWatcher fw = new ZKUtil . FutureWa... | For elastic join . Block on this call until the number of ready hosts is equal to the number of expected joining hosts . |
155,699 | public int countForeignHosts ( ) { int retval = 0 ; for ( ForeignHost host : m_foreignHosts . values ( ) ) { if ( ( host != null ) && ( host . isUp ( ) ) ) { retval ++ ; } } return retval ; } | Get the number of up foreign hosts . Used for test purposes . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.