idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
30,800 | VoltTable executePrecompiledSQL ( Statement catStmt , Object [ ] params , boolean replicated ) throws VoltAbortException { SQLStmt stmt = new SQLStmt ( catStmt . getSqltext ( ) ) ; if ( replicated ) { stmt . setInCatalog ( false ) ; } m_runner . initSQLStmt ( stmt , catStmt ) ; voltQueueSQL ( stmt , params ) ; return v... | Execute a pre - compiled adHoc SQL statement throw exception if not . |
30,801 | protected static void printLogStatic ( String className , String msg , Object ... args ) { if ( args != null ) { msg = String . format ( msg , args ) ; } String header = String . format ( "%s [%s] " , ZonedDateTime . now ( ) . format ( TIME_FORMAT ) , className ) ; System . out . println ( String . format ( "%s%s" , he... | The static method to print a log message to the console . |
30,802 | StatementSimple compileSetStatement ( RangeVariable rangeVars [ ] ) { read ( ) ; OrderedHashSet colNames = new OrderedHashSet ( ) ; HsqlArrayList exprList = new HsqlArrayList ( ) ; readSetClauseList ( rangeVars , colNames , exprList ) ; if ( exprList . size ( ) > 1 ) { throw Error . error ( ErrorCode . X_42602 ) ; } Ex... | Creates SET Statement for PSM from this parse context . |
30,803 | StatementSchema compileCreateProcedureOrFunction ( ) { int routineType = token . tokenType == Tokens . PROCEDURE ? SchemaObject . PROCEDURE : SchemaObject . FUNCTION ; HsqlName name ; read ( ) ; name = readNewSchemaObjectNameNoCheck ( routineType ) ; Routine routine = new Routine ( routineType ) ; routine . setName ( n... | SQL - invoked routine |
30,804 | void close ( boolean script ) { closeLog ( ) ; deleteNewAndOldFiles ( ) ; writeScript ( script ) ; closeAllTextCaches ( script ) ; if ( cache != null ) { cache . close ( true ) ; } properties . setProperty ( HsqlDatabaseProperties . db_version , HsqlDatabaseProperties . THIS_VERSION ) ; properties . setProperty ( HsqlD... | Close all the database files . If script argument is true no . data or . backup file will remain and the . script file will contain all the data of the cached tables as well as memory tables . |
30,805 | void deleteNewAndOldFiles ( ) { fa . removeElement ( fileName + ".data" + ".old" ) ; fa . removeElement ( fileName + ".data" + ".new" ) ; fa . removeElement ( fileName + ".backup" + ".new" ) ; fa . removeElement ( scriptFileName + ".new" ) ; } | Deletes the leftovers from any previous unfinished operations . |
30,806 | boolean forceDefrag ( ) { long megas = properties . getIntegerProperty ( HsqlDatabaseProperties . hsqldb_defrag_limit , 200 ) ; long defraglimit = megas * 1024L * 1024 ; long lostSize = cache . freeBlocks . getLostBlocksSize ( ) ; return lostSize > defraglimit ; } | Returns true if lost space is above the threshold |
30,807 | DataFileCache getCache ( ) { if ( cache == null ) { cache = new DataFileCache ( database , fileName ) ; cache . open ( filesReadOnly ) ; } return cache ; } | Responsible for creating the cache instance . |
30,808 | void setScriptType ( int type ) { if ( database . isStoredFileAccess ( ) ) { return ; } boolean needsCheckpoint = scriptFormat != type ; scriptFormat = type ; properties . setProperty ( HsqlDatabaseProperties . hsqldb_script_format , String . valueOf ( scriptFormat ) ) ; if ( needsCheckpoint ) { database . logger . nee... | Changing the script format results in a checkpoint with the . script file written in the new format . |
30,809 | private void writeScript ( boolean full ) { deleteNewScript ( ) ; ScriptWriterBase scw = ScriptWriterBase . newScriptWriter ( database , scriptFileName + ".new" , full , true , scriptFormat ) ; scw . writeAll ( ) ; scw . close ( ) ; } | Write the . script file as . script . new . |
30,810 | private void processScript ( ) { ScriptReaderBase scr = null ; try { if ( database . isFilesInJar ( ) || fa . isStreamElement ( scriptFileName ) ) { scr = ScriptReaderBase . newScriptReader ( database , scriptFileName , scriptFormat ) ; Session session = database . sessionManager . getSysSessionForScript ( database ) ;... | Performs all the commands in the . script file . |
30,811 | private void processDataFile ( ) { if ( database . isStoredFileAccess ( ) ) { return ; } if ( cache == null || filesReadOnly || ! fa . isStreamElement ( logFileName ) ) { return ; } File file = new File ( logFileName ) ; long logLength = file . length ( ) ; long dataLength = cache . getFileFreePos ( ) ; if ( logLength ... | Defrag large data files when the sum of . log and . data files is large . |
30,812 | private void processLog ( ) { if ( ! database . isFilesInJar ( ) && fa . isStreamElement ( logFileName ) ) { ScriptRunner . runScript ( database , logFileName , ScriptWriterBase . SCRIPT_TEXT_170 ) ; } } | Performs all the commands in the . log file . |
30,813 | private void restoreBackup ( ) { if ( incBackup ) { restoreBackupIncremental ( ) ; return ; } DataFileCache . deleteOrResetFreePos ( database , fileName + ".data" ) ; try { FileArchiver . unarchive ( fileName + ".backup" , fileName + ".data" , database . getFileAccess ( ) , FileArchiver . COMPRESSION_ZIP ) ; } catch ( ... | Restores a compressed backup or the . data file . |
30,814 | private void restoreBackupIncremental ( ) { try { if ( fa . isStreamElement ( fileName + ".backup" ) ) { RAShadowFile . restoreFile ( fileName + ".backup" , fileName + ".data" ) ; } else { } deleteBackup ( ) ; } catch ( IOException e ) { throw Error . error ( ErrorCode . FILE_IO_ERROR , fileName + ".backup" ) ; } } | Restores in from an incremental backup |
30,815 | public void updateCatalog ( String diffCmds , CatalogContext context , boolean isReplay , boolean requireCatalogDiffCmdsApplyToEE , boolean requiresNewExportGeneration ) { m_executionSite . updateCatalog ( diffCmds , context , false , true , Long . MIN_VALUE , Long . MIN_VALUE , Long . MIN_VALUE , isReplay , requireCat... | Update the MPI s Site s catalog . Unlike the SPI this is not going to run from the same Site s thread ; this is actually going to run from some other local SPI s Site thread . Since the MPI s site thread is going to be blocked running the EveryPartitionTask for the catalog update this is currently safe with no locking ... |
30,816 | public static Pair < AbstractTopology , ImmutableList < Integer > > mutateAddNewHosts ( AbstractTopology currentTopology , Map < Integer , HostInfo > newHostInfos ) { int startingPartitionId = getNextFreePartitionId ( currentTopology ) ; TopologyBuilder topologyBuilder = addPartitionsToHosts ( newHostInfos , Collection... | Add new hosts to an existing topology and layout partitions on those hosts |
30,817 | public static Pair < AbstractTopology , Set < Integer > > mutateRemoveHosts ( AbstractTopology currentTopology , Set < Integer > removalHosts ) { Set < Integer > removalPartitionIds = getPartitionIdsForHosts ( currentTopology , removalHosts ) ; return Pair . of ( new AbstractTopology ( currentTopology , removalHosts , ... | Remove hosts from an existing topology |
30,818 | public Set < Integer > getPartitionGroupPeers ( int hostId ) { Set < Integer > peers = Sets . newHashSet ( ) ; for ( Partition p : hostsById . get ( hostId ) . partitions ) { peers . addAll ( p . hostIds ) ; } return peers ; } | get all the hostIds in the partition group where the host with the given host id belongs |
30,819 | public static List < Collection < Integer > > sortHostIdByHGDistance ( int hostId , Map < Integer , String > hostGroups ) { String localHostGroup = hostGroups . get ( hostId ) ; Preconditions . checkArgument ( localHostGroup != null ) ; HAGroup localHaGroup = new HAGroup ( localHostGroup ) ; Multimap < Integer , Intege... | Sort all nodes in reverse hostGroup distance order then group by rack - aware group local host id is excluded . |
30,820 | public void reportQueued ( String importerName , String procName ) { StatsInfo statsInfo = getStatsInfo ( importerName , procName ) ; statsInfo . m_pendingCount . incrementAndGet ( ) ; } | An insert request was queued |
30,821 | public void reportFailure ( String importerName , String procName , boolean decrementPending ) { StatsInfo statsInfo = getStatsInfo ( importerName , procName ) ; if ( decrementPending ) { statsInfo . m_pendingCount . decrementAndGet ( ) ; } statsInfo . m_failureCount . incrementAndGet ( ) ; } | Use this when the insert fails even before the request is queued by the InternalConnectionHandler |
30,822 | private void reportSuccess ( String importerName , String procName ) { StatsInfo statsInfo = getStatsInfo ( importerName , procName ) ; statsInfo . m_pendingCount . decrementAndGet ( ) ; statsInfo . m_successCount . incrementAndGet ( ) ; } | One insert succeeded |
30,823 | private void reportRetry ( String importerName , String procName ) { StatsInfo statsInfo = getStatsInfo ( importerName , procName ) ; statsInfo . m_retryCount . incrementAndGet ( ) ; } | One insert was retried |
30,824 | public void writeBlock ( byte [ ] block ) throws IOException { if ( block . length != 512 ) { throw new IllegalArgumentException ( RB . singleton . getString ( RB . BAD_BLOCK_WRITE_LEN , block . length ) ) ; } write ( block , block . length ) ; } | Write a user - specified 512 - byte block . |
30,825 | public void writePadBlocks ( int blockCount ) throws IOException { for ( int i = 0 ; i < blockCount ; i ++ ) { write ( ZERO_BLOCK , ZERO_BLOCK . length ) ; } } | Writes the specified quantity of zero d blocks . |
30,826 | private Vector getAllTables ( ) { Vector result = new Vector ( 20 ) ; try { if ( cConn == null ) { return null ; } dbmeta = cConn . getMetaData ( ) ; String [ ] tableTypes = { "TABLE" } ; ResultSet allTables = dbmeta . getTables ( null , null , null , tableTypes ) ; while ( allTables . next ( ) ) { String aktTable = al... | exclude tables without primary key |
30,827 | private int getChoosenTableIndex ( ) { String tableName = cTables . getSelectedItem ( ) ; int index = getTableIndex ( tableName ) ; if ( index >= 0 ) { return index ; } ZaurusTableForm tableForm = new ZaurusTableForm ( tableName , cConn ) ; pForm . add ( tableName , tableForm ) ; vHoldTableNames . addElement ( tableNam... | if the table name is not in vHoldTableNames create a ZaurusTableForm for it |
30,828 | private int getTableIndex ( String tableName ) { int index ; for ( index = 0 ; index < vHoldTableNames . size ( ) ; index ++ ) { if ( tableName . equals ( ( String ) vHoldTableNames . elementAt ( index ) ) ) { return index ; } } return - 1 ; } | if the name is not in vHoldTableNames answer - 1 |
30,829 | private String [ ] getWords ( ) { StringTokenizer tokenizer = new StringTokenizer ( fSearchWords . getText ( ) ) ; String [ ] result = new String [ tokenizer . countTokens ( ) ] ; int i = 0 ; while ( tokenizer . hasMoreTokens ( ) ) { result [ i ++ ] = tokenizer . nextToken ( ) ; } return result ; } | convert the search words in the textfield to an array of words |
30,830 | private void initButtons ( ) { bSearchRow = new Button ( "Search Rows" ) ; bNewRow = new Button ( "Insert New Row" ) ; bSearchRow . addActionListener ( this ) ; bNewRow . addActionListener ( this ) ; pSearchButs = new Panel ( ) ; pSearchButs . setLayout ( new GridLayout ( 1 , 0 , 4 , 4 ) ) ; pSearchButs . add ( bSearch... | init the three boxes for buttons |
30,831 | private void resetTableForms ( ) { lForm . show ( pForm , "search" ) ; lButton . show ( pButton , "search" ) ; Vector vAllTables = getAllTables ( ) ; cTables . removeAll ( ) ; for ( Enumeration e = vAllTables . elements ( ) ; e . hasMoreElements ( ) ; ) { cTables . addItem ( ( String ) e . nextElement ( ) ) ; } for ( E... | reset everything after changes in the database |
30,832 | private ParsedSelectStmt getLeftmostSelectStmt ( ) { assert ( ! m_children . isEmpty ( ) ) ; AbstractParsedStmt firstChild = m_children . get ( 0 ) ; if ( firstChild instanceof ParsedSelectStmt ) { return ( ParsedSelectStmt ) firstChild ; } else { assert ( firstChild instanceof ParsedUnionStmt ) ; return ( ( ParsedUnio... | Return the leftmost child SELECT statement |
30,833 | public String calculateContentDeterminismMessage ( ) { String ans = null ; for ( AbstractParsedStmt child : m_children ) { ans = child . getContentDeterminismMessage ( ) ; if ( ans != null ) { return ans ; } } return null ; } | Here we search all the children finding if each is content deterministic . If it is we return right away . |
30,834 | public synchronized void rollLog ( ) throws IOException { if ( logStream != null ) { this . logStream . flush ( ) ; this . logStream = null ; oa = null ; } } | rollover the current log file to a new one . |
30,835 | public synchronized void close ( ) throws IOException { if ( logStream != null ) { logStream . close ( ) ; } for ( FileOutputStream log : streamsToFlush ) { log . close ( ) ; } } | close all the open file handles |
30,836 | public synchronized boolean append ( TxnHeader hdr , Record txn ) throws IOException { if ( hdr != null ) { if ( hdr . getZxid ( ) <= lastZxidSeen ) { LOG . warn ( "Current zxid " + hdr . getZxid ( ) + " is <= " + lastZxidSeen + " for " + hdr . getType ( ) ) ; } if ( logStream == null ) { if ( LOG . isInfoEnabled ( ) )... | append an entry to the transaction log |
30,837 | private void padFile ( FileOutputStream out ) throws IOException { currentSize = Util . padLogFile ( out , currentSize , preAllocSize ) ; } | pad the current file to increase its size |
30,838 | public static File [ ] getLogFiles ( File [ ] logDirList , long snapshotZxid ) { List < File > files = Util . sortDataDir ( logDirList , "log" , true ) ; long logZxid = 0 ; for ( File f : files ) { long fzxid = Util . getZxidFromName ( f . getName ( ) , "log" ) ; if ( fzxid > snapshotZxid ) { continue ; } if ( fzxid > ... | Find the log file that starts at or just before the snapshot . Return this and all subsequent logs . Results are ordered by zxid of file ascending order . |
30,839 | public long getLastLoggedZxid ( ) { File [ ] files = getLogFiles ( logDir . listFiles ( ) , 0 ) ; long maxLog = files . length > 0 ? Util . getZxidFromName ( files [ files . length - 1 ] . getName ( ) , "log" ) : - 1 ; long zxid = maxLog ; try { FileTxnLog txn = new FileTxnLog ( logDir ) ; TxnIterator itr = txn . read ... | get the last zxid that was logged in the transaction logs |
30,840 | public synchronized void commit ( ) throws IOException { if ( logStream != null ) { logStream . flush ( ) ; } for ( FileOutputStream log : streamsToFlush ) { log . flush ( ) ; if ( forceSync ) { log . getChannel ( ) . force ( false ) ; } } while ( streamsToFlush . size ( ) > 1 ) { streamsToFlush . removeFirst ( ) . clo... | commit the logs . make sure that evertyhing hits the disk |
30,841 | public boolean truncate ( long zxid ) throws IOException { FileTxnIterator itr = new FileTxnIterator ( this . logDir , zxid ) ; PositionInputStream input = itr . inputStream ; long pos = input . getPosition ( ) ; RandomAccessFile raf = new RandomAccessFile ( itr . logFile , "rw" ) ; raf . setLength ( pos ) ; raf . clos... | truncate the current transaction logs |
30,842 | private static FileHeader readHeader ( File file ) throws IOException { InputStream is = null ; try { is = new BufferedInputStream ( new FileInputStream ( file ) ) ; InputArchive ia = BinaryInputArchive . getArchive ( is ) ; FileHeader hdr = new FileHeader ( ) ; hdr . deserialize ( ia , "fileheader" ) ; return hdr ; } ... | read the header of the transaction file |
30,843 | public long getDbId ( ) throws IOException { FileTxnIterator itr = new FileTxnIterator ( logDir , 0 ) ; FileHeader fh = readHeader ( itr . logFile ) ; itr . close ( ) ; if ( fh == null ) throw new IOException ( "Unsupported Format." ) ; return fh . getDbid ( ) ; } | the dbid of this transaction database |
30,844 | public static void verifyForHdfsUse ( String sb ) throws IllegalArgumentException { Preconditions . checkArgument ( sb != null && ! sb . trim ( ) . isEmpty ( ) , "null or empty hdfs endpoint" ) ; int mask = conversionMaskFor ( sb ) ; boolean hasDateConversion = ( mask & DATE ) == DATE ; Preconditions . checkArgument ( ... | Verifies that given endpoint format string specifies all the required hdfs conversions in the path portion of the endpoint . |
30,845 | public static void verifyForBatchUse ( String sb ) throws IllegalArgumentException { Preconditions . checkArgument ( sb != null && ! sb . trim ( ) . isEmpty ( ) , "null or empty hdfs endpoint" ) ; int mask = conversionMaskFor ( sb ) ; Preconditions . checkArgument ( ( mask & HDFS_MASK ) == HDFS_MASK , "batch mode endpo... | Verifies that given endpoint format string specifies all the required batch mode conversions . |
30,846 | protected void handleJSONMessage ( JSONObject obj ) throws Exception { hostLog . warn ( "SystemCatalogAgent received a JSON message, which should be impossible." ) ; VoltTable [ ] results = null ; sendOpsResponse ( results , obj ) ; } | SystemCatalog shouldn t currently get here make it so we don t die or do anything |
30,847 | public static < K , V > Map < K , V > constrainedMap ( Map < K , V > map , MapConstraint < ? super K , ? super V > constraint ) { return new ConstrainedMap < K , V > ( map , constraint ) ; } | Returns a constrained view of the specified map using the specified constraint . Any operations that add new mappings will call the provided constraint . However this method does not verify that existing mappings satisfy the constraint . |
30,848 | public static < K , V > ListMultimap < K , V > constrainedListMultimap ( ListMultimap < K , V > multimap , MapConstraint < ? super K , ? super V > constraint ) { return new ConstrainedListMultimap < K , V > ( multimap , constraint ) ; } | Returns a constrained view of the specified list multimap using the specified constraint . Any operations that add new mappings will call the provided constraint . However this method does not verify that existing mappings satisfy the constraint . |
30,849 | private void validateWindowedSyntax ( ) { switch ( opType ) { case OpTypes . WINDOWED_RANK : case OpTypes . WINDOWED_DENSE_RANK : case OpTypes . WINDOWED_ROW_NUMBER : if ( nodes . length != 0 ) { throw Error . error ( "Windowed Aggregate " + OpTypes . aggregateName ( opType ) + " expects no arguments." , "" , 0 ) ; } b... | Validate that this is a collection of values . |
30,850 | Result getResult ( Session session ) { Table table = baseTable ; Result resultOut = null ; RowSetNavigator generatedNavigator = null ; PersistentStore store = session . sessionData . getRowStore ( baseTable ) ; if ( generatedIndexes != null ) { resultOut = Result . newUpdateCountResult ( generatedResultMetaData , 0 ) ;... | Executes an INSERT_SELECT statement . It is assumed that the argument is of the correct type . |
30,851 | public void resolveForTable ( Table table ) { assert ( table != null ) ; Column column = table . getColumns ( ) . getExact ( m_columnName ) ; assert ( column != null ) ; m_tableName = table . getTypeName ( ) ; m_columnIndex = column . getIndex ( ) ; setTypeSizeAndInBytes ( column ) ; } | Resolve a TVE in the context of the given table . Since this is a TVE it is a leaf node in the expression tree . We just look up the metadata from the table and copy it here to this object . |
30,852 | public int setColumnIndexUsingSchema ( NodeSchema inputSchema ) { int index = inputSchema . getIndexOfTve ( this ) ; if ( index < 0 ) { return index ; } setColumnIndex ( index ) ; if ( getValueType ( ) == null ) { SchemaColumn inputColumn = inputSchema . getColumn ( index ) ; setTypeSizeAndInBytes ( inputColumn ) ; } r... | Given an input schema resolve this TVE expression . |
30,853 | public String getColumnClassName ( int column ) throws SQLException { sourceResultSet . checkColumnBounds ( column ) ; VoltType type = sourceResultSet . table . getColumnType ( column - 1 ) ; String result = type . getJdbcClass ( ) ; if ( result == null ) { throw SQLError . get ( SQLError . TRANSLATION_NOT_FOUND , type... | Returns the fully - qualified name of the Java class whose instances are manufactured if the method ResultSet . getObject is called to retrieve a value from the column . |
30,854 | public int getPrecision ( int column ) throws SQLException { sourceResultSet . checkColumnBounds ( column ) ; VoltType type = sourceResultSet . table . getColumnType ( column - 1 ) ; Integer result = type . getTypePrecisionAndRadix ( ) [ 0 ] ; if ( result == null ) { result = 0 ; } return result ; } | Get the designated column s specified column size . |
30,855 | public int getScale ( int column ) throws SQLException { sourceResultSet . checkColumnBounds ( column ) ; VoltType type = sourceResultSet . table . getColumnType ( column - 1 ) ; Integer result = type . getMaximumScale ( ) ; if ( result == null ) { result = 0 ; } return result ; } | Gets the designated column s number of digits to right of the decimal point . |
30,856 | public boolean isCaseSensitive ( int column ) throws SQLException { sourceResultSet . checkColumnBounds ( column ) ; VoltType type = sourceResultSet . table . getColumnType ( column - 1 ) ; return type . isCaseSensitive ( ) ; } | Indicates whether a column s case matters . |
30,857 | public boolean isSigned ( int column ) throws SQLException { sourceResultSet . checkColumnBounds ( column ) ; VoltType type = sourceResultSet . table . getColumnType ( column - 1 ) ; Boolean result = type . isUnsigned ( ) ; if ( result == null ) { return false ; } return ! result ; } | Indicates whether values in the designated column are signed numbers . |
30,858 | private AbstractPlanNode applyOptimization ( WindowFunctionPlanNode plan ) { assert ( plan . getChildCount ( ) == 1 ) ; assert ( plan . getChild ( 0 ) != null ) ; AbstractPlanNode child = plan . getChild ( 0 ) ; assert ( child != null ) ; if ( ! ( child instanceof OrderByPlanNode ) ) { return plan ; } OrderByPlanNode o... | Convert ReceivePlanNodes into MergeReceivePlanNodes when the RECEIVE node s nearest parent is a window function . We won t have any inline limits or aggregates here so this is somewhat simpler than the order by case . |
30,859 | AbstractPlanNode convertToSerialAggregation ( AbstractPlanNode aggregateNode , OrderByPlanNode orderbyNode ) { assert ( aggregateNode instanceof HashAggregatePlanNode ) ; HashAggregatePlanNode hashAggr = ( HashAggregatePlanNode ) aggregateNode ; List < AbstractExpression > groupbys = new ArrayList < > ( hashAggr . getG... | The Hash aggregate can be converted to a Serial or Partial aggregate if - all GROUP BY and ORDER BY expressions bind to each other - Serial Aggregate - a subset of the GROUP BY expressions covers all of the ORDER BY - Partial - anything else - remains a Hash Aggregate |
30,860 | private final void startHeartbeat ( ) { if ( timerTask == null || HsqlTimer . isCancelled ( timerTask ) ) { Runnable runner = new HeartbeatRunner ( ) ; timerTask = timer . schedulePeriodicallyAfter ( 0 , HEARTBEAT_INTERVAL , runner , true ) ; } } | Schedules the lock heartbeat task . |
30,861 | private final void stopHeartbeat ( ) { if ( timerTask != null && ! HsqlTimer . isCancelled ( timerTask ) ) { HsqlTimer . cancel ( timerTask ) ; timerTask = null ; } } | Cancels the lock heartbeat task . |
30,862 | public final static boolean isLocked ( final String path ) { boolean locked = true ; try { LockFile lockFile = LockFile . newLockFile ( path ) ; lockFile . checkHeartbeat ( false ) ; locked = false ; } catch ( Exception e ) { } return locked ; } | Retrieves whether there is potentially already a cooperative lock operating system lock or some other situation preventing a cooperative lock condition from being aquired using the specified path . |
30,863 | public static ImmutableSortedSet < String > hosts ( String option ) { checkArgument ( option != null , "option is null" ) ; if ( option . trim ( ) . isEmpty ( ) ) { return ImmutableSortedSet . of ( HostAndPort . fromParts ( "" , Constants . DEFAULT_INTERNAL_PORT ) . toString ( ) ) ; } Splitter commaSplitter = Splitter ... | Helper method that takes a comma delimited list of host specs validates it and converts it to a set of valid coordinators |
30,864 | public static ImmutableSortedSet < String > hosts ( int ... ports ) { if ( ports . length == 0 ) { return ImmutableSortedSet . of ( HostAndPort . fromParts ( "" , Constants . DEFAULT_INTERNAL_PORT ) . toString ( ) ) ; } ImmutableSortedSet . Builder < String > sbld = ImmutableSortedSet . naturalOrder ( ) ; for ( int p :... | Convenience method mainly used in local cluster testing |
30,865 | public ClientResponseImpl call ( Object ... paramListIn ) { m_perCallStats = m_statsCollector . beginProcedure ( ) ; if ( m_perCallStats != null ) { StoredProcedureInvocation invoc = ( m_txnState != null ? m_txnState . getInvocation ( ) : null ) ; ParameterSet params = ( invoc != null ? invoc . getParams ( ) : Paramete... | Wraps coreCall with statistics code . |
30,866 | public boolean checkPartition ( TransactionState txnState , TheHashinator hashinator ) { if ( m_isSinglePartition ) { if ( hashinator == null ) { return false ; } if ( m_site . getCorrespondingPartitionId ( ) == MpInitiator . MP_INIT_PID ) { throw new ExpectedProcedureException ( "Single-partition procedure routed to m... | Check if the txn hashes to this partition . If not it should be restarted . |
30,867 | public static boolean isProcedureStackTraceElement ( String procedureName , StackTraceElement stel ) { int lastPeriodPos = stel . getClassName ( ) . lastIndexOf ( '.' ) ; if ( lastPeriodPos == - 1 ) { lastPeriodPos = 0 ; } else { ++ lastPeriodPos ; } String simpleName = stel . getClassName ( ) . substring ( lastPeriodP... | Test whether or not the given stack frame is within a procedure invocation |
30,868 | public void handleUpdateDeployment ( String jsonp , HttpServletRequest request , HttpServletResponse response , AuthenticationResult ar ) throws IOException , ServletException { String deployment = request . getParameter ( "deployment" ) ; if ( deployment == null || deployment . length ( ) == 0 ) { response . getWriter... | Update the deployment |
30,869 | public void handleRemoveUser ( String jsonp , String target , HttpServletRequest request , HttpServletResponse response , AuthenticationResult ar ) throws IOException , ServletException { try { DeploymentType newDeployment = CatalogUtil . getDeployment ( new ByteArrayInputStream ( getDeploymentBytes ( ) ) ) ; User user... | Handle DELETE for users |
30,870 | public void handleGetUsers ( String jsonp , String target , HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { ObjectMapper mapper = new ObjectMapper ( ) ; User user = null ; String [ ] splitTarget = target . split ( "/" ) ; if ( splitTarget . length < 3 || splitTarget [... | Handle GET for users |
30,871 | public void handleGetExportTypes ( String jsonp , HttpServletResponse response ) throws IOException , ServletException { if ( jsonp != null ) { response . getWriter ( ) . write ( jsonp + "(" ) ; } JSONObject exportTypes = new JSONObject ( ) ; HashSet < String > exportList = new HashSet < > ( ) ; for ( ServerExportEnum ... | Handle GET for export types |
30,872 | void createZKDirectory ( String path ) { try { try { m_zk . create ( path , new byte [ 0 ] , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException e ) { if ( e . code ( ) != Code . NODEEXISTS ) { throw e ; } } } catch ( Exception e ) { VoltDB . crashGlobalVoltDB ( "Failed to create Zookeeper nod... | Creates a ZooKeeper directory if it doesn t exist . Crashes VoltDB if the creation fails for any reason other then the path already existing . |
30,873 | public Pair < Integer , String > findRestoreCatalog ( ) { enterRestore ( ) ; try { m_snapshotToRestore = generatePlans ( ) ; } catch ( Exception e ) { VoltDB . crashGlobalVoltDB ( e . getMessage ( ) , true , e ) ; } if ( m_snapshotToRestore != null ) { int hostId = m_snapshotToRestore . hostId ; File file = new File ( ... | Generate restore and replay plans and return the catalog associated with the snapshot to restore if there is anything to restore . |
30,874 | void enterRestore ( ) { createZKDirectory ( VoltZK . restore ) ; createZKDirectory ( VoltZK . restore_barrier ) ; createZKDirectory ( VoltZK . restore_barrier2 ) ; try { m_generatedRestoreBarrier2 = m_zk . create ( VoltZK . restore_barrier2 + "/counter" , null , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL_SEQUENTIAL... | Enters the restore process . Creates ZooKeeper barrier node for this host . |
30,875 | void exitRestore ( ) { try { m_zk . delete ( m_generatedRestoreBarrier2 , - 1 ) ; } catch ( Exception e ) { VoltDB . crashLocalVoltDB ( "Unable to delete zk node " + m_generatedRestoreBarrier2 , false , e ) ; } if ( m_callback != null ) { m_callback . onSnapshotRestoreCompletion ( ) ; } LOG . debug ( "Waiting for all h... | Exists the restore process . Waits for all other hosts to complete first . This method blocks . |
30,876 | static SnapshotInfo consolidateSnapshotInfos ( Collection < SnapshotInfo > lastSnapshot ) { SnapshotInfo chosen = null ; if ( lastSnapshot != null ) { Iterator < SnapshotInfo > i = lastSnapshot . iterator ( ) ; while ( i . hasNext ( ) ) { SnapshotInfo next = i . next ( ) ; if ( chosen == null ) { chosen = next ; } else... | Picks a snapshot info for restore . A single snapshot might have different files scattered across multiple machines . All nodes must pick the same SnapshotInfo or different nodes will pick different catalogs to restore . Pick one SnapshotInfo and consolidate the per - node state into it . |
30,877 | private void sendSnapshotTxnId ( SnapshotInfo toRestore ) { long txnId = toRestore != null ? toRestore . txnId : 0 ; String jsonData = toRestore != null ? toRestore . toJSONObject ( ) . toString ( ) : "{}" ; LOG . debug ( "Sending snapshot ID " + txnId + " for restore to other nodes" ) ; try { m_zk . create ( VoltZK . ... | Send the txnId of the snapshot that was picked to restore from to the other hosts . If there was no snapshot to restore from send 0 . |
30,878 | private void sendLocalRestoreInformation ( Long max , Set < SnapshotInfo > snapshots ) { String jsonData = serializeRestoreInformation ( max , snapshots ) ; String zkNode = VoltZK . restore + "/" + m_hostId ; try { m_zk . create ( zkNode , jsonData . getBytes ( StandardCharsets . UTF_8 ) , Ids . OPEN_ACL_UNSAFE , Creat... | Send the information about the local snapshot files to the other hosts to generate restore plan . |
30,879 | private Long deserializeRestoreInformation ( List < String > children , Map < String , Set < SnapshotInfo > > snapshotFragments ) throws Exception { try { int recover = m_action . ordinal ( ) ; Long clStartTxnId = null ; for ( String node : children ) { if ( node . equals ( "snapshot_id" ) ) { continue ; } byte [ ] dat... | This function like all good functions does three things . It produces the command log start transaction Id . It produces a map of SnapshotInfo objects . And it errors if the remote start action does not match the local action . |
30,880 | private void changeState ( ) { if ( m_state == State . RESTORE ) { fetchSnapshotTxnId ( ) ; exitRestore ( ) ; m_state = State . REPLAY ; m_snapshotMonitor . addInterest ( this ) ; m_replayAgent . replay ( ) ; } else if ( m_state == State . REPLAY ) { m_state = State . TRUNCATE ; } else if ( m_state == State . TRUNCATE ... | Change the state of the restore agent based on the current state . |
30,881 | private Map < String , Snapshot > getSnapshots ( ) { Map < String , SnapshotPathType > paths = new HashMap < String , SnapshotPathType > ( ) ; if ( VoltDB . instance ( ) . getConfig ( ) . m_isEnterprise ) { if ( m_clSnapshotPath != null ) { paths . put ( m_clSnapshotPath , SnapshotPathType . SNAP_CL ) ; } } if ( m_snap... | Finds all the snapshots in all the places we know of which could possibly store snapshots like command log snapshots auto snapshots etc . |
30,882 | public CountDownLatch snapshotCompleted ( SnapshotCompletionEvent event ) { if ( ! event . truncationSnapshot || ! event . didSucceed ) { VoltDB . crashGlobalVoltDB ( "Failed to truncate command logs by snapshot" , false , null ) ; } else { m_truncationSnapshot = event . multipartTxnId ; m_truncationSnapshotPerPartitio... | All nodes will be notified about the completion of the truncation snapshot . |
30,883 | void shutdown ( ) throws InterruptedException { m_shouldStop = true ; if ( m_thread != null ) { m_selector . wakeup ( ) ; m_thread . join ( ) ; } } | Instruct the network to stop after the current loop |
30,884 | Connection registerChannel ( final SocketChannel channel , final InputHandler handler , final int interestOps , final ReverseDNSPolicy dns , final CipherExecutor cipherService , final SSLEngine sslEngine ) throws IOException { synchronized ( channel . blockingLock ( ) ) { channel . configureBlocking ( false ) ; channel... | Register a channel with the selector and create a Connection that will pass incoming events to the provided handler . |
30,885 | Future < ? > unregisterChannel ( Connection c ) { FutureTask < Object > ft = new FutureTask < Object > ( getUnregisterRunnable ( c ) , null ) ; m_tasks . offer ( ft ) ; m_selector . wakeup ( ) ; return ft ; } | Unregister a channel . The connections streams are not drained before finishing . |
30,886 | void addToChangeList ( final VoltPort port , final boolean runFirst ) { if ( runFirst ) { m_tasks . offer ( new Runnable ( ) { public void run ( ) { callPort ( port ) ; } } ) ; } else { m_tasks . offer ( new Runnable ( ) { public void run ( ) { installInterests ( port ) ; } } ) ; } m_selector . wakeup ( ) ; } | Set interest registrations for a port |
30,887 | protected void invokeCallbacks ( ThreadLocalRandom r ) { final Set < SelectionKey > selectedKeys = m_selector . selectedKeys ( ) ; final int keyCount = selectedKeys . size ( ) ; int startInx = r . nextInt ( keyCount ) ; int itInx = 0 ; Iterator < SelectionKey > it = selectedKeys . iterator ( ) ; while ( itInx < startIn... | Set the selected interest set on the port and run it . |
30,888 | public static String path ( String ... components ) { String path = components [ 0 ] ; for ( int i = 1 ; i < components . length ; i ++ ) { path = ZKUtil . joinZKPath ( path , components [ i ] ) ; } return path ; } | Helper to produce a valid path from variadic strings . |
30,889 | private String getSegmentFileName ( long currentId , long previousId ) { return PbdSegmentName . createName ( m_nonce , currentId , previousId , false ) ; } | Return a segment file name from m_nonce and current + previous segment ids . |
30,890 | private long getPreviousSegmentId ( File file ) { PbdSegmentName segmentName = PbdSegmentName . parseFile ( m_usageSpecificLog , file ) ; if ( segmentName . m_result != PbdSegmentName . Result . OK ) { throw new IllegalStateException ( "Invalid file name: " + file . getName ( ) ) ; } return segmentName . m_prevId ; } | Extract the previous segment id from a file name . |
30,891 | private void deleteStalePbdFile ( File file ) throws IOException { try { PBDSegment . setFinal ( file , false ) ; if ( m_usageSpecificLog . isDebugEnabled ( ) ) { m_usageSpecificLog . debug ( "Segment " + file . getName ( ) + " (final: " + PBDSegment . isFinal ( file ) + "), will be closed and deleted during init" ) ; ... | Delete a PBD segment that was identified as stale i . e . produced by earlier VoltDB releases |
30,892 | private void recoverSegment ( long segmentIndex , long segmentId , PbdSegmentName segmentName ) throws IOException { PBDSegment segment ; if ( segmentName . m_quarantined ) { segment = new PbdQuarantinedSegment ( segmentName . m_file , segmentIndex , segmentId ) ; } else { segment = newSegment ( segmentIndex , segmentI... | Recover a PBD segment and add it to m_segments |
30,893 | int numOpenSegments ( ) { int numOpen = 0 ; for ( PBDSegment segment : m_segments . values ( ) ) { if ( ! segment . isClosed ( ) ) { numOpen ++ ; } } return numOpen ; } | Used by test only |
30,894 | public CacheBuilder < K , V > expireAfterWrite ( long duration , TimeUnit unit ) { checkState ( expireAfterWriteNanos == UNSET_INT , "expireAfterWrite was already set to %s ns" , expireAfterWriteNanos ) ; checkArgument ( duration >= 0 , "duration cannot be negative: %s %s" , duration , unit ) ; this . expireAfterWriteN... | Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry s creation or the most recent replacement of its value . |
30,895 | public void revoke ( Grantee role ) { if ( ! hasRoleDirect ( role ) ) { throw Error . error ( ErrorCode . X_0P503 , role . getNameString ( ) ) ; } roles . remove ( role ) ; } | Revoke a direct role only |
30,896 | private OrderedHashSet addGranteeAndRoles ( OrderedHashSet set ) { Grantee candidateRole ; set . add ( this ) ; for ( int i = 0 ; i < roles . size ( ) ; i ++ ) { candidateRole = ( Grantee ) roles . get ( i ) ; if ( ! set . contains ( candidateRole ) ) { candidateRole . addGranteeAndRoles ( set ) ; } } return set ; } | Adds to given Set this . sName plus all roles and nested roles . |
30,897 | public void addAllRoles ( HashMap map ) { for ( int i = 0 ; i < roles . size ( ) ; i ++ ) { Grantee role = ( Grantee ) roles . get ( i ) ; map . put ( role . granteeName . name , role . roles ) ; } } | returns a map with grantee name keys and sets of granted roles as value |
30,898 | void clearPrivileges ( ) { roles . clear ( ) ; directRightsMap . clear ( ) ; grantedRightsMap . clear ( ) ; fullRightsMap . clear ( ) ; isAdmin = false ; } | Revokes all rights from this Grantee object . The map is cleared and the database administrator role attribute is set false . |
30,899 | boolean updateNestedRoles ( Grantee role ) { boolean hasNested = false ; if ( role != this ) { for ( int i = 0 ; i < roles . size ( ) ; i ++ ) { Grantee currentRole = ( Grantee ) roles . get ( i ) ; hasNested |= currentRole . updateNestedRoles ( role ) ; } } if ( hasNested ) { updateAllRights ( ) ; } return hasNested |... | Recursive method used with ROLE Grantee objects to set the fullRightsMap and admin flag for all the roles . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.