repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getVersionColumns
@Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "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.
[ "Retrieves", "a", "description", "of", "a", "table", "s", "columns", "that", "are", "automatically", "updated", "when", "any", "value", "in", "a", "row", "is", "updated", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L926-L931
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.supportsConvert
@Override public boolean supportsConvert(int fromType, int toType) throws SQLException { checkClosed(); switch (fromType) { /* * ALL types can be converted to VARCHAR /VoltType.String */ 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.VARCHAR: return true; default: return false; } case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: switch (toType) { case java.sql.Types.VARCHAR: case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: return true; default: return false; } default: return false; } }
java
@Override public boolean supportsConvert(int fromType, int toType) throws SQLException { checkClosed(); switch (fromType) { /* * ALL types can be converted to VARCHAR /VoltType.String */ 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.VARCHAR: return true; default: return false; } case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: switch (toType) { case java.sql.Types.VARCHAR: case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: return true; default: return false; } default: return false; } }
[ "@", "Override", "public", "boolean", "supportsConvert", "(", "int", "fromType", ",", "int", "toType", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "switch", "(", "fromType", ")", "{", "/*\n * ALL types can be converted to VARCHAR /VoltTyp...
Retrieves whether this database supports the JDBC scalar function CONVERT for conversions between the JDBC types fromType and toType.
[ "Retrieves", "whether", "this", "database", "supports", "the", "JDBC", "scalar", "function", "CONVERT", "for", "conversions", "between", "the", "JDBC", "types", "fromType", "and", "toType", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L1206-L1246
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.supportsResultSetType
@Override public boolean supportsResultSetType(int type) throws SQLException { checkClosed(); if (type == ResultSet.TYPE_SCROLL_INSENSITIVE) return true; return false; }
java
@Override public boolean supportsResultSetType(int type) throws SQLException { checkClosed(); if (type == ResultSet.TYPE_SCROLL_INSENSITIVE) return true; return false; }
[ "@", "Override", "public", "boolean", "supportsResultSetType", "(", "int", "type", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "if", "(", "type", "==", "ResultSet", ".", "TYPE_SCROLL_INSENSITIVE", ")", "return", "true", ";", "return", "fa...
Retrieves whether this database supports the given result set type.
[ "Retrieves", "whether", "this", "database", "supports", "the", "given", "result", "set", "type", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L1515-L1522
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/DatabaseURL.java
DatabaseURL.isInProcessDatabaseType
public static boolean isInProcessDatabaseType(String url) { if (url == S_FILE || url == S_RES || url == S_MEM) { return true; } return false; }
java
public static boolean isInProcessDatabaseType(String url) { if (url == S_FILE || url == S_RES || url == S_MEM) { return true; } return false; }
[ "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.
[ "Returns", "true", "if", "type", "represents", "an", "in", "-", "process", "connection", "to", "database", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/DatabaseURL.java#L83-L90
train
VoltDB/voltdb
examples/callcenter/client/callcenter/DelayedQueue.java
DelayedQueue.nextReady
public T nextReady(long systemCurrentTimeMillis) { if (delayed.size() == 0) { return null; } // no ready objects if (delayed.firstKey() > systemCurrentTimeMillis) { return null; } Entry<Long, Object[]> entry = delayed.pollFirstEntry(); Object[] values = entry.getValue(); @SuppressWarnings("unchecked") T value = (T) values[0]; // if this map entry had multiple values, put all but one // of them back if (values.length > 1) { int prevLength = values.length; values = Arrays.copyOfRange(values, 1, values.length); assert(values.length == prevLength - 1); delayed.put(entry.getKey(), values); } m_size--; return value; }
java
public T nextReady(long systemCurrentTimeMillis) { if (delayed.size() == 0) { return null; } // no ready objects if (delayed.firstKey() > systemCurrentTimeMillis) { return null; } Entry<Long, Object[]> entry = delayed.pollFirstEntry(); Object[] values = entry.getValue(); @SuppressWarnings("unchecked") T value = (T) values[0]; // if this map entry had multiple values, put all but one // of them back if (values.length > 1) { int prevLength = values.length; values = Arrays.copyOfRange(values, 1, values.length); assert(values.length == prevLength - 1); delayed.put(entry.getKey(), values); } m_size--; return value; }
[ "public", "T", "nextReady", "(", "long", "systemCurrentTimeMillis", ")", "{", "if", "(", "delayed", ".", "size", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "// no ready objects", "if", "(", "delayed", ".", "firstKey", "(", ")", ">", "sy...
Return the next object that is safe for delivery or null if there are no safe objects to deliver. Null response could mean empty, or could mean all objects are scheduled for the future. @param systemCurrentTimeMillis The current time. @return Object of type T.
[ "Return", "the", "next", "object", "that", "is", "safe", "for", "delivery", "or", "null", "if", "there", "are", "no", "safe", "objects", "to", "deliver", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/callcenter/client/callcenter/DelayedQueue.java#L82-L109
train
VoltDB/voltdb
src/frontend/org/voltdb/Inits.java
Inits.readCatalog
private static byte[] readCatalog(String catalogUrl) throws IOException { assert (catalogUrl != null); final int MAX_CATALOG_SIZE = 40 * 1024 * 1024; // 40mb InputStream fin = null; try { URL url = new URL(catalogUrl); fin = url.openStream(); } catch (MalformedURLException ex) { // Invalid URL. Try as a file. fin = new FileInputStream(catalogUrl); } byte[] buffer = new byte[MAX_CATALOG_SIZE]; int readBytes = 0; int totalBytes = 0; try { while (readBytes >= 0) { totalBytes += readBytes; readBytes = fin.read(buffer, totalBytes, buffer.length - totalBytes - 1); } } finally { fin.close(); } return Arrays.copyOf(buffer, totalBytes); }
java
private static byte[] readCatalog(String catalogUrl) throws IOException { assert (catalogUrl != null); final int MAX_CATALOG_SIZE = 40 * 1024 * 1024; // 40mb InputStream fin = null; try { URL url = new URL(catalogUrl); fin = url.openStream(); } catch (MalformedURLException ex) { // Invalid URL. Try as a file. fin = new FileInputStream(catalogUrl); } byte[] buffer = new byte[MAX_CATALOG_SIZE]; int readBytes = 0; int totalBytes = 0; try { while (readBytes >= 0) { totalBytes += readBytes; readBytes = fin.read(buffer, totalBytes, buffer.length - totalBytes - 1); } } finally { fin.close(); } return Arrays.copyOf(buffer, totalBytes); }
[ "private", "static", "byte", "[", "]", "readCatalog", "(", "String", "catalogUrl", ")", "throws", "IOException", "{", "assert", "(", "catalogUrl", "!=", "null", ")", ";", "final", "int", "MAX_CATALOG_SIZE", "=", "40", "*", "1024", "*", "1024", ";", "// 40m...
Read catalog bytes from URL @param catalogUrl @return catalog bytes @throws IOException
[ "Read", "catalog", "bytes", "from", "URL" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/Inits.java#L256-L283
train
VoltDB/voltdb
third_party/java/src/org/apache/log4j/net/SyslogAppender.java
SyslogAppender.close
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; } } }
java
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; } } }
[ "synchronized", "public", "void", "close", "(", ")", "{", "closed", "=", "true", ";", "if", "(", "sqw", "!=", "null", ")", "{", "try", "{", "if", "(", "layoutHeaderChecked", "&&", "layout", "!=", "null", "&&", "layout", ".", "getFooter", "(", ")", "!...
Release any resources held by this SyslogAppender. @since 0.8.4
[ "Release", "any", "resources", "held", "by", "this", "SyslogAppender", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/log4j/net/SyslogAppender.java#L155-L170
train
VoltDB/voltdb
third_party/java/src/org/apache/log4j/net/SyslogAppender.java
SyslogAppender.getFacility
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(facilityName)) { return LOG_MAIL; } else if("DAEMON".equalsIgnoreCase(facilityName)) { return LOG_DAEMON; } else if("AUTH".equalsIgnoreCase(facilityName)) { return LOG_AUTH; } else if("SYSLOG".equalsIgnoreCase(facilityName)) { return LOG_SYSLOG; } else if("LPR".equalsIgnoreCase(facilityName)) { return LOG_LPR; } else if("NEWS".equalsIgnoreCase(facilityName)) { return LOG_NEWS; } else if("UUCP".equalsIgnoreCase(facilityName)) { return LOG_UUCP; } else if("CRON".equalsIgnoreCase(facilityName)) { return LOG_CRON; } else if("AUTHPRIV".equalsIgnoreCase(facilityName)) { return LOG_AUTHPRIV; } else if("FTP".equalsIgnoreCase(facilityName)) { return LOG_FTP; } else if("LOCAL0".equalsIgnoreCase(facilityName)) { return LOG_LOCAL0; } else if("LOCAL1".equalsIgnoreCase(facilityName)) { return LOG_LOCAL1; } else if("LOCAL2".equalsIgnoreCase(facilityName)) { return LOG_LOCAL2; } else if("LOCAL3".equalsIgnoreCase(facilityName)) { return LOG_LOCAL3; } else if("LOCAL4".equalsIgnoreCase(facilityName)) { return LOG_LOCAL4; } else if("LOCAL5".equalsIgnoreCase(facilityName)) { return LOG_LOCAL5; } else if("LOCAL6".equalsIgnoreCase(facilityName)) { return LOG_LOCAL6; } else if("LOCAL7".equalsIgnoreCase(facilityName)) { return LOG_LOCAL7; } else { return -1; } }
java
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(facilityName)) { return LOG_MAIL; } else if("DAEMON".equalsIgnoreCase(facilityName)) { return LOG_DAEMON; } else if("AUTH".equalsIgnoreCase(facilityName)) { return LOG_AUTH; } else if("SYSLOG".equalsIgnoreCase(facilityName)) { return LOG_SYSLOG; } else if("LPR".equalsIgnoreCase(facilityName)) { return LOG_LPR; } else if("NEWS".equalsIgnoreCase(facilityName)) { return LOG_NEWS; } else if("UUCP".equalsIgnoreCase(facilityName)) { return LOG_UUCP; } else if("CRON".equalsIgnoreCase(facilityName)) { return LOG_CRON; } else if("AUTHPRIV".equalsIgnoreCase(facilityName)) { return LOG_AUTHPRIV; } else if("FTP".equalsIgnoreCase(facilityName)) { return LOG_FTP; } else if("LOCAL0".equalsIgnoreCase(facilityName)) { return LOG_LOCAL0; } else if("LOCAL1".equalsIgnoreCase(facilityName)) { return LOG_LOCAL1; } else if("LOCAL2".equalsIgnoreCase(facilityName)) { return LOG_LOCAL2; } else if("LOCAL3".equalsIgnoreCase(facilityName)) { return LOG_LOCAL3; } else if("LOCAL4".equalsIgnoreCase(facilityName)) { return LOG_LOCAL4; } else if("LOCAL5".equalsIgnoreCase(facilityName)) { return LOG_LOCAL5; } else if("LOCAL6".equalsIgnoreCase(facilityName)) { return LOG_LOCAL6; } else if("LOCAL7".equalsIgnoreCase(facilityName)) { return LOG_LOCAL7; } else { return -1; } }
[ "public", "static", "int", "getFacility", "(", "String", "facilityName", ")", "{", "if", "(", "facilityName", "!=", "null", ")", "{", "facilityName", "=", "facilityName", ".", "trim", "(", ")", ";", "}", "if", "(", "\"KERN\"", ".", "equalsIgnoreCase", "(",...
Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized. @param facilityName one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The matching is case-insensitive. @since 1.1
[ "Returns", "the", "integer", "value", "corresponding", "to", "the", "named", "syslog", "facility", "or", "-", "1", "if", "it", "couldn", "t", "be", "recognized", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/log4j/net/SyslogAppender.java#L229-L278
train
VoltDB/voltdb
third_party/java/src/org/apache/log4j/net/SyslogAppender.java
SyslogAppender.activateOptions
public void activateOptions() { if (header) { getLocalHostname(); } if (layout != null && layout.getHeader() != null) { sendLayoutMessage(layout.getHeader()); } layoutHeaderChecked = true; }
java
public void activateOptions() { if (header) { getLocalHostname(); } if (layout != null && layout.getHeader() != null) { sendLayoutMessage(layout.getHeader()); } layoutHeaderChecked = true; }
[ "public", "void", "activateOptions", "(", ")", "{", "if", "(", "header", ")", "{", "getLocalHostname", "(", ")", ";", "}", "if", "(", "layout", "!=", "null", "&&", "layout", ".", "getHeader", "(", ")", "!=", "null", ")", "{", "sendLayoutMessage", "(", ...
This method returns immediately as options are activated when they are set.
[ "This", "method", "returns", "immediately", "as", "options", "are", "activated", "when", "they", "are", "set", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/log4j/net/SyslogAppender.java#L356-L365
train
VoltDB/voltdb
third_party/java/src/org/apache/log4j/net/SyslogAppender.java
SyslogAppender.getPacketHeader
private String getPacketHeader(final long timeStamp) { if (header) { StringBuffer buf = new StringBuffer(dateFormat.format(new Date(timeStamp))); // RFC 3164 says leading space, not leading zero on days 1-9 if (buf.charAt(4) == '0') { buf.setCharAt(4, ' '); } buf.append(getLocalHostname()); buf.append(' '); return buf.toString(); } return ""; }
java
private String getPacketHeader(final long timeStamp) { if (header) { StringBuffer buf = new StringBuffer(dateFormat.format(new Date(timeStamp))); // RFC 3164 says leading space, not leading zero on days 1-9 if (buf.charAt(4) == '0') { buf.setCharAt(4, ' '); } buf.append(getLocalHostname()); buf.append(' '); return buf.toString(); } return ""; }
[ "private", "String", "getPacketHeader", "(", "final", "long", "timeStamp", ")", "{", "if", "(", "header", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "dateFormat", ".", "format", "(", "new", "Date", "(", "timeStamp", ")", ")", ")", ...
Gets HEADER portion of packet. @param timeStamp number of milliseconds after the standard base time. @return HEADER portion of packet, will be zero-length string if header is false. @since 1.2.15
[ "Gets", "HEADER", "portion", "of", "packet", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/log4j/net/SyslogAppender.java#L504-L516
train
VoltDB/voltdb
third_party/java/src/org/apache/log4j/net/SyslogAppender.java
SyslogAppender.sendLayoutMessage
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.append(msg); packet = buf.toString(); } sqw.setLevel(6); sqw.write(packet); } }
java
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.append(msg); packet = buf.toString(); } sqw.setLevel(6); sqw.write(packet); } }
[ "private", "void", "sendLayoutMessage", "(", "final", "String", "msg", ")", "{", "if", "(", "sqw", "!=", "null", ")", "{", "String", "packet", "=", "msg", ";", "String", "hdr", "=", "getPacketHeader", "(", "new", "Date", "(", ")", ".", "getTime", "(", ...
Set header or footer of layout. @param msg message body, may not be null.
[ "Set", "header", "or", "footer", "of", "layout", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/log4j/net/SyslogAppender.java#L522-L537
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java
JDBCSQLXML.getGZipData
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.outputStream.toByteArray()); return gZipData(); } catch (IOException ex) { throw Exceptions.notReadable(); } finally { this.freeOutputStream(); } }
java
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.outputStream.toByteArray()); return gZipData(); } catch (IOException ex) { throw Exceptions.notReadable(); } finally { this.freeOutputStream(); } }
[ "protected", "byte", "[", "]", "getGZipData", "(", ")", "throws", "SQLException", "{", "byte", "[", "]", "bytes", "=", "gZipData", "(", ")", ";", "if", "(", "bytes", "!=", "null", ")", "{", "return", "bytes", ";", "}", "if", "(", "(", "this", ".", ...
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. @throws java.sql.SQLException if an underlying I/O or transform error occurs @return this object's SQLXML value
[ "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", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java#L1177-L1199
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java
JDBCSQLXML.close
protected synchronized void close() { this.closed = true; setReadable(false); setWritable(false); freeOutputStream(); freeInputStream(); this.gzdata = null; }
java
protected synchronized void close() { this.closed = true; setReadable(false); setWritable(false); freeOutputStream(); freeInputStream(); this.gzdata = null; }
[ "protected", "synchronized", "void", "close", "(", ")", "{", "this", ".", "closed", "=", "true", ";", "setReadable", "(", "false", ")", ";", "setWritable", "(", "false", ")", ";", "freeOutputStream", "(", ")", ";", "freeInputStream", "(", ")", ";", "this...
closes this object and releases the resources that it holds.
[ "closes", "this", "object", "and", "releases", "the", "resources", "that", "it", "holds", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java#L1204-L1214
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java
JDBCSQLXML.createResult
protected <T extends Result>T createResult( Class<T> resultClass) throws SQLException { checkWritable(); setWritable(false); setReadable(true); if (JAXBResult.class.isAssignableFrom(resultClass)) { // Must go first presently, since JAXBResult extends SAXResult // (purely as an implmentation detail) and it's not possible // to instantiate a valid JAXBResult with a Zero-Args // constructor(or any subclass thereof, due to the finality of // its private UnmarshallerHandler) // FALL THROUGH... will throw an exception } else if ((resultClass == null) || StreamResult.class.isAssignableFrom(resultClass)) { return createStreamResult(resultClass); } else if (DOMResult.class.isAssignableFrom(resultClass)) { return createDOMResult(resultClass); } else if (SAXResult.class.isAssignableFrom(resultClass)) { return createSAXResult(resultClass); } else if (StAXResult.class.isAssignableFrom(resultClass)) { return createStAXResult(resultClass); } throw Util.invalidArgument("resultClass: " + resultClass); }
java
protected <T extends Result>T createResult( Class<T> resultClass) throws SQLException { checkWritable(); setWritable(false); setReadable(true); if (JAXBResult.class.isAssignableFrom(resultClass)) { // Must go first presently, since JAXBResult extends SAXResult // (purely as an implmentation detail) and it's not possible // to instantiate a valid JAXBResult with a Zero-Args // constructor(or any subclass thereof, due to the finality of // its private UnmarshallerHandler) // FALL THROUGH... will throw an exception } else if ((resultClass == null) || StreamResult.class.isAssignableFrom(resultClass)) { return createStreamResult(resultClass); } else if (DOMResult.class.isAssignableFrom(resultClass)) { return createDOMResult(resultClass); } else if (SAXResult.class.isAssignableFrom(resultClass)) { return createSAXResult(resultClass); } else if (StAXResult.class.isAssignableFrom(resultClass)) { return createStAXResult(resultClass); } throw Util.invalidArgument("resultClass: " + resultClass); }
[ "protected", "<", "T", "extends", "Result", ">", "T", "createResult", "(", "Class", "<", "T", ">", "resultClass", ")", "throws", "SQLException", "{", "checkWritable", "(", ")", ";", "setWritable", "(", "false", ")", ";", "setReadable", "(", "true", ")", ...
Retrieves a new Result for setting the XML value designated by this SQLXML instance. @param resultClass The class of the result, or null. @throws java.sql.SQLException if there is an error processing the XML value or the state is not writable @return for setting the XML value designated by this SQLXML instance.
[ "Retrieves", "a", "new", "Result", "for", "setting", "the", "XML", "value", "designated", "by", "this", "SQLXML", "instance", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java#L1645-L1672
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java
JDBCSQLXML.createSAXResult
@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.resultInstantiation(ex); } catch (InstantiationException ex) { throw Exceptions.resultInstantiation(ex); } catch (IllegalAccessException ex) { throw Exceptions.resultInstantiation(ex); } catch (ClassCastException ex) { throw Exceptions.resultInstantiation(ex); } StAXResult staxResult = createStAXResult(null); XMLStreamWriter xmlWriter = staxResult.getXMLStreamWriter(); SAX2XMLStreamWriter handler = new SAX2XMLStreamWriter(xmlWriter); result.setHandler(handler); return (T) result; }
java
@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.resultInstantiation(ex); } catch (InstantiationException ex) { throw Exceptions.resultInstantiation(ex); } catch (IllegalAccessException ex) { throw Exceptions.resultInstantiation(ex); } catch (ClassCastException ex) { throw Exceptions.resultInstantiation(ex); } StAXResult staxResult = createStAXResult(null); XMLStreamWriter xmlWriter = staxResult.getXMLStreamWriter(); SAX2XMLStreamWriter handler = new SAX2XMLStreamWriter(xmlWriter); result.setHandler(handler); return (T) result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "T", "extends", "Result", ">", "T", "createSAXResult", "(", "Class", "<", "T", ">", "resultClass", ")", "throws", "SQLException", "{", "SAXResult", "result", "=", "null", ";", "try", "{", ...
Retrieves a new SAXResult for setting the XML value designated by this SQLXML instance. @param resultClass The class of the result, or null. @throws java.sql.SQLException if there is an error processing the XML value @return for setting the XML value designated by this SQLXML instance.
[ "Retrieves", "a", "new", "SAXResult", "for", "setting", "the", "XML", "value", "designated", "by", "this", "SQLXML", "instance", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCSQLXML.java#L1746-L1772
train
VoltDB/voltdb
src/frontend/org/voltdb/expressions/AbstractValueExpression.java
AbstractValueExpression.bindingToIndexedExpression
@Override public List<AbstractExpression> bindingToIndexedExpression(AbstractExpression expr) { if (equals(expr)) { return s_reusableImmutableEmptyBinding; } return null; }
java
@Override public List<AbstractExpression> bindingToIndexedExpression(AbstractExpression expr) { if (equals(expr)) { return s_reusableImmutableEmptyBinding; } return null; }
[ "@", "Override", "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.
[ "Otherwise", "there", "is", "no", "binding", "possible", "indicated", "by", "a", "null", "return", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/AbstractValueExpression.java#L54-L60
train
VoltDB/voltdb
src/frontend/org/voltdb/utils/CSVLoader.java
CSVLoader.getClient
public static Client getClient(ClientConfig config, String[] servers, int port) throws Exception { config.setTopologyChangeAware(true); // Set client to be topology-aware final Client client = ClientFactory.createClient(config); for (String server : servers) { // Try connecting servers one by one until we have a success try { client.createConnection(server.trim(), port); break; } catch(IOException e) { // Only swallow the exceptions from Java network or connection problems // Unresolved hostname exceptions will be thrown } } if (client.getConnectedHostList().isEmpty()) { throw new Exception("Unable to connect to any servers."); } return client; }
java
public static Client getClient(ClientConfig config, String[] servers, int port) throws Exception { config.setTopologyChangeAware(true); // Set client to be topology-aware final Client client = ClientFactory.createClient(config); for (String server : servers) { // Try connecting servers one by one until we have a success try { client.createConnection(server.trim(), port); break; } catch(IOException e) { // Only swallow the exceptions from Java network or connection problems // Unresolved hostname exceptions will be thrown } } if (client.getConnectedHostList().isEmpty()) { throw new Exception("Unable to connect to any servers."); } return client; }
[ "public", "static", "Client", "getClient", "(", "ClientConfig", "config", ",", "String", "[", "]", "servers", ",", "int", "port", ")", "throws", "Exception", "{", "config", ".", "setTopologyChangeAware", "(", "true", ")", ";", "// Set client to be topology-aware",...
Get connection to servers in cluster. @param config @param servers @param port @return @throws Exception
[ "Get", "connection", "to", "servers", "in", "cluster", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CSVLoader.java#L612-L630
train
VoltDB/voltdb
src/frontend/org/voltdb/InternalConnectionHandler.java
InternalConnectionHandler.addAdapter
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(); }
java
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(); }
[ "public", "synchronized", "void", "addAdapter", "(", "int", "pid", ",", "InternalClientResponseAdapter", "adapter", ")", "{", "final", "ImmutableMap", ".", "Builder", "<", "Integer", ",", "InternalClientResponseAdapter", ">", "builder", "=", "ImmutableMap", ".", "bu...
Synchronized in case multiple partitions are added concurrently.
[ "Synchronized", "in", "case", "multiple", "partitions", "are", "added", "concurrently", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/InternalConnectionHandler.java#L53-L59
train
VoltDB/voltdb
src/frontend/org/voltdb/InternalConnectionHandler.java
InternalConnectionHandler.hasTable
public boolean hasTable(String name) { Table table = getCatalogContext().tables.get(name); return (table!=null); }
java
public boolean hasTable(String name) { Table table = getCatalogContext().tables.get(name); return (table!=null); }
[ "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.
[ "Returns", "true", "if", "a", "table", "with", "the", "given", "name", "exists", "in", "the", "server", "catalog", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/InternalConnectionHandler.java#L69-L72
train
VoltDB/voltdb
src/frontend/org/voltdb/InternalConnectionHandler.java
InternalConnectionHandler.callProcedure
public boolean callProcedure(InternalConnectionContext caller, Function<Integer, Boolean> backPressurePredicate, InternalConnectionStatsCollector statsCollector, ProcedureCallback procCallback, String proc, Object... fieldList) { Procedure catProc = InvocationDispatcher.getProcedureFromName(proc, getCatalogContext()); if (catProc == null) { String fmt = "Cannot invoke procedure %s from streaming interface %s. Procedure not found."; m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, fmt, proc, caller); m_failedCount.incrementAndGet(); return false; } StoredProcedureInvocation task = new StoredProcedureInvocation(); task.setProcName(proc); task.setParams(fieldList); try { task = MiscUtils.roundTripForCL(task); } catch (Exception e) { String fmt = "Cannot invoke procedure %s from streaming interface %s. failed to create task."; m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, fmt, proc, caller); m_failedCount.incrementAndGet(); return false; } int[] partitions = null; try { partitions = InvocationDispatcher.getPartitionsForProcedure(catProc, task); } catch (Exception e) { String fmt = "Can not invoke procedure %s from streaming interface %s. Partition not found."; m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, e, fmt, proc, caller); m_failedCount.incrementAndGet(); return false; } boolean mp = (partitions[0] == MpInitiator.MP_INIT_PID) || (partitions.length > 1); final InternalClientResponseAdapter adapter = mp ? m_adapters.get(MpInitiator.MP_INIT_PID) : m_adapters.get(partitions[0]); InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes(caller, adapter.connectionId()); final AuthUser user = getCatalogContext().authSystem.getImporterUser(); if (!adapter.createTransaction(kattrs, proc, catProc, procCallback, statsCollector, task, user, partitions, false, backPressurePredicate)) { m_failedCount.incrementAndGet(); return false; } m_submitSuccessCount.incrementAndGet(); return true; }
java
public boolean callProcedure(InternalConnectionContext caller, Function<Integer, Boolean> backPressurePredicate, InternalConnectionStatsCollector statsCollector, ProcedureCallback procCallback, String proc, Object... fieldList) { Procedure catProc = InvocationDispatcher.getProcedureFromName(proc, getCatalogContext()); if (catProc == null) { String fmt = "Cannot invoke procedure %s from streaming interface %s. Procedure not found."; m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, fmt, proc, caller); m_failedCount.incrementAndGet(); return false; } StoredProcedureInvocation task = new StoredProcedureInvocation(); task.setProcName(proc); task.setParams(fieldList); try { task = MiscUtils.roundTripForCL(task); } catch (Exception e) { String fmt = "Cannot invoke procedure %s from streaming interface %s. failed to create task."; m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, fmt, proc, caller); m_failedCount.incrementAndGet(); return false; } int[] partitions = null; try { partitions = InvocationDispatcher.getPartitionsForProcedure(catProc, task); } catch (Exception e) { String fmt = "Can not invoke procedure %s from streaming interface %s. Partition not found."; m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, e, fmt, proc, caller); m_failedCount.incrementAndGet(); return false; } boolean mp = (partitions[0] == MpInitiator.MP_INIT_PID) || (partitions.length > 1); final InternalClientResponseAdapter adapter = mp ? m_adapters.get(MpInitiator.MP_INIT_PID) : m_adapters.get(partitions[0]); InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes(caller, adapter.connectionId()); final AuthUser user = getCatalogContext().authSystem.getImporterUser(); if (!adapter.createTransaction(kattrs, proc, catProc, procCallback, statsCollector, task, user, partitions, false, backPressurePredicate)) { m_failedCount.incrementAndGet(); return false; } m_submitSuccessCount.incrementAndGet(); return true; }
[ "public", "boolean", "callProcedure", "(", "InternalConnectionContext", "caller", ",", "Function", "<", "Integer", ",", "Boolean", ">", "backPressurePredicate", ",", "InternalConnectionStatsCollector", "statsCollector", ",", "ProcedureCallback", "procCallback", ",", "String...
Use null backPressurePredicate for no back pressure
[ "Use", "null", "backPressurePredicate", "for", "no", "back", "pressure" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/InternalConnectionHandler.java#L169-L215
train
VoltDB/voltdb
src/frontend/org/voltdb/GlobalServiceElector.java
GlobalServiceElector.registerService
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); } } }
java
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); } } }
[ "synchronized", "void", "registerService", "(", "Promotable", "service", ")", "{", "m_services", ".", "add", "(", "service", ")", ";", "if", "(", "m_isLeader", ")", "{", "try", "{", "service", ".", "acceptPromotion", "(", ")", ";", "}", "catch", "(", "Ex...
Add a service to be notified if this node becomes the global leader
[ "Add", "a", "service", "to", "be", "notified", "if", "this", "node", "becomes", "the", "global", "leader" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/GlobalServiceElector.java#L50-L61
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionOp.java
ExpressionOp.resolveTypesForCaseWhen
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; } expr.nodes[RIGHT].nodes[LEFT].resolveTypes(session, nodes[RIGHT]); expr.nodes[RIGHT].nodes[RIGHT].resolveTypes(session, nodes[RIGHT]); expr = expr.nodes[RIGHT].nodes[RIGHT]; } expr = this; while (expr.opType == OpTypes.CASEWHEN) { dataType = Type.getAggregateType(expr.nodes[RIGHT].nodes[LEFT].dataType, dataType); dataType = Type.getAggregateType(expr.nodes[RIGHT].nodes[RIGHT].dataType, dataType); expr = expr.nodes[RIGHT].nodes[RIGHT]; } expr = this; while (expr.opType == OpTypes.CASEWHEN) { if (expr.nodes[RIGHT].nodes[LEFT].dataType == null) { expr.nodes[RIGHT].nodes[LEFT].dataType = dataType; } if (expr.nodes[RIGHT].nodes[RIGHT].dataType == null) { expr.nodes[RIGHT].nodes[RIGHT].dataType = dataType; } if (expr.nodes[RIGHT].dataType == null) { expr.nodes[RIGHT].dataType = dataType; } expr = expr.nodes[RIGHT].nodes[RIGHT]; } if (dataType == null) { throw Error.error(ErrorCode.X_42567); } }
java
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; } expr.nodes[RIGHT].nodes[LEFT].resolveTypes(session, nodes[RIGHT]); expr.nodes[RIGHT].nodes[RIGHT].resolveTypes(session, nodes[RIGHT]); expr = expr.nodes[RIGHT].nodes[RIGHT]; } expr = this; while (expr.opType == OpTypes.CASEWHEN) { dataType = Type.getAggregateType(expr.nodes[RIGHT].nodes[LEFT].dataType, dataType); dataType = Type.getAggregateType(expr.nodes[RIGHT].nodes[RIGHT].dataType, dataType); expr = expr.nodes[RIGHT].nodes[RIGHT]; } expr = this; while (expr.opType == OpTypes.CASEWHEN) { if (expr.nodes[RIGHT].nodes[LEFT].dataType == null) { expr.nodes[RIGHT].nodes[LEFT].dataType = dataType; } if (expr.nodes[RIGHT].nodes[RIGHT].dataType == null) { expr.nodes[RIGHT].nodes[RIGHT].dataType = dataType; } if (expr.nodes[RIGHT].dataType == null) { expr.nodes[RIGHT].dataType = dataType; } expr = expr.nodes[RIGHT].nodes[RIGHT]; } if (dataType == null) { throw Error.error(ErrorCode.X_42567); } }
[ "void", "resolveTypesForCaseWhen", "(", "Session", "session", ")", "{", "if", "(", "dataType", "!=", "null", ")", "{", "return", ";", "}", "Expression", "expr", "=", "this", ";", "while", "(", "expr", ".", "opType", "==", "OpTypes", ".", "CASEWHEN", ")",...
For CASE WHEN and its special cases section 9.3 of the SQL standard on type aggregation is implemented.
[ "For", "CASE", "WHEN", "and", "its", "special", "cases", "section", "9", ".", "3", "of", "the", "SQL", "standard", "on", "type", "aggregation", "is", "implemented", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionOp.java#L380-L434
train
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.fromWKT
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()) { // Add 0.0 to avoid -0.0. double longitude = toDouble(m.group(1), m.group(2)) + 0.0; double latitude = toDouble(m.group(3), m.group(4)) + 0.0; if (Math.abs(latitude) > 90.0) { throw new IllegalArgumentException(String.format("Latitude \"%f\" out of bounds.", latitude)); } if (Math.abs(longitude) > 180.0) { throw new IllegalArgumentException(String.format("Longitude \"%f\" out of bounds.", longitude)); } return new GeographyPointValue(longitude, latitude); } else { throw new IllegalArgumentException("Cannot construct GeographyPointValue value from \"" + param + "\""); } }
java
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()) { // Add 0.0 to avoid -0.0. double longitude = toDouble(m.group(1), m.group(2)) + 0.0; double latitude = toDouble(m.group(3), m.group(4)) + 0.0; if (Math.abs(latitude) > 90.0) { throw new IllegalArgumentException(String.format("Latitude \"%f\" out of bounds.", latitude)); } if (Math.abs(longitude) > 180.0) { throw new IllegalArgumentException(String.format("Longitude \"%f\" out of bounds.", longitude)); } return new GeographyPointValue(longitude, latitude); } else { throw new IllegalArgumentException("Cannot construct GeographyPointValue value from \"" + param + "\""); } }
[ "public", "static", "GeographyPointValue", "fromWKT", "(", "String", "param", ")", "{", "if", "(", "param", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null well known text argument to GeographyPointValue constructor.\"", ")", ";", "}", ...
Create a GeographyPointValue from a well-known text string. @param param A well-known text string. @return A new instance of GeographyPointValue.
[ "Create", "a", "GeographyPointValue", "from", "a", "well", "-", "known", "text", "string", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L91-L110
train
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.formatLngLat
String formatLngLat() { DecimalFormat df = new DecimalFormat("##0.0###########"); // Explicitly test for differences less than 1.0e-12 and // force them to be zero. Otherwise you may find a case // where two points differ in the less significant bits, but // they format as the same number. 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); }
java
String formatLngLat() { DecimalFormat df = new DecimalFormat("##0.0###########"); // Explicitly test for differences less than 1.0e-12 and // force them to be zero. Otherwise you may find a case // where two points differ in the less significant bits, but // they format as the same number. 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); }
[ "String", "formatLngLat", "(", ")", "{", "DecimalFormat", "df", "=", "new", "DecimalFormat", "(", "\"##0.0###########\"", ")", ";", "// Explicitly test for differences less than 1.0e-12 and", "// force them to be zero. Otherwise you may find a case", "// where two points differ in t...
Format the coordinates for this point. Use 12 digits of precision after the decimal point. @return A string containing the longitude and latitude for this point separated by one space.
[ "Format", "the", "coordinates", "for", "this", "point", ".", "Use", "12", "digits", "of", "precision", "after", "the", "decimal", "point", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L135-L145
train
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.unflattenFromBuffer
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) { // This is a null point. return null; } return new GeographyPointValue(lng, lat); }
java
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) { // This is a null point. return null; } return new GeographyPointValue(lng, lat); }
[ "public", "static", "GeographyPointValue", "unflattenFromBuffer", "(", "ByteBuffer", "inBuffer", ",", "int", "offset", ")", "{", "double", "lng", "=", "inBuffer", ".", "getDouble", "(", "offset", ")", ";", "double", "lat", "=", "inBuffer", ".", "getDouble", "(...
Deserializes a point from a ByteBuffer, at an absolute offset. @param inBuffer The ByteBuffer from which to read the bytes for a point. @param offset Absolute offset of point data in buffer. @return A new instance of GeographyPointValue.
[ "Deserializes", "a", "point", "from", "a", "ByteBuffer", "at", "an", "absolute", "offset", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L230-L239
train
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.normalize
private static double normalize(double v, double range) { double a = v-Math.floor((v + (range/2))/range)*range; // Make sure that a and v have the same sign // when abs(v) = 180. if (Math.abs(a) == 180.0 && (a * v) < 0) { a *= -1; } // The addition of 0.0 is to avoid negative // zero, which just confuses things. return a + 0.0; }
java
private static double normalize(double v, double range) { double a = v-Math.floor((v + (range/2))/range)*range; // Make sure that a and v have the same sign // when abs(v) = 180. if (Math.abs(a) == 180.0 && (a * v) < 0) { a *= -1; } // The addition of 0.0 is to avoid negative // zero, which just confuses things. return a + 0.0; }
[ "private", "static", "double", "normalize", "(", "double", "v", ",", "double", "range", ")", "{", "double", "a", "=", "v", "-", "Math", ".", "floor", "(", "(", "v", "+", "(", "range", "/", "2", ")", ")", "/", "range", ")", "*", "range", ";", "/...
by subtracting multiples of 360.
[ "by", "subtracting", "multiples", "of", "360", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L347-L357
train
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.mul
@Deprecated public GeographyPointValue mul(double alpha) { return GeographyPointValue.normalizeLngLat(getLongitude() * alpha + 0.0, getLatitude() * alpha + 0.0); }
java
@Deprecated public GeographyPointValue mul(double alpha) { return GeographyPointValue.normalizeLngLat(getLongitude() * alpha + 0.0, getLatitude() * alpha + 0.0); }
[ "@", "Deprecated", "public", "GeographyPointValue", "mul", "(", "double", "alpha", ")", "{", "return", "GeographyPointValue", ".", "normalizeLngLat", "(", "getLongitude", "(", ")", "*", "alpha", "+", "0.0", ",", "getLatitude", "(", ")", "*", "alpha", "+", "0...
Return a point scaled by the given alpha value. @param alpha The amount by which to scale this. @return The scaled point.
[ "Return", "a", "point", "scaled", "by", "the", "given", "alpha", "value", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L422-L426
train
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.rotate
@Deprecated 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); // Translate to the center. double longitude = getLongitude() - center.getLongitude(); double latitude = getLatitude() - center.getLatitude(); // Rotate and translate back. return GeographyPointValue.normalizeLngLat((cosphi * longitude - sinphi * latitude) + center.getLongitude(), (sinphi * longitude + cosphi * latitude) + center.getLatitude()); }
java
@Deprecated 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); // Translate to the center. double longitude = getLongitude() - center.getLongitude(); double latitude = getLatitude() - center.getLatitude(); // Rotate and translate back. return GeographyPointValue.normalizeLngLat((cosphi * longitude - sinphi * latitude) + center.getLongitude(), (sinphi * longitude + cosphi * latitude) + center.getLatitude()); }
[ "@", "Deprecated", "public", "GeographyPointValue", "rotate", "(", "double", "phi", ",", "GeographyPointValue", "center", ")", "{", "double", "sinphi", "=", "Math", ".", "sin", "(", "2", "*", "Math", ".", "PI", "*", "phi", "/", "360.0", ")", ";", "double...
Return a new point which is this point rotated by the angle phi around a given center point. @param phi The angle to rotate in degrees. @param center The center of rotation. @return A new, rotated point.
[ "Return", "a", "new", "point", "which", "is", "this", "point", "rotated", "by", "the", "angle", "phi", "around", "a", "given", "center", "point", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L435-L446
train
VoltDB/voltdb
src/frontend/org/voltdb/VoltZK.java
VoltZK.createPersistentZKNodes
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.create(VoltZK.ZK_HIERARCHY[i], null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null); } for (ZKUtil.StringCallback cb : callbacks) { try { cb.get(); } catch (org.apache.zookeeper_voltpatches.KeeperException.NodeExistsException e) { // this is an expected race. } catch (Exception e) { VoltDB.crashLocalVoltDB(e.getMessage(), true, e); } } }
java
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.create(VoltZK.ZK_HIERARCHY[i], null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null); } for (ZKUtil.StringCallback cb : callbacks) { try { cb.get(); } catch (org.apache.zookeeper_voltpatches.KeeperException.NodeExistsException e) { // this is an expected race. } catch (Exception e) { VoltDB.crashLocalVoltDB(e.getMessage(), true, e); } } }
[ "public", "static", "void", "createPersistentZKNodes", "(", "ZooKeeper", "zk", ")", "{", "LinkedList", "<", "ZKUtil", ".", "StringCallback", ">", "callbacks", "=", "new", "LinkedList", "<", "ZKUtil", ".", "StringCallback", ">", "(", ")", ";", "for", "(", "in...
Race to create the persistent nodes.
[ "Race", "to", "create", "the", "persistent", "nodes", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltZK.java#L241-L257
train
VoltDB/voltdb
src/frontend/org/voltdb/VoltZK.java
VoltZK.parseMailboxContents
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(json); long HSId = jsObj.getLong("HSId"); Integer partitionId = null; if (jsObj.has("partitionId")) { partitionId = jsObj.getInt("partitionId"); } content = new MailboxNodeContent(HSId, partitionId); objects.add(content); } return objects; }
java
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(json); long HSId = jsObj.getLong("HSId"); Integer partitionId = null; if (jsObj.has("partitionId")) { partitionId = jsObj.getInt("partitionId"); } content = new MailboxNodeContent(HSId, partitionId); objects.add(content); } return objects; }
[ "public", "static", "List", "<", "MailboxNodeContent", ">", "parseMailboxContents", "(", "List", "<", "String", ">", "jsons", ")", "throws", "JSONException", "{", "ArrayList", "<", "MailboxNodeContent", ">", "objects", "=", "new", "ArrayList", "<", "MailboxNodeCon...
Helper method for parsing mailbox node contents into Java objects. @throws JSONException
[ "Helper", "method", "for", "parsing", "mailbox", "node", "contents", "into", "Java", "objects", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltZK.java#L263-L277
train
VoltDB/voltdb
src/frontend/org/voltdb/VoltZK.java
VoltZK.createMigratePartitionLeaderInfo
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.NODEEXISTS) { try { zk.setData(migrate_partition_leader_info, info.toBytes(), -1); } catch (KeeperException | InterruptedException | JSONException e1) { } return false; } org.voltdb.VoltDB.crashLocalVoltDB("Unable to create MigratePartitionLeader Indicator", true, e); } catch (InterruptedException | JSONException e) { org.voltdb.VoltDB.crashLocalVoltDB("Unable to create MigratePartitionLeader Indicator", true, e); } return true; }
java
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.NODEEXISTS) { try { zk.setData(migrate_partition_leader_info, info.toBytes(), -1); } catch (KeeperException | InterruptedException | JSONException e1) { } return false; } org.voltdb.VoltDB.crashLocalVoltDB("Unable to create MigratePartitionLeader Indicator", true, e); } catch (InterruptedException | JSONException e) { org.voltdb.VoltDB.crashLocalVoltDB("Unable to create MigratePartitionLeader Indicator", true, e); } return true; }
[ "public", "static", "boolean", "createMigratePartitionLeaderInfo", "(", "ZooKeeper", "zk", ",", "MigratePartitionLeaderInfo", "info", ")", "{", "try", "{", "zk", ".", "create", "(", "migrate_partition_leader_info", ",", "info", ".", "toBytes", "(", ")", ",", "Ids"...
Save MigratePartitionLeader information for error handling
[ "Save", "MigratePartitionLeader", "information", "for", "error", "handling" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltZK.java#L570-L588
train
VoltDB/voltdb
src/frontend/org/voltdb/VoltZK.java
VoltZK.getMigratePartitionLeaderInfo
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 | InterruptedException | JSONException e) { } return null; }
java
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 | InterruptedException | JSONException e) { } return null; }
[ "public", "static", "MigratePartitionLeaderInfo", "getMigratePartitionLeaderInfo", "(", "ZooKeeper", "zk", ")", "{", "try", "{", "byte", "[", "]", "data", "=", "zk", ".", "getData", "(", "migrate_partition_leader_info", ",", "null", ",", "null", ")", ";", "if", ...
get MigratePartitionLeader information
[ "get", "MigratePartitionLeader", "information" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltZK.java#L593-L603
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java
ExpressionLogical.convertDateTimeLiteral
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.opType == OpTypes.VALUE && b.dataType.isCharacterType()) { b.valueData = a.dataType.castToType(session, b.valueData, b.dataType); b.dataType = a.dataType; return true; } return false; }
java
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.opType == OpTypes.VALUE && b.dataType.isCharacterType()) { b.valueData = a.dataType.castToType(session, b.valueData, b.dataType); b.dataType = a.dataType; return true; } return false; }
[ "private", "boolean", "convertDateTimeLiteral", "(", "Session", "session", ",", "Expression", "a", ",", "Expression", "b", ")", "{", "if", "(", "a", ".", "dataType", ".", "isDateTimeType", "(", ")", ")", "{", "}", "else", "if", "(", "b", ".", "dataType",...
for compatibility, convert a datetime character string to a datetime value for comparison
[ "for", "compatibility", "convert", "a", "datetime", "character", "string", "to", "a", "datetime", "value", "for", "comparison" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java#L730-L756
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java
ExpressionLogical.distributeOr
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[RIGHT] = nodes[RIGHT]; nodes[RIGHT] = temp; } else if (nodes[RIGHT].opType == OpTypes.AND) { Expression temp = nodes[LEFT]; nodes[LEFT] = nodes[RIGHT]; nodes[RIGHT] = temp; distributeOr(); return; } ((ExpressionLogical) nodes[LEFT]).distributeOr(); ((ExpressionLogical) nodes[RIGHT]).distributeOr(); }
java
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[RIGHT] = nodes[RIGHT]; nodes[RIGHT] = temp; } else if (nodes[RIGHT].opType == OpTypes.AND) { Expression temp = nodes[LEFT]; nodes[LEFT] = nodes[RIGHT]; nodes[RIGHT] = temp; distributeOr(); return; } ((ExpressionLogical) nodes[LEFT]).distributeOr(); ((ExpressionLogical) nodes[RIGHT]).distributeOr(); }
[ "void", "distributeOr", "(", ")", "{", "if", "(", "opType", "!=", "OpTypes", ".", "OR", ")", "{", "return", ";", "}", "if", "(", "nodes", "[", "LEFT", "]", ".", "opType", "==", "OpTypes", ".", "AND", ")", "{", "opType", "=", "OpTypes", ".", "AND"...
Converts an OR containing an AND to an AND
[ "Converts", "an", "OR", "containing", "an", "AND", "to", "an", "AND" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java#L1482-L1510
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java
ExpressionLogical.isSimpleBound
boolean isSimpleBound() { if (opType == OpTypes.IS_NULL) { return true; } if (nodes[RIGHT] != null) { if (nodes[RIGHT].opType == OpTypes.VALUE) { // also true for all parameters return true; } if (nodes[RIGHT].opType == OpTypes.SQL_FUNCTION) { if (((FunctionSQL) nodes[RIGHT]).isValueFunction()) { return true; } } } return false; }
java
boolean isSimpleBound() { if (opType == OpTypes.IS_NULL) { return true; } if (nodes[RIGHT] != null) { if (nodes[RIGHT].opType == OpTypes.VALUE) { // also true for all parameters return true; } if (nodes[RIGHT].opType == OpTypes.SQL_FUNCTION) { if (((FunctionSQL) nodes[RIGHT]).isValueFunction()) { return true; } } } return false; }
[ "boolean", "isSimpleBound", "(", ")", "{", "if", "(", "opType", "==", "OpTypes", ".", "IS_NULL", ")", "{", "return", "true", ";", "}", "if", "(", "nodes", "[", "RIGHT", "]", "!=", "null", ")", "{", "if", "(", "nodes", "[", "RIGHT", "]", ".", "opT...
Called only on comparison expressions after reordering which have a COLUMN left leaf
[ "Called", "only", "on", "comparison", "expressions", "after", "reordering", "which", "have", "a", "COLUMN", "left", "leaf" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java#L1581-L1602
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java
ExpressionLogical.swapCondition
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; case OpTypes.NOT_DISTINCT : i = OpTypes.NOT_DISTINCT; break; case OpTypes.EQUAL : break; default : throw Error.runtimeError(ErrorCode.U_S0500, "Expression.swapCondition"); } opType = i; Expression e = nodes[LEFT]; nodes[LEFT] = nodes[RIGHT]; nodes[RIGHT] = e; }
java
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; case OpTypes.NOT_DISTINCT : i = OpTypes.NOT_DISTINCT; break; case OpTypes.EQUAL : break; default : throw Error.runtimeError(ErrorCode.U_S0500, "Expression.swapCondition"); } opType = i; Expression e = nodes[LEFT]; nodes[LEFT] = nodes[RIGHT]; nodes[RIGHT] = e; }
[ "void", "swapCondition", "(", ")", "{", "int", "i", "=", "OpTypes", ".", "EQUAL", ";", "switch", "(", "opType", ")", "{", "case", "OpTypes", ".", "GREATER_EQUAL", ":", "i", "=", "OpTypes", ".", "SMALLER_EQUAL", ";", "break", ";", "case", "OpTypes", "."...
Swap the condition with its complement
[ "Swap", "the", "condition", "with", "its", "complement" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java#L1607-L1647
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java
ExpressionLogical.voltConvertBinaryIntegerLiteral
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; whichChild = LEFT; } else { return false; } return ExpressionValue.voltMutateToBigintType(nonIntegralExpr, this, whichChild); }
java
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; whichChild = LEFT; } else { return false; } return ExpressionValue.voltMutateToBigintType(nonIntegralExpr, this, whichChild); }
[ "private", "boolean", "voltConvertBinaryIntegerLiteral", "(", "Session", "session", ",", "Expression", "lhs", ",", "Expression", "rhs", ")", "{", "Expression", "nonIntegralExpr", ";", "int", "whichChild", ";", "if", "(", "lhs", ".", "dataType", ".", "isIntegralTyp...
If one child is an integer, and the other is a VARBINARY literal, try to convert the literal to an integer.
[ "If", "one", "child", "is", "an", "integer", "and", "the", "other", "is", "a", "VARBINARY", "literal", "try", "to", "convert", "the", "literal", "to", "an", "integer", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionLogical.java#L1739-L1754
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/RowStoreAVL.java
RowStoreAVL.delete
public final void delete(Row row) { for (int i = indexList.length - 1; i >= 0; i--) { indexList[i].delete(this, row); } remove(row.getPos()); }
java
public final void delete(Row row) { for (int i = indexList.length - 1; i >= 0; i--) { indexList[i].delete(this, row); } remove(row.getPos()); }
[ "public", "final", "void", "delete", "(", "Row", "row", ")", "{", "for", "(", "int", "i", "=", "indexList", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "indexList", "[", "i", "]", ".", "delete", "(", "this", ",", "...
Basic delete with no logging or referential checks.
[ "Basic", "delete", "with", "no", "logging", "or", "referential", "checks", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/RowStoreAVL.java#L117-L124
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.compare
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; }
java
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; }
[ "public", "int", "compare", "(", "final", "Object", "a", ",", "final", "Object", "b", ")", "{", "final", "long", "awhen", "=", "(", "(", "Task", ")", "(", "a", ")", ")", ".", "getNextScheduled", "(", ")", ";", "final", "long", "bwhen", "=", "(", ...
Required to back the priority queue for scheduled tasks. @param a the first Task @param b the second Task @return 0 if equal, < 0 if a < b, > 0 if a > b
[ "Required", "to", "back", "the", "priority", "queue", "for", "scheduled", "tasks", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L106-L114
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.scheduleAfter
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); }
java
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); }
[ "public", "Object", "scheduleAfter", "(", "final", "long", "delay", ",", "final", "Runnable", "runnable", ")", "throws", "IllegalArgumentException", "{", "if", "(", "runnable", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"runnable ==...
Causes the specified Runnable to be executed once in the background after the specified delay. @param delay in milliseconds @param runnable the Runnable to execute. @return opaque reference to the internal task @throws IllegalArgumentException if runnable is null
[ "Causes", "the", "specified", "Runnable", "to", "be", "executed", "once", "in", "the", "background", "after", "the", "specified", "delay", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L177-L186
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.scheduleAt
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(), runnable, 0, false); }
java
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(), runnable, 0, false); }
[ "public", "Object", "scheduleAt", "(", "final", "Date", "date", ",", "final", "Runnable", "runnable", ")", "throws", "IllegalArgumentException", "{", "if", "(", "date", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"date == null\"", ...
Causes the specified Runnable to be executed once in the background at the specified time. @param date time at which to execute the specified Runnable @param runnable the Runnable to execute. @return opaque reference to the internal task @throws IllegalArgumentException if date or runnable is null
[ "Causes", "the", "specified", "Runnable", "to", "be", "executed", "once", "in", "the", "background", "at", "the", "specified", "time", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L197-L208
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.schedulePeriodicallyAt
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"); } else if (runnable == null) { throw new IllegalArgumentException("runnable == null"); } return addTask(date.getTime(), runnable, period, relative); }
java
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"); } else if (runnable == null) { throw new IllegalArgumentException("runnable == null"); } return addTask(date.getTime(), runnable, period, relative); }
[ "public", "Object", "schedulePeriodicallyAt", "(", "final", "Date", "date", ",", "final", "long", "period", ",", "final", "Runnable", "runnable", ",", "final", "boolean", "relative", ")", "throws", "IllegalArgumentException", "{", "if", "(", "date", "==", "null"...
Causes the specified Runnable to be executed periodically in the background, starting at the specified time. @return opaque reference to the internal task @param period the cycle period @param relative if true, fixed rate sheduling else fixed delay scheduling @param date time at which to execute the specified Runnable @param runnable the Runnable to execute @throws IllegalArgumentException if date or runnable is null, or period is <= 0
[ "Causes", "the", "specified", "Runnable", "to", "be", "executed", "periodically", "in", "the", "background", "starting", "at", "the", "specified", "time", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L222-L236
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.schedulePeriodicallyAfter
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("runnable == null"); } return addTask(now() + delay, runnable, period, relative); }
java
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("runnable == null"); } return addTask(now() + delay, runnable, period, relative); }
[ "public", "Object", "schedulePeriodicallyAfter", "(", "final", "long", "delay", ",", "final", "long", "period", ",", "final", "Runnable", "runnable", ",", "final", "boolean", "relative", ")", "throws", "IllegalArgumentException", "{", "if", "(", "period", "<=", ...
Causes the specified Runnable to be executed periodically in the background, starting after the specified delay. @return opaque reference to the internal task @param period the cycle period @param relative if true, fixed rate sheduling else fixed delay scheduling @param delay in milliseconds @param runnable the Runnable to execute. @throws IllegalArgumentException if runnable is null or period is <= 0
[ "Causes", "the", "specified", "Runnable", "to", "be", "executed", "periodically", "in", "the", "background", "starting", "after", "the", "specified", "delay", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L249-L260
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.shutdownImmediately
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(); } }
java
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(); } }
[ "public", "synchronized", "void", "shutdownImmediately", "(", ")", "{", "if", "(", "!", "this", ".", "isShutdown", ")", "{", "final", "Thread", "runner", "=", "this", ".", "taskRunnerThread", ";", "this", ".", "isShutdown", "=", "true", ";", "if", "(", "...
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. After this call, the timer has permanently entered the shutdown state; attempting to schedule any new task or directly restart this timer will result in an IllegalStateException. <p> <b>Note:</b> If the integrity of work performed by a scheduled task may be adversely affected by an unplanned interruption, it is the responsibility of the task's implementation to deal correctly with the possibility that this method is called while such work is in progress, for instance by catching the InterruptedException, completing the work, and then rethrowing the exception.
[ "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"...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L300-L313
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.isFixedRate
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; } }
java
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; } }
[ "public", "static", "boolean", "isFixedRate", "(", "final", "Object", "task", ")", "{", "if", "(", "task", "instanceof", "Task", ")", "{", "final", "Task", "ltask", "=", "(", "Task", ")", "task", ";", "return", "(", "ltask", ".", "relative", "&&", "lta...
Retrieves whether the specified argument references a task scheduled periodically using fixed rate scheduling. @param task a task reference @return true if the task is scheduled at a fixed rate
[ "Retrieves", "whether", "the", "specified", "argument", "references", "a", "task", "scheduled", "periodically", "using", "fixed", "rate", "scheduling", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L347-L356
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.isFixedDelay
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; } }
java
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; } }
[ "public", "static", "boolean", "isFixedDelay", "(", "final", "Object", "task", ")", "{", "if", "(", "task", "instanceof", "Task", ")", "{", "final", "Task", "ltask", "=", "(", "Task", ")", "task", ";", "return", "(", "!", "ltask", ".", "relative", "&&"...
Retrieves whether the specified argument references a task scheduled periodically using fixed delay scheduling. @param task a task reference @return true if the reference is scheduled using a fixed delay
[ "Retrieves", "whether", "the", "specified", "argument", "references", "a", "task", "scheduled", "periodically", "using", "fixed", "delay", "scheduling", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L365-L374
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.getLastScheduled
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; } }
java
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; } }
[ "public", "static", "Date", "getLastScheduled", "(", "Object", "task", ")", "{", "if", "(", "task", "instanceof", "Task", ")", "{", "final", "Task", "ltask", "=", "(", "Task", ")", "task", ";", "final", "long", "last", "=", "ltask", ".", "getLastSchedule...
Retrieves the last time the referenced task was executed, as a Date object. If the task has never been executed, null is returned. @param task a task reference @return the last time the referenced task was executed; null if never
[ "Retrieves", "the", "last", "time", "the", "referenced", "task", "was", "executed", "as", "a", "Date", "object", ".", "If", "the", "task", "has", "never", "been", "executed", "null", "is", "returned", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L395-L406
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.getNextScheduled
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; } }
java
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; } }
[ "public", "static", "Date", "getNextScheduled", "(", "Object", "task", ")", "{", "if", "(", "task", "instanceof", "Task", ")", "{", "final", "Task", "ltask", "=", "(", "Task", ")", "task", ";", "final", "long", "next", "=", "ltask", ".", "isCancelled", ...
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. @param task a task reference @return the next time the referenced task is due to be executed
[ "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", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L439-L451
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.addTask
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); // sychronized this.taskQueue.addTask(task); // sychronized this.restart(); return task; }
java
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); // sychronized this.taskQueue.addTask(task); // sychronized this.restart(); return task; }
[ "protected", "Task", "addTask", "(", "final", "long", "first", ",", "final", "Runnable", "runnable", ",", "final", "long", "period", ",", "boolean", "relative", ")", "{", "if", "(", "this", ".", "isShutdown", ")", "{", "throw", "new", "IllegalStateException"...
Adds to the task queue a new Task object encapsulating the supplied Runnable and scheduling arguments. @param first the time of the task's first execution @param runnable the Runnable to execute @param period the task's periodicity @param relative if true, use fixed rate else use fixed delay scheduling @return an opaque reference to the internal task
[ "Adds", "to", "the", "task", "queue", "a", "new", "Task", "object", "encapsulating", "the", "supplied", "Runnable", "and", "scheduling", "arguments", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L463-L479
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.nextTask
protected Task nextTask() { try { while (!this.isShutdown || Thread.interrupted()) { long now; long next; long wait; Task task; // synchronized to ensure removeTask // applies only to the peeked task, // when the computed wait <= 0 synchronized (this.taskQueue) { task = this.taskQueue.peekTask(); if (task == null) { // queue is empty break; } now = System.currentTimeMillis(); next = task.next; wait = (next - now); if (wait > 0) { // release ownership of taskQueue monitor and await // notification of task addition or cancellation, // at most until the time when the peeked task is // next supposed to execute this.taskQueue.park(wait); continue; // to top of loop } else { this.taskQueue.removeTask(); } } long period = task.period; if (period > 0) { // repeated task if (task.relative) { // using fixed rate shceduling final long late = (now - next); if (late > period) { // ensure that really late tasks don't // completely saturate the head of the // task queue period = 0; /** @todo : is -1, -2 ... fairer? */ } else if (late > 0) { // compensate for scheduling overruns period -= late; } } task.updateSchedule(now, now + period); this.taskQueue.addTask(task); } return task; } } catch (InterruptedException e) { //e.printStackTrace(); } return null; }
java
protected Task nextTask() { try { while (!this.isShutdown || Thread.interrupted()) { long now; long next; long wait; Task task; // synchronized to ensure removeTask // applies only to the peeked task, // when the computed wait <= 0 synchronized (this.taskQueue) { task = this.taskQueue.peekTask(); if (task == null) { // queue is empty break; } now = System.currentTimeMillis(); next = task.next; wait = (next - now); if (wait > 0) { // release ownership of taskQueue monitor and await // notification of task addition or cancellation, // at most until the time when the peeked task is // next supposed to execute this.taskQueue.park(wait); continue; // to top of loop } else { this.taskQueue.removeTask(); } } long period = task.period; if (period > 0) { // repeated task if (task.relative) { // using fixed rate shceduling final long late = (now - next); if (late > period) { // ensure that really late tasks don't // completely saturate the head of the // task queue period = 0; /** @todo : is -1, -2 ... fairer? */ } else if (late > 0) { // compensate for scheduling overruns period -= late; } } task.updateSchedule(now, now + period); this.taskQueue.addTask(task); } return task; } } catch (InterruptedException e) { //e.printStackTrace(); } return null; }
[ "protected", "Task", "nextTask", "(", ")", "{", "try", "{", "while", "(", "!", "this", ".", "isShutdown", "||", "Thread", ".", "interrupted", "(", ")", ")", "{", "long", "now", ";", "long", "next", ";", "long", "wait", ";", "Task", "task", ";", "//...
Retrieves the next task to execute, or null if this timer is shutdown, the current thread is interrupted, or there are no queued tasks. @return the next task to execute, or null
[ "Retrieves", "the", "next", "task", "to", "execute", "or", "null", "if", "this", "timer", "is", "shutdown", "the", "current", "thread", "is", "interrupted", "or", "there", "are", "no", "queued", "tasks", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L498-L568
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/Site.java
Site.initializeEE
ExecutionEngine initializeEE() { String hostname = CoreUtils.getHostnameOrAddress(); HashinatorConfig hashinatorConfig = TheHashinator.getCurrentConfig(); ExecutionEngine eeTemp = null; Deployment deploy = m_context.cluster.getDeployment().get("deployment"); final int defaultDrBufferSize = Integer.getInteger("DR_DEFAULT_BUFFER_SIZE", 512 * 1024); // 512KB int configuredTimeout = Integer.getInteger("MAX_EXPORT_BUFFER_FLUSH_INTERVAL", 4*1000); final int exportFlushTimeout = configuredTimeout > 0 ? configuredTimeout : 4*1000; int tempTableMaxSize = deploy.getSystemsettings().get("systemsettings").getTemptablemaxsize(); if (System.getProperty("TEMP_TABLE_MAX_SIZE") != null) { // Allow a system property to override the deployment setting // for testing purposes. tempTableMaxSize = Integer.getInteger("TEMP_TABLE_MAX_SIZE"); } try { // NATIVE_EE_JNI and NATIVE_EE_LARGE_JNI if (m_backend.isDefaultJNITarget) { eeTemp = new ExecutionEngineJNI( m_context.cluster.getRelativeIndex(), m_siteId, m_partitionId, m_context.getNodeSettings().getLocalSitesCount(), CoreUtils.getHostIdFromHSId(m_siteId), hostname, m_context.cluster.getDrclusterid(), defaultDrBufferSize, tempTableMaxSize, hashinatorConfig, m_isLowestSiteId, exportFlushTimeout); } else if (m_backend == BackendTarget.NATIVE_EE_SPY_JNI){ Class<?> spyClass = Class.forName("org.mockito.Mockito"); Method spyMethod = spyClass.getDeclaredMethod("spy", Object.class); ExecutionEngine internalEE = new ExecutionEngineJNI( m_context.cluster.getRelativeIndex(), m_siteId, m_partitionId, m_context.getNodeSettings().getLocalSitesCount(), CoreUtils.getHostIdFromHSId(m_siteId), hostname, m_context.cluster.getDrclusterid(), defaultDrBufferSize, tempTableMaxSize, hashinatorConfig, m_isLowestSiteId, exportFlushTimeout); eeTemp = (ExecutionEngine) spyMethod.invoke(null, internalEE); } else if (m_backend.isIPC) { // set up the EE over IPC eeTemp = new ExecutionEngineIPC( m_context.cluster.getRelativeIndex(), m_siteId, m_partitionId, m_context.getNodeSettings().getLocalSitesCount(), CoreUtils.getHostIdFromHSId(m_siteId), hostname, m_context.cluster.getDrclusterid(), defaultDrBufferSize, tempTableMaxSize, m_backend, VoltDB.instance().getConfig().m_ipcPort, hashinatorConfig, m_isLowestSiteId, exportFlushTimeout); } else { /* This seems very bad. */ throw new VoltAbortException( String.format("Unexpected BackendTarget value %s", m_backend) ); } eeTemp.loadCatalog(m_startupConfig.m_timestamp, m_startupConfig.m_serializedCatalog); eeTemp.setBatchTimeout(m_context.cluster.getDeployment().get("deployment"). getSystemsettings().get("systemsettings").getQuerytimeout()); } // just print error info an bail if we run into an error here catch (final Exception ex) { hostLog.l7dlog( Level.FATAL, LogKeys.host_ExecutionSite_FailedConstruction.name(), new Object[] { m_siteId, m_siteIndex }, ex); VoltDB.crashLocalVoltDB(ex.getMessage(), true, ex); } return eeTemp; }
java
ExecutionEngine initializeEE() { String hostname = CoreUtils.getHostnameOrAddress(); HashinatorConfig hashinatorConfig = TheHashinator.getCurrentConfig(); ExecutionEngine eeTemp = null; Deployment deploy = m_context.cluster.getDeployment().get("deployment"); final int defaultDrBufferSize = Integer.getInteger("DR_DEFAULT_BUFFER_SIZE", 512 * 1024); // 512KB int configuredTimeout = Integer.getInteger("MAX_EXPORT_BUFFER_FLUSH_INTERVAL", 4*1000); final int exportFlushTimeout = configuredTimeout > 0 ? configuredTimeout : 4*1000; int tempTableMaxSize = deploy.getSystemsettings().get("systemsettings").getTemptablemaxsize(); if (System.getProperty("TEMP_TABLE_MAX_SIZE") != null) { // Allow a system property to override the deployment setting // for testing purposes. tempTableMaxSize = Integer.getInteger("TEMP_TABLE_MAX_SIZE"); } try { // NATIVE_EE_JNI and NATIVE_EE_LARGE_JNI if (m_backend.isDefaultJNITarget) { eeTemp = new ExecutionEngineJNI( m_context.cluster.getRelativeIndex(), m_siteId, m_partitionId, m_context.getNodeSettings().getLocalSitesCount(), CoreUtils.getHostIdFromHSId(m_siteId), hostname, m_context.cluster.getDrclusterid(), defaultDrBufferSize, tempTableMaxSize, hashinatorConfig, m_isLowestSiteId, exportFlushTimeout); } else if (m_backend == BackendTarget.NATIVE_EE_SPY_JNI){ Class<?> spyClass = Class.forName("org.mockito.Mockito"); Method spyMethod = spyClass.getDeclaredMethod("spy", Object.class); ExecutionEngine internalEE = new ExecutionEngineJNI( m_context.cluster.getRelativeIndex(), m_siteId, m_partitionId, m_context.getNodeSettings().getLocalSitesCount(), CoreUtils.getHostIdFromHSId(m_siteId), hostname, m_context.cluster.getDrclusterid(), defaultDrBufferSize, tempTableMaxSize, hashinatorConfig, m_isLowestSiteId, exportFlushTimeout); eeTemp = (ExecutionEngine) spyMethod.invoke(null, internalEE); } else if (m_backend.isIPC) { // set up the EE over IPC eeTemp = new ExecutionEngineIPC( m_context.cluster.getRelativeIndex(), m_siteId, m_partitionId, m_context.getNodeSettings().getLocalSitesCount(), CoreUtils.getHostIdFromHSId(m_siteId), hostname, m_context.cluster.getDrclusterid(), defaultDrBufferSize, tempTableMaxSize, m_backend, VoltDB.instance().getConfig().m_ipcPort, hashinatorConfig, m_isLowestSiteId, exportFlushTimeout); } else { /* This seems very bad. */ throw new VoltAbortException( String.format("Unexpected BackendTarget value %s", m_backend) ); } eeTemp.loadCatalog(m_startupConfig.m_timestamp, m_startupConfig.m_serializedCatalog); eeTemp.setBatchTimeout(m_context.cluster.getDeployment().get("deployment"). getSystemsettings().get("systemsettings").getQuerytimeout()); } // just print error info an bail if we run into an error here catch (final Exception ex) { hostLog.l7dlog( Level.FATAL, LogKeys.host_ExecutionSite_FailedConstruction.name(), new Object[] { m_siteId, m_siteIndex }, ex); VoltDB.crashLocalVoltDB(ex.getMessage(), true, ex); } return eeTemp; }
[ "ExecutionEngine", "initializeEE", "(", ")", "{", "String", "hostname", "=", "CoreUtils", ".", "getHostnameOrAddress", "(", ")", ";", "HashinatorConfig", "hashinatorConfig", "=", "TheHashinator", ".", "getCurrentConfig", "(", ")", ";", "ExecutionEngine", "eeTemp", "...
Create a native VoltDB execution engine
[ "Create", "a", "native", "VoltDB", "execution", "engine" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L727-L815
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/Site.java
Site.handleUndoLog
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
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(); } }
[ "private", "static", "void", "handleUndoLog", "(", "List", "<", "UndoAction", ">", "undoLog", ",", "boolean", "undo", ")", "{", "if", "(", "undoLog", "==", "null", ")", "{", "return", ";", "}", "if", "(", "undo", ")", "{", "undoLog", "=", "Lists", "....
Java level related stuffs that are also needed to roll back @param undoLog @param undo
[ "Java", "level", "related", "stuffs", "that", "are", "also", "needed", "to", "roll", "back" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L1167-L1185
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/Site.java
Site.updateCatalog
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_context = context; m_ee.setBatchTimeout(m_context.cluster.getDeployment().get("deployment"). getSystemsettings().get("systemsettings").getQuerytimeout()); m_loadedProcedures.loadProcedures(m_context, isReplay); m_ee.loadFunctions(m_context); if (isMPI) { // the rest of the work applies to sites with real EEs return true; } if (requireCatalogDiffCmdsApplyToEE == false) { // empty diff cmds for the EE to apply, so skip the JNI call hostLog.debug("Skipped applying diff commands on EE."); return true; } CatalogMap<Table> tables = m_context.catalog.getClusters().get("cluster").getDatabases().get("database").getTables(); boolean DRCatalogChange = false; for (Table t : tables) { if (t.getIsdred()) { DRCatalogChange |= diffCmds.contains("tables#" + t.getTypeName()); if (DRCatalogChange) { break; } } } if (!DRCatalogChange) { // Check against old catalog for deletions CatalogMap<Table> oldTables = oldContext.catalog.getClusters().get("cluster").getDatabases().get("database").getTables(); for (Table t : oldTables) { if (t.getIsdred()) { DRCatalogChange |= diffCmds.contains(CatalogSerializer.getDeleteDiffStatement(t, "tables")); if (DRCatalogChange) { break; } } } } // if a snapshot is in process, wait for it to finish // don't bother if this isn't a schema change // if (requiresSnapshotIsolationboolean && m_snapshotter.isEESnapshotting()) { hostLog.info(String.format("Site %d performing schema change operation must block until snapshot is locally complete.", CoreUtils.getSiteIdFromHSId(m_siteId))); try { m_snapshotter.completeSnapshotWork(m_sysprocContext); hostLog.info(String.format("Site %d locally finished snapshot. Will update catalog now.", CoreUtils.getSiteIdFromHSId(m_siteId))); } catch (InterruptedException e) { VoltDB.crashLocalVoltDB("Unexpected Interrupted Exception while finishing a snapshot for a catalog update.", true, e); } } //Necessary to quiesce before updating the catalog //so export data for the old generation is pushed to Java. //No need to quiesce as there is no rolling of generation OLD datasources will be polled and pushed until there is no more data. //m_ee.quiesce(m_lastCommittedSpHandle); m_ee.updateCatalog(m_context.m_genId, requiresNewExportGeneration, diffCmds); if (DRCatalogChange) { final DRCatalogCommands catalogCommands = DRCatalogDiffEngine.serializeCatalogCommandsForDr(m_context.catalog, -1); generateDREvent(EventType.CATALOG_UPDATE, txnId, uniqueId, m_lastCommittedSpHandle, spHandle, catalogCommands.commands.getBytes(Charsets.UTF_8)); } return true; }
java
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_context = context; m_ee.setBatchTimeout(m_context.cluster.getDeployment().get("deployment"). getSystemsettings().get("systemsettings").getQuerytimeout()); m_loadedProcedures.loadProcedures(m_context, isReplay); m_ee.loadFunctions(m_context); if (isMPI) { // the rest of the work applies to sites with real EEs return true; } if (requireCatalogDiffCmdsApplyToEE == false) { // empty diff cmds for the EE to apply, so skip the JNI call hostLog.debug("Skipped applying diff commands on EE."); return true; } CatalogMap<Table> tables = m_context.catalog.getClusters().get("cluster").getDatabases().get("database").getTables(); boolean DRCatalogChange = false; for (Table t : tables) { if (t.getIsdred()) { DRCatalogChange |= diffCmds.contains("tables#" + t.getTypeName()); if (DRCatalogChange) { break; } } } if (!DRCatalogChange) { // Check against old catalog for deletions CatalogMap<Table> oldTables = oldContext.catalog.getClusters().get("cluster").getDatabases().get("database").getTables(); for (Table t : oldTables) { if (t.getIsdred()) { DRCatalogChange |= diffCmds.contains(CatalogSerializer.getDeleteDiffStatement(t, "tables")); if (DRCatalogChange) { break; } } } } // if a snapshot is in process, wait for it to finish // don't bother if this isn't a schema change // if (requiresSnapshotIsolationboolean && m_snapshotter.isEESnapshotting()) { hostLog.info(String.format("Site %d performing schema change operation must block until snapshot is locally complete.", CoreUtils.getSiteIdFromHSId(m_siteId))); try { m_snapshotter.completeSnapshotWork(m_sysprocContext); hostLog.info(String.format("Site %d locally finished snapshot. Will update catalog now.", CoreUtils.getSiteIdFromHSId(m_siteId))); } catch (InterruptedException e) { VoltDB.crashLocalVoltDB("Unexpected Interrupted Exception while finishing a snapshot for a catalog update.", true, e); } } //Necessary to quiesce before updating the catalog //so export data for the old generation is pushed to Java. //No need to quiesce as there is no rolling of generation OLD datasources will be polled and pushed until there is no more data. //m_ee.quiesce(m_lastCommittedSpHandle); m_ee.updateCatalog(m_context.m_genId, requiresNewExportGeneration, diffCmds); if (DRCatalogChange) { final DRCatalogCommands catalogCommands = DRCatalogDiffEngine.serializeCatalogCommandsForDr(m_context.catalog, -1); generateDREvent(EventType.CATALOG_UPDATE, txnId, uniqueId, m_lastCommittedSpHandle, spHandle, catalogCommands.commands.getBytes(Charsets.UTF_8)); } return true; }
[ "public", "boolean", "updateCatalog", "(", "String", "diffCmds", ",", "CatalogContext", "context", ",", "boolean", "requiresSnapshotIsolationboolean", ",", "boolean", "isMPI", ",", "long", "txnId", ",", "long", "uniqueId", ",", "long", "spHandle", ",", "boolean", ...
Update the catalog. If we're the MPI, don't bother with the EE.
[ "Update", "the", "catalog", ".", "If", "we", "re", "the", "MPI", "don", "t", "bother", "with", "the", "EE", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L1603-L1684
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/Site.java
Site.updateSettings
public boolean updateSettings(CatalogContext context) { m_context = context; // here you could bring the timeout settings m_loadedProcedures.loadProcedures(m_context); m_ee.loadFunctions(m_context); return true; }
java
public boolean updateSettings(CatalogContext context) { m_context = context; // here you could bring the timeout settings m_loadedProcedures.loadProcedures(m_context); m_ee.loadFunctions(m_context); return true; }
[ "public", "boolean", "updateSettings", "(", "CatalogContext", "context", ")", "{", "m_context", "=", "context", ";", "// here you could bring the timeout settings", "m_loadedProcedures", ".", "loadProcedures", "(", "m_context", ")", ";", "m_ee", ".", "loadFunctions", "(...
Update the system settings @param context catalog context @return true if it succeeds
[ "Update", "the", "system", "settings" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L1691-L1697
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/Site.java
Site.validatePartitioning
@Override 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(tableId); } paramBuffer.put(hashinatorConfig); ByteBuffer resultBuffer = ByteBuffer.wrap(m_ee.executeTask( TaskType.VALIDATE_PARTITIONING, paramBuffer)); long mispartitionedRows[] = new long[tableIds.length]; for (int ii = 0; ii < tableIds.length; ii++) { mispartitionedRows[ii] = resultBuffer.getLong(); } return mispartitionedRows; }
java
@Override 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(tableId); } paramBuffer.put(hashinatorConfig); ByteBuffer resultBuffer = ByteBuffer.wrap(m_ee.executeTask( TaskType.VALIDATE_PARTITIONING, paramBuffer)); long mispartitionedRows[] = new long[tableIds.length]; for (int ii = 0; ii < tableIds.length; ii++) { mispartitionedRows[ii] = resultBuffer.getLong(); } return mispartitionedRows; }
[ "@", "Override", "public", "long", "[", "]", "validatePartitioning", "(", "long", "[", "]", "tableIds", ",", "byte", "[", "]", "hashinatorConfig", ")", "{", "ByteBuffer", "paramBuffer", "=", "m_ee", ".", "getParamBufferForExecuteTask", "(", "4", "+", "(", "8...
For the specified list of table ids, return the number of mispartitioned rows using the provided hashinator config
[ "For", "the", "specified", "list", "of", "table", "ids", "return", "the", "number", "of", "mispartitioned", "rows", "using", "the", "provided", "hashinator", "config" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L1753-L1768
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/Site.java
Site.generateDREvent
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()); paramBuffer.putLong(uniqueId); paramBuffer.putLong(lastCommittedSpHandle); paramBuffer.putLong(spHandle); // adding txnId and undoToken to make generateDREvent undoable paramBuffer.putLong(txnId); paramBuffer.putLong(getNextUndoToken(m_currentTxnId)); paramBuffer.putInt(payloads.length); paramBuffer.put(payloads); m_ee.executeTask(TaskType.GENERATE_DR_EVENT, paramBuffer); }
java
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()); paramBuffer.putLong(uniqueId); paramBuffer.putLong(lastCommittedSpHandle); paramBuffer.putLong(spHandle); // adding txnId and undoToken to make generateDREvent undoable paramBuffer.putLong(txnId); paramBuffer.putLong(getNextUndoToken(m_currentTxnId)); paramBuffer.putInt(payloads.length); paramBuffer.put(payloads); m_ee.executeTask(TaskType.GENERATE_DR_EVENT, paramBuffer); }
[ "public", "void", "generateDREvent", "(", "EventType", "type", ",", "long", "txnId", ",", "long", "uniqueId", ",", "long", "lastCommittedSpHandle", ",", "long", "spHandle", ",", "byte", "[", "]", "payloads", ")", "{", "m_ee", ".", "quiesce", "(", "lastCommit...
Generate a in-stream DR event which pushes an event buffer to topend
[ "Generate", "a", "in", "-", "stream", "DR", "event", "which", "pushes", "an", "event", "buffer", "to", "topend" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L1864-L1878
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/MpPromoteAlgo.java
MpPromoteAlgo.areRepairLogsComplete
public boolean areRepairLogsComplete() { for (Entry<Long, ReplicaRepairStruct> entry : m_replicaRepairStructs.entrySet()) { if (!entry.getValue().logsComplete()) { return false; } } return true; }
java
public boolean areRepairLogsComplete() { for (Entry<Long, ReplicaRepairStruct> entry : m_replicaRepairStructs.entrySet()) { if (!entry.getValue().logsComplete()) { return false; } } return true; }
[ "public", "boolean", "areRepairLogsComplete", "(", ")", "{", "for", "(", "Entry", "<", "Long", ",", "ReplicaRepairStruct", ">", "entry", ":", "m_replicaRepairStructs", ".", "entrySet", "(", ")", ")", "{", "if", "(", "!", "entry", ".", "getValue", "(", ")",...
Have all survivors supplied a full repair log?
[ "Have", "all", "survivors", "supplied", "a", "full", "repair", "log?" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpPromoteAlgo.java#L242-L250
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/MpPromoteAlgo.java
MpPromoteAlgo.repairSurvivors
public void repairSurvivors() { // cancel() and repair() must be synchronized by the caller (the deliver lock, // currently). If cancelled and the last repair message arrives, don't send // out corrections! 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 replicas."); } for (Iv2RepairLogResponseMessage li : m_repairLogUnion) { // send the repair log union to all the survivors. SPIs will ignore // CompleteTransactionMessages for transactions which have already // completed, so this has the effect of making sure that any holes // in the repair log are filled without explicitly having to // discover and track them. VoltMessage repairMsg = createRepairMessage(li); if (repairLogger.isDebugEnabled()) { repairLogger.debug(m_whoami + "repairing: " + CoreUtils.hsIdCollectionToString(m_survivors) + " with: " + TxnEgo.txnIdToString(li.getTxnId()) + " " + repairMsg); } if (repairMsg != null) { m_mailbox.repairReplicasWith(m_survivors, repairMsg); } } m_promotionResult.set(new RepairResult(m_maxSeenTxnId)); }
java
public void repairSurvivors() { // cancel() and repair() must be synchronized by the caller (the deliver lock, // currently). If cancelled and the last repair message arrives, don't send // out corrections! 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 replicas."); } for (Iv2RepairLogResponseMessage li : m_repairLogUnion) { // send the repair log union to all the survivors. SPIs will ignore // CompleteTransactionMessages for transactions which have already // completed, so this has the effect of making sure that any holes // in the repair log are filled without explicitly having to // discover and track them. VoltMessage repairMsg = createRepairMessage(li); if (repairLogger.isDebugEnabled()) { repairLogger.debug(m_whoami + "repairing: " + CoreUtils.hsIdCollectionToString(m_survivors) + " with: " + TxnEgo.txnIdToString(li.getTxnId()) + " " + repairMsg); } if (repairMsg != null) { m_mailbox.repairReplicasWith(m_survivors, repairMsg); } } m_promotionResult.set(new RepairResult(m_maxSeenTxnId)); }
[ "public", "void", "repairSurvivors", "(", ")", "{", "// cancel() and repair() must be synchronized by the caller (the deliver lock,", "// currently). If cancelled and the last repair message arrives, don't send", "// out corrections!", "if", "(", "this", ".", "m_promotionResult", ".", ...
Send missed-messages to survivors. Exciting!
[ "Send", "missed", "-", "messages", "to", "survivors", ".", "Exciting!" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpPromoteAlgo.java#L259-L289
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/MpPromoteAlgo.java
MpPromoteAlgo.addToRepairLog
void addToRepairLog(Iv2RepairLogResponseMessage msg) { // don't add the null payload from the first message ack to the repair log if (msg.getPayload() == null) { return; } // MP repair log has at most two messages, complete message for prior transaction // and fragment message for current transaction, don't add message before prior completion if (msg.getTxnId() <= m_maxSeenCompleteTxnId) { return; } Iv2RepairLogResponseMessage prev = m_repairLogUnion.floor(msg); if (prev != null && (prev.getTxnId() != msg.getTxnId())) { prev = null; } if (msg.getPayload() instanceof CompleteTransactionMessage) { // prefer complete messages to fragment tasks. Completion message also erases prior staled messages m_repairLogUnion.removeIf((p) -> p.getTxnId() <= msg.getTxnId()); m_repairLogUnion.add(msg); m_maxSeenCompleteTxnId = msg.getTxnId(); } else if (prev == null) { m_repairLogUnion.add(msg); } }
java
void addToRepairLog(Iv2RepairLogResponseMessage msg) { // don't add the null payload from the first message ack to the repair log if (msg.getPayload() == null) { return; } // MP repair log has at most two messages, complete message for prior transaction // and fragment message for current transaction, don't add message before prior completion if (msg.getTxnId() <= m_maxSeenCompleteTxnId) { return; } Iv2RepairLogResponseMessage prev = m_repairLogUnion.floor(msg); if (prev != null && (prev.getTxnId() != msg.getTxnId())) { prev = null; } if (msg.getPayload() instanceof CompleteTransactionMessage) { // prefer complete messages to fragment tasks. Completion message also erases prior staled messages m_repairLogUnion.removeIf((p) -> p.getTxnId() <= msg.getTxnId()); m_repairLogUnion.add(msg); m_maxSeenCompleteTxnId = msg.getTxnId(); } else if (prev == null) { m_repairLogUnion.add(msg); } }
[ "void", "addToRepairLog", "(", "Iv2RepairLogResponseMessage", "msg", ")", "{", "// don't add the null payload from the first message ack to the repair log", "if", "(", "msg", ".", "getPayload", "(", ")", "==", "null", ")", "{", "return", ";", "}", "// MP repair log has at...
replace old messages with complete transaction messages.
[ "replace", "old", "messages", "with", "complete", "transaction", "messages", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpPromoteAlgo.java#L303-L328
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltCompilerFileReader.java
VoltCompilerFileReader.getSchemaPath
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(path); } if (!file.isAbsolute()) { // Resolve schemaPath relative to either the database definition xml file // or the working directory. if (projectFilePath != null) { file = new File(new File(projectFilePath).getParent(), path); } else { file = new File(path); } } return file.getPath(); }
java
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(path); } if (!file.isAbsolute()) { // Resolve schemaPath relative to either the database definition xml file // or the working directory. if (projectFilePath != null) { file = new File(new File(projectFilePath).getParent(), path); } else { file = new File(path); } } return file.getPath(); }
[ "static", "String", "getSchemaPath", "(", "String", "projectFilePath", ",", "String", "path", ")", "throws", "IOException", "{", "File", "file", "=", "null", ";", "if", "(", "path", ".", "contains", "(", "\".jar!\"", ")", ")", "{", "String", "ddlText", "="...
Get the path of a schema file, optionally relative to a project.xml file's path.
[ "Get", "the", "path", "of", "a", "schema", "file", "optionally", "relative", "to", "a", "project", ".", "xml", "file", "s", "path", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompilerFileReader.java#L91-L116
train
VoltDB/voltdb
src/frontend/org/voltdb/UserDefinedFunctionManager.java
UserDefinedFunctionManager.loadFunctions
public void loadFunctions(CatalogContext catalogContext) { final CatalogMap<Function> catalogFunctions = catalogContext.database.getFunctions(); // Remove obsolete tokens for (UserDefinedFunctionRunner runner : m_udfs.values()) { // The function that the current UserDefinedFunctionRunner is referring to // does not exist in the catalog anymore, we need to remove its token. if (catalogFunctions.get(runner.m_functionName) == null) { FunctionForVoltDB.deregisterUserDefinedFunction(runner.m_functionName); } } // Build new UDF runners ImmutableMap.Builder<Integer, UserDefinedFunctionRunner> builder = ImmutableMap.<Integer, UserDefinedFunctionRunner>builder(); for (final Function catalogFunction : catalogFunctions) { final String className = catalogFunction.getClassname(); Class<?> funcClass = null; try { funcClass = catalogContext.classForProcedureOrUDF(className); } catch (final ClassNotFoundException e) { if (className.startsWith("org.voltdb.")) { String msg = String.format(ORGVOLTDB_FUNCCNAME_ERROR_FMT, className); VoltDB.crashLocalVoltDB(msg, false, null); } else { String msg = String.format(UNABLETOLOAD_ERROR_FMT, className); VoltDB.crashLocalVoltDB(msg, false, null); } } Object funcInstance = null; try { funcInstance = funcClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(String.format("Error instantiating function \"%s\"", className), e); } assert(funcInstance != null); builder.put(catalogFunction.getFunctionid(), new UserDefinedFunctionRunner(catalogFunction, funcInstance)); } loadBuiltInJavaFunctions(builder); m_udfs = builder.build(); }
java
public void loadFunctions(CatalogContext catalogContext) { final CatalogMap<Function> catalogFunctions = catalogContext.database.getFunctions(); // Remove obsolete tokens for (UserDefinedFunctionRunner runner : m_udfs.values()) { // The function that the current UserDefinedFunctionRunner is referring to // does not exist in the catalog anymore, we need to remove its token. if (catalogFunctions.get(runner.m_functionName) == null) { FunctionForVoltDB.deregisterUserDefinedFunction(runner.m_functionName); } } // Build new UDF runners ImmutableMap.Builder<Integer, UserDefinedFunctionRunner> builder = ImmutableMap.<Integer, UserDefinedFunctionRunner>builder(); for (final Function catalogFunction : catalogFunctions) { final String className = catalogFunction.getClassname(); Class<?> funcClass = null; try { funcClass = catalogContext.classForProcedureOrUDF(className); } catch (final ClassNotFoundException e) { if (className.startsWith("org.voltdb.")) { String msg = String.format(ORGVOLTDB_FUNCCNAME_ERROR_FMT, className); VoltDB.crashLocalVoltDB(msg, false, null); } else { String msg = String.format(UNABLETOLOAD_ERROR_FMT, className); VoltDB.crashLocalVoltDB(msg, false, null); } } Object funcInstance = null; try { funcInstance = funcClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(String.format("Error instantiating function \"%s\"", className), e); } assert(funcInstance != null); builder.put(catalogFunction.getFunctionid(), new UserDefinedFunctionRunner(catalogFunction, funcInstance)); } loadBuiltInJavaFunctions(builder); m_udfs = builder.build(); }
[ "public", "void", "loadFunctions", "(", "CatalogContext", "catalogContext", ")", "{", "final", "CatalogMap", "<", "Function", ">", "catalogFunctions", "=", "catalogContext", ".", "database", ".", "getFunctions", "(", ")", ";", "// Remove obsolete tokens", "for", "("...
Load all the UDFs recorded in the catalog. Instantiate and register them in the system.
[ "Load", "all", "the", "UDFs", "recorded", "in", "the", "catalog", ".", "Instantiate", "and", "register", "them", "in", "the", "system", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/UserDefinedFunctionManager.java#L63-L105
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/util/DatabaseManagerCommon.java
DatabaseManagerCommon.readFile
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'); } read.close(); reader.close(); return b.toString(); } catch (IOException e) { return e.getMessage(); } }
java
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'); } read.close(); reader.close(); return b.toString(); } catch (IOException e) { return e.getMessage(); } }
[ "static", "String", "readFile", "(", "String", "file", ")", "{", "try", "{", "FileReader", "reader", "=", "new", "FileReader", "(", "file", ")", ";", "BufferedReader", "read", "=", "new", "BufferedReader", "(", "reader", ")", ";", "StringBuffer", "b", "=",...
Redid this file to remove sizing requirements and to make it faster Speeded it up 10 fold. @param file
[ "Redid", "this", "file", "to", "remove", "sizing", "requirements", "and", "to", "make", "it", "faster", "Speeded", "it", "up", "10", "fold", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/util/DatabaseManagerCommon.java#L305-L328
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/Driver.java
Driver.getServersFromURL
static String[] getServersFromURL(String url) { // get everything between the prefix and the ? 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(","); }
java
static String[] getServersFromURL(String url) { // get everything between the prefix and the ? 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", "String", "[", "]", "getServersFromURL", "(", "String", "url", ")", "{", "// get everything between the prefix and the ?", "String", "prefix", "=", "URL_PREFIX", "+", "\"//\"", ";", "int", "end", "=", "url", ".", "length", "(", ")", ";", "if", "(", ...
Static so it's unit-testable, yes, lazy me
[ "Static", "so", "it", "s", "unit", "-", "testable", "yes", "lazy", "me" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/Driver.java#L54-L63
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.initializeGenerationFromDisk
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 = CatalogUtil.getExportTablesExcludeViewOnly(connectors); Set<String> exportedTables = new HashSet<>(); for (Table stream : streams) { exportedTables.add(stream.getTypeName()); } /* * Find all the data files. Once one is found, extract the nonce * and check for any advertisements related to the data files. If * there are orphaned advertisements, delete them. */ Map<String, File> dataFiles = new HashMap<>(); for (File data: files) { if (data.getName().endsWith(".pbd")) { PbdSegmentName pbdName = PbdSegmentName.parseFile(exportLog, data); if (pbdName.m_nonce != null) { String nonce = pbdName.m_nonce; String streamName = getStreamNameFromNonce(nonce); if (exportedTables.contains(streamName)) { dataFiles.put(nonce, data); } else { // ENG-15740, stream can be dropped while node is offline, delete .pbd files // if stream is no longer in catalog data.delete(); } } else if (pbdName.m_result == Result.NOT_PBD) { exportLog.warn(data.getAbsolutePath() + " is not a PBD file."); } else if (pbdName.m_result == Result.INVALID_NAME) { exportLog.warn(data.getAbsolutePath() + " doesn't have valid PBD name."); } } } for (File ad: files) { if (ad.getName().endsWith(".ad")) { String nonce = getNonceFromAdFile(ad); File dataFile = dataFiles.get(nonce); if (dataFile != null) { try { addDataSource(ad, localPartitionsToSites, onDiskPartitions, processor, genId); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error intializing export datasource " + ad, true, e); } } else { //Delete ads that have no data ad.delete(); } } } // Count unique partitions only Set<Integer> allLocalPartitions = localPartitionsToSites.stream() .map(p -> p.getFirst()) .collect(Collectors.toSet()); Set<Integer> onDIskPartitionsSet = new HashSet<Integer>(onDiskPartitions); onDIskPartitionsSet.removeAll(allLocalPartitions); // One export mailbox per node, since we only keep one generation if (!onDIskPartitionsSet.isEmpty()) { createAckMailboxesIfNeeded(onDIskPartitionsSet); } }
java
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 = CatalogUtil.getExportTablesExcludeViewOnly(connectors); Set<String> exportedTables = new HashSet<>(); for (Table stream : streams) { exportedTables.add(stream.getTypeName()); } /* * Find all the data files. Once one is found, extract the nonce * and check for any advertisements related to the data files. If * there are orphaned advertisements, delete them. */ Map<String, File> dataFiles = new HashMap<>(); for (File data: files) { if (data.getName().endsWith(".pbd")) { PbdSegmentName pbdName = PbdSegmentName.parseFile(exportLog, data); if (pbdName.m_nonce != null) { String nonce = pbdName.m_nonce; String streamName = getStreamNameFromNonce(nonce); if (exportedTables.contains(streamName)) { dataFiles.put(nonce, data); } else { // ENG-15740, stream can be dropped while node is offline, delete .pbd files // if stream is no longer in catalog data.delete(); } } else if (pbdName.m_result == Result.NOT_PBD) { exportLog.warn(data.getAbsolutePath() + " is not a PBD file."); } else if (pbdName.m_result == Result.INVALID_NAME) { exportLog.warn(data.getAbsolutePath() + " doesn't have valid PBD name."); } } } for (File ad: files) { if (ad.getName().endsWith(".ad")) { String nonce = getNonceFromAdFile(ad); File dataFile = dataFiles.get(nonce); if (dataFile != null) { try { addDataSource(ad, localPartitionsToSites, onDiskPartitions, processor, genId); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error intializing export datasource " + ad, true, e); } } else { //Delete ads that have no data ad.delete(); } } } // Count unique partitions only Set<Integer> allLocalPartitions = localPartitionsToSites.stream() .map(p -> p.getFirst()) .collect(Collectors.toSet()); Set<Integer> onDIskPartitionsSet = new HashSet<Integer>(onDiskPartitions); onDIskPartitionsSet.removeAll(allLocalPartitions); // One export mailbox per node, since we only keep one generation if (!onDIskPartitionsSet.isEmpty()) { createAckMailboxesIfNeeded(onDIskPartitionsSet); } }
[ "private", "void", "initializeGenerationFromDisk", "(", "final", "CatalogMap", "<", "Connector", ">", "connectors", ",", "final", "ExportDataProcessor", "processor", ",", "File", "[", "]", "files", ",", "List", "<", "Pair", "<", "Integer", ",", "Integer", ">", ...
Initialize generation from disk, creating data sources from the PBD files. Called immediately before calling {@code initializeGenerationFromCatalog}. @param connectors @param messenger @param processor new {@code ExportDataProcessor}, with decoders not started yet @param files the contents of the export overflow directory @param localPartitionsToSites
[ "Initialize", "generation", "from", "disk", "creating", "data", "sources", "from", "the", "PBD", "files", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L159-L224
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.initializeGenerationFromCatalog
void initializeGenerationFromCatalog(CatalogContext catalogContext, final CatalogMap<Connector> connectors, final ExportDataProcessor processor, int hostId, List<Pair<Integer, Integer>> localPartitionsToSites, boolean isCatalogUpdate) { // Update catalog version so that datasources use this version when propagating acks m_catalogVersion = catalogContext.catalogVersion; if (exportLog.isDebugEnabled()) { exportLog.debug("Updating to catalog version : " + m_catalogVersion); } // Collect table names of existing datasources Set<String> currentTables = new HashSet<>(); synchronized(m_dataSourcesByPartition) { for (Iterator<Map<String, ExportDataSource>> it = m_dataSourcesByPartition.values().iterator(); it.hasNext();) { Map<String, ExportDataSource> sources = it.next(); currentTables.addAll(sources.keySet()); } } if (exportLog.isDebugEnabled()) { exportLog.debug("Current tables: " + currentTables); } // Now create datasources based on the catalog (if already present will not be re-created). // Note that we create sources on disabled connectors. Set<Integer> partitionsInUse = localPartitionsToSites.stream().map(p -> p.getFirst()).collect(Collectors.toSet()); boolean createdSources = false; NavigableSet<Table> streams = CatalogUtil.getExportTablesExcludeViewOnly(connectors); Set<String> exportedTables = new HashSet<>(); for (Table stream : streams) { addDataSources(stream, hostId, localPartitionsToSites, partitionsInUse, processor, catalogContext.m_genId, isCatalogUpdate); exportedTables.add(stream.getTypeName()); createdSources = true; } updateStreamStatus(exportedTables); // Remove datasources that are not exported anymore for (String table : exportedTables) { currentTables.remove(table); } if (!currentTables.isEmpty()) { removeDataSources(currentTables); } //Only populate partitions in use if export is actually happening createAckMailboxesIfNeeded(createdSources ? partitionsInUse : new HashSet<Integer>()); }
java
void initializeGenerationFromCatalog(CatalogContext catalogContext, final CatalogMap<Connector> connectors, final ExportDataProcessor processor, int hostId, List<Pair<Integer, Integer>> localPartitionsToSites, boolean isCatalogUpdate) { // Update catalog version so that datasources use this version when propagating acks m_catalogVersion = catalogContext.catalogVersion; if (exportLog.isDebugEnabled()) { exportLog.debug("Updating to catalog version : " + m_catalogVersion); } // Collect table names of existing datasources Set<String> currentTables = new HashSet<>(); synchronized(m_dataSourcesByPartition) { for (Iterator<Map<String, ExportDataSource>> it = m_dataSourcesByPartition.values().iterator(); it.hasNext();) { Map<String, ExportDataSource> sources = it.next(); currentTables.addAll(sources.keySet()); } } if (exportLog.isDebugEnabled()) { exportLog.debug("Current tables: " + currentTables); } // Now create datasources based on the catalog (if already present will not be re-created). // Note that we create sources on disabled connectors. Set<Integer> partitionsInUse = localPartitionsToSites.stream().map(p -> p.getFirst()).collect(Collectors.toSet()); boolean createdSources = false; NavigableSet<Table> streams = CatalogUtil.getExportTablesExcludeViewOnly(connectors); Set<String> exportedTables = new HashSet<>(); for (Table stream : streams) { addDataSources(stream, hostId, localPartitionsToSites, partitionsInUse, processor, catalogContext.m_genId, isCatalogUpdate); exportedTables.add(stream.getTypeName()); createdSources = true; } updateStreamStatus(exportedTables); // Remove datasources that are not exported anymore for (String table : exportedTables) { currentTables.remove(table); } if (!currentTables.isEmpty()) { removeDataSources(currentTables); } //Only populate partitions in use if export is actually happening createAckMailboxesIfNeeded(createdSources ? partitionsInUse : new HashSet<Integer>()); }
[ "void", "initializeGenerationFromCatalog", "(", "CatalogContext", "catalogContext", ",", "final", "CatalogMap", "<", "Connector", ">", "connectors", ",", "final", "ExportDataProcessor", "processor", ",", "int", "hostId", ",", "List", "<", "Pair", "<", "Integer", ","...
Initialize generation from catalog. Notes on catalog update: - If present, the old {@code ExportDataProcessor} has been shut down. - the new {@code ExportDataProcessor} has not started its decoders. @param catalogContext @param connectors @param processor @param hostId @param messenger @param localPartitionsToSites
[ "Initialize", "generation", "from", "catalog", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L240-L293
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.updateStreamStatus
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 tableName: sources.keySet()) { ExportDataSource src = sources.get(tableName); if (!exportedTables.contains(tableName)) { src.setStatus(ExportDataSource.StreamStatus.DROPPED); } else if (src.getStatus() == ExportDataSource.StreamStatus.DROPPED) { src.setStatus(ExportDataSource.StreamStatus.ACTIVE); } } } } }
java
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 tableName: sources.keySet()) { ExportDataSource src = sources.get(tableName); if (!exportedTables.contains(tableName)) { src.setStatus(ExportDataSource.StreamStatus.DROPPED); } else if (src.getStatus() == ExportDataSource.StreamStatus.DROPPED) { src.setStatus(ExportDataSource.StreamStatus.ACTIVE); } } } } }
[ "private", "void", "updateStreamStatus", "(", "Set", "<", "String", ">", "exportedTables", ")", "{", "synchronized", "(", "m_dataSourcesByPartition", ")", "{", "for", "(", "Iterator", "<", "Map", "<", "String", ",", "ExportDataSource", ">", ">", "it", "=", "...
Mark a DataSource as dropped if its not present in the connectors.
[ "Mark", "a", "DataSource", "as", "dropped", "if", "its", "not", "present", "in", "the", "connectors", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L296-L310
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.sendDummyTakeMastershipResponse
private void sendDummyTakeMastershipResponse(long sourceHsid, long requestId, int partitionId, byte[] signatureBytes) { // msg type(1) + partition:int(4) + length:int(4) + signaturesBytes.length // requestId(8) int msgLen = 1 + 4 + 4 + signatureBytes.length + 8; ByteBuffer buf = ByteBuffer.allocate(msgLen); buf.put(ExportManager.TAKE_MASTERSHIP_RESPONSE); buf.putInt(partitionId); buf.putInt(signatureBytes.length); buf.put(signatureBytes); buf.putLong(requestId); BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array()); m_mbox.send(sourceHsid, bpm); if (exportLog.isDebugEnabled()) { exportLog.debug("Partition " + partitionId + " mailbox hsid (" + CoreUtils.hsIdToString(m_mbox.getHSId()) + ") send dummy TAKE_MASTERSHIP_RESPONSE message(" + requestId + ") to " + CoreUtils.hsIdToString(sourceHsid)); } }
java
private void sendDummyTakeMastershipResponse(long sourceHsid, long requestId, int partitionId, byte[] signatureBytes) { // msg type(1) + partition:int(4) + length:int(4) + signaturesBytes.length // requestId(8) int msgLen = 1 + 4 + 4 + signatureBytes.length + 8; ByteBuffer buf = ByteBuffer.allocate(msgLen); buf.put(ExportManager.TAKE_MASTERSHIP_RESPONSE); buf.putInt(partitionId); buf.putInt(signatureBytes.length); buf.put(signatureBytes); buf.putLong(requestId); BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array()); m_mbox.send(sourceHsid, bpm); if (exportLog.isDebugEnabled()) { exportLog.debug("Partition " + partitionId + " mailbox hsid (" + CoreUtils.hsIdToString(m_mbox.getHSId()) + ") send dummy TAKE_MASTERSHIP_RESPONSE message(" + requestId + ") to " + CoreUtils.hsIdToString(sourceHsid)); } }
[ "private", "void", "sendDummyTakeMastershipResponse", "(", "long", "sourceHsid", ",", "long", "requestId", ",", "int", "partitionId", ",", "byte", "[", "]", "signatureBytes", ")", "{", "// msg type(1) + partition:int(4) + length:int(4) + signaturesBytes.length", "// requestId...
Auto reply a response when the requested stream is no longer exists
[ "Auto", "reply", "a", "response", "when", "the", "requested", "stream", "is", "no", "longer", "exists" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L447-L465
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.updateAckMailboxes
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) { return; } for( ExportDataSource eds: partitionMap.values()) { eds.updateAckMailboxes(Pair.of(m_mbox, replicaHSIds)); if (newHSIds != null && !newHSIds.isEmpty()) { // In case of newly joined or rejoined streams miss any RELEASE_BUFFER event, // master stream resends the event when the export mailbox is aware of new streams. eds.forwardAckToNewJoinedReplicas(newHSIds); // After rejoin, new data source may contain the data which current master doesn't have, // only on master stream if it is blocked by the gap eds.queryForBestCandidate(); } } } }
java
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) { return; } for( ExportDataSource eds: partitionMap.values()) { eds.updateAckMailboxes(Pair.of(m_mbox, replicaHSIds)); if (newHSIds != null && !newHSIds.isEmpty()) { // In case of newly joined or rejoined streams miss any RELEASE_BUFFER event, // master stream resends the event when the export mailbox is aware of new streams. eds.forwardAckToNewJoinedReplicas(newHSIds); // After rejoin, new data source may contain the data which current master doesn't have, // only on master stream if it is blocked by the gap eds.queryForBestCandidate(); } } } }
[ "public", "void", "updateAckMailboxes", "(", "int", "partition", ",", "Set", "<", "Long", ">", "newHSIds", ")", "{", "ImmutableList", "<", "Long", ">", "replicaHSIds", "=", "m_replicasHSIds", ".", "get", "(", "partition", ")", ";", "synchronized", "(", "m_da...
Access by multiple threads
[ "Access", "by", "multiple", "threads" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L468-L487
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.addDataSources
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) { /* * IOException can occur if there is a problem * with the persistent aspects of the datasource storage */ int partition = partitionAndSiteId.getFirst(); int siteId = partitionAndSiteId.getSecond(); synchronized(m_dataSourcesByPartition) { try { Map<String, ExportDataSource> dataSourcesForPartition = m_dataSourcesByPartition.get(partition); if (dataSourcesForPartition == null) { dataSourcesForPartition = new HashMap<String, ExportDataSource>(); m_dataSourcesByPartition.put(partition, dataSourcesForPartition); } final String key = table.getTypeName(); if (!dataSourcesForPartition.containsKey(key)) { ExportDataSource exportDataSource = new ExportDataSource(this, processor, "database", key, partition, siteId, genId, table.getColumns(), table.getPartitioncolumn(), m_directory.getPath()); int migrateBatchSize = CatalogUtil.getPersistentMigrateBatchSize(key); exportDataSource.setupMigrateRowsDeleter(migrateBatchSize); if (exportLog.isDebugEnabled()) { exportLog.debug("Creating ExportDataSource for table in catalog " + key + " partition " + partition + " site " + siteId); } dataSourcesForPartition.put(key, exportDataSource); if (isCatalogUpdate) { exportDataSource.updateCatalog(table, genId); } } else { // Associate any existing EDS to the export client in the new processor ExportDataSource eds = dataSourcesForPartition.get(key); ExportClientBase client = processor.getExportClient(key); if (client != null) { // Associate to an existing export client eds.setClient(client); eds.setRunEveryWhere(client.isRunEverywhere()); } else { // Reset to no export client eds.setClient(null); eds.setRunEveryWhere(false); } // Mark in catalog only if partition is in use eds.markInCatalog(partitionsInUse.contains(partition)); if (isCatalogUpdate) { eds.updateCatalog(table, genId); } } } catch (IOException e) { VoltDB.crashLocalVoltDB( "Error creating datasources for table " + table.getTypeName() + " host id " + hostId, true, e); } } } }
java
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) { /* * IOException can occur if there is a problem * with the persistent aspects of the datasource storage */ int partition = partitionAndSiteId.getFirst(); int siteId = partitionAndSiteId.getSecond(); synchronized(m_dataSourcesByPartition) { try { Map<String, ExportDataSource> dataSourcesForPartition = m_dataSourcesByPartition.get(partition); if (dataSourcesForPartition == null) { dataSourcesForPartition = new HashMap<String, ExportDataSource>(); m_dataSourcesByPartition.put(partition, dataSourcesForPartition); } final String key = table.getTypeName(); if (!dataSourcesForPartition.containsKey(key)) { ExportDataSource exportDataSource = new ExportDataSource(this, processor, "database", key, partition, siteId, genId, table.getColumns(), table.getPartitioncolumn(), m_directory.getPath()); int migrateBatchSize = CatalogUtil.getPersistentMigrateBatchSize(key); exportDataSource.setupMigrateRowsDeleter(migrateBatchSize); if (exportLog.isDebugEnabled()) { exportLog.debug("Creating ExportDataSource for table in catalog " + key + " partition " + partition + " site " + siteId); } dataSourcesForPartition.put(key, exportDataSource); if (isCatalogUpdate) { exportDataSource.updateCatalog(table, genId); } } else { // Associate any existing EDS to the export client in the new processor ExportDataSource eds = dataSourcesForPartition.get(key); ExportClientBase client = processor.getExportClient(key); if (client != null) { // Associate to an existing export client eds.setClient(client); eds.setRunEveryWhere(client.isRunEverywhere()); } else { // Reset to no export client eds.setClient(null); eds.setRunEveryWhere(false); } // Mark in catalog only if partition is in use eds.markInCatalog(partitionsInUse.contains(partition)); if (isCatalogUpdate) { eds.updateCatalog(table, genId); } } } catch (IOException e) { VoltDB.crashLocalVoltDB( "Error creating datasources for table " + table.getTypeName() + " host id " + hostId, true, e); } } } }
[ "private", "void", "addDataSources", "(", "Table", "table", ",", "int", "hostId", ",", "List", "<", "Pair", "<", "Integer", ",", "Integer", ">", ">", "localPartitionsToSites", ",", "Set", "<", "Integer", ">", "partitionsInUse", ",", "final", "ExportDataProcess...
Add datasources for a catalog table in all partitions @param table @param hostId @param localPartitionsToSites @param partitionsInUse @param processor
[ "Add", "datasources", "for", "a", "catalog", "table", "in", "all", "partitions" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L727-L799
train
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportGeneration.java
ExportGeneration.onSourceDrained
@Override 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)) { exportLog.error("Could not find export data sources for partition " + partitionId + ". The export cleanup stream is being discarded."); } return; } source = sources.get(tableName); if (source == null) { exportLog.warn("Could not find export data source for signature " + partitionId + " name " + tableName + ". The export cleanup stream is being discarded."); return; } // Remove source and partition entry if empty sources.remove(tableName); if (sources.isEmpty()) { m_dataSourcesByPartition.remove(partitionId); removeMailbox(partitionId); } } //Do closing outside the synchronized block. Do not wait on future since // we're invoked from the source's executor thread. exportLog.info("Drained on unused partition " + partitionId + ": " + source); source.closeAndDelete(); }
java
@Override 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)) { exportLog.error("Could not find export data sources for partition " + partitionId + ". The export cleanup stream is being discarded."); } return; } source = sources.get(tableName); if (source == null) { exportLog.warn("Could not find export data source for signature " + partitionId + " name " + tableName + ". The export cleanup stream is being discarded."); return; } // Remove source and partition entry if empty sources.remove(tableName); if (sources.isEmpty()) { m_dataSourcesByPartition.remove(partitionId); removeMailbox(partitionId); } } //Do closing outside the synchronized block. Do not wait on future since // we're invoked from the source's executor thread. exportLog.info("Drained on unused partition " + partitionId + ": " + source); source.closeAndDelete(); }
[ "@", "Override", "public", "void", "onSourceDrained", "(", "int", "partitionId", ",", "String", "tableName", ")", "{", "ExportDataSource", "source", ";", "synchronized", "(", "m_dataSourcesByPartition", ")", "{", "Map", "<", "String", ",", "ExportDataSource", ">",...
The Export Data Source reports it is drained on an unused partition.
[ "The", "Export", "Data", "Source", "reports", "it", "is", "drained", "on", "an", "unused", "partition", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L845-L878
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java
HsqlArrayList.add
public void add(int index, Object element) { // reporter.updateCounter++; 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.length) { increaseCapacity(); } for (int i = elementCount; i > index; i--) { elementData[i] = elementData[i - 1]; } elementData[index] = element; elementCount++; }
java
public void add(int index, Object element) { // reporter.updateCounter++; 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.length) { increaseCapacity(); } for (int i = elementCount; i > index; i--) { elementData[i] = elementData[i - 1]; } elementData[index] = element; elementCount++; }
[ "public", "void", "add", "(", "int", "index", ",", "Object", "element", ")", "{", "// reporter.updateCounter++;", "if", "(", "index", ">", "elementCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index out of bounds: \"", "+", "index", ...
Inserts an element at the given index
[ "Inserts", "an", "element", "at", "the", "given", "index" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java#L118-L142
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java
HsqlArrayList.add
public boolean add(Object element) { // reporter.updateCounter++; if (elementCount >= elementData.length) { increaseCapacity(); } elementData[elementCount] = element; elementCount++; return true; }
java
public boolean add(Object element) { // reporter.updateCounter++; if (elementCount >= elementData.length) { increaseCapacity(); } elementData[elementCount] = element; elementCount++; return true; }
[ "public", "boolean", "add", "(", "Object", "element", ")", "{", "// reporter.updateCounter++;", "if", "(", "elementCount", ">=", "elementData", ".", "length", ")", "{", "increaseCapacity", "(", ")", ";", "}", "elementData", "[", "elementCount", "]", "=", ...
Appends an element to the end of the list
[ "Appends", "an", "element", "to", "the", "end", "of", "the", "list" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java#L145-L157
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java
HsqlArrayList.get
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]; }
java
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]; }
[ "public", "Object", "get", "(", "int", "index", ")", "{", "if", "(", "index", ">=", "elementCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index out of bounds: \"", "+", "index", "+", "\" >= \"", "+", "elementCount", ")", ";", "}", "i...
Gets the element at given position
[ "Gets", "the", "element", "at", "given", "position" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java#L160-L174
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java
HsqlArrayList.remove
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 (int i = index; i < elementCount - 1; i++) { elementData[i] = elementData[i + 1]; } elementCount--; if (elementCount == 0) { clear(); } else { elementData[elementCount] = null; } return removedObj; }
java
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 (int i = index; i < elementCount - 1; i++) { elementData[i] = elementData[i + 1]; } elementCount--; if (elementCount == 0) { clear(); } else { elementData[elementCount] = null; } return removedObj; }
[ "public", "Object", "remove", "(", "int", "index", ")", "{", "if", "(", "index", ">=", "elementCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index out of bounds: \"", "+", "index", "+", "\" >= \"", "+", "elementCount", ")", ";", "}", ...
Removes and returns the element at given position
[ "Removes", "and", "returns", "the", "element", "at", "given", "position" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java#L199-L227
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java
HsqlArrayList.set
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[index]; elementData[index] = element; return replacedObj; }
java
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[index]; elementData[index] = element; return replacedObj; }
[ "public", "Object", "set", "(", "int", "index", ",", "Object", "element", ")", "{", "if", "(", "index", ">=", "elementCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Index out of bounds: \"", "+", "index", "+", "\" >= \"", "+", "elementC...
Replaces the element at given position
[ "Replaces", "the", "element", "at", "given", "position" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlArrayList.java#L230-L248
train
VoltDB/voltdb
third_party/java/src/org/apache/jute_voltpatches/Utils.java
Utils.bufEquals
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 false; } } return true; }
java
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 false; } } return true; }
[ "public", "static", "boolean", "bufEquals", "(", "byte", "onearray", "[", "]", ",", "byte", "twoarray", "[", "]", ")", "{", "if", "(", "onearray", "==", "twoarray", ")", "return", "true", ";", "boolean", "ret", "=", "(", "onearray", ".", "length", "=="...
equals function that actually compares two buffers. @param onearray First buffer @param twoarray Second buffer @return true if one and two contain exactly the same content, else false.
[ "equals", "function", "that", "actually", "compares", "two", "buffers", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/jute_voltpatches/Utils.java#L43-L56
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/RCData.java
RCData.getConnection
public Connection getConnection(String curDriverIn, String curCharsetIn, String curTrustStoreIn) throws ClassNotFoundException, MalformedURLException, SQLException { // Local vars to satisfy compiler warnings String curDriver = curDriverIn; String curCharset = curCharsetIn; String curTrustStore = curTrustStoreIn; Properties sysProps = System.getProperties(); if (curDriver == null) { // If explicit driver not specified curDriver = ((driver == null) ? DEFAULT_JDBC_DRIVER : driver); } if (curCharset == null && charset != null) { curCharset = charset; } if (curTrustStore == null && truststore != null) { curTrustStore = truststore; } if (curCharset == null) { sysProps.remove("sqlfile.charset"); } else { sysProps.put("sqlfile.charset", curCharset); } if (curTrustStore == null) { sysProps.remove("javax.net.ssl.trustStore"); } else { sysProps.put("javax.net.ssl.trustStore", curTrustStore); } String urlString = null; try { urlString = expandSysPropVars(url); } catch (IllegalArgumentException iae) { throw new MalformedURLException(iae.getMessage() + " for URL '" + url + "'"); } String userString = null; if (username != null) try { userString = expandSysPropVars(username); } catch (IllegalArgumentException iae) { throw new MalformedURLException(iae.getMessage() + " for user name '" + username + "'"); } String passwordString = null; if (password != null) try { passwordString = expandSysPropVars(password); } catch (IllegalArgumentException iae) { throw new MalformedURLException(iae.getMessage() + " for password"); } Class.forName(curDriver); // This is not necessary for jdbc:odbc or if class loaded by a // service resource file. Consider checking for that. Connection c = (userString == null) ? DriverManager.getConnection(urlString) : DriverManager.getConnection(urlString, userString, passwordString); if (ti != null) RCData.setTI(c, ti); // Would like to verify the setting made by checking // c.getTransactionIsolation(). Unfortunately, the spec allows for // databases to substitute levels according to some rules, and it's // impossible to know what to expect since custom levels are permitted. // Debug: // System.err.println("TI set to " + ti + "\nPOST: " // + SqlTool.tiToString(c.getTransactionIsolation())); return c; }
java
public Connection getConnection(String curDriverIn, String curCharsetIn, String curTrustStoreIn) throws ClassNotFoundException, MalformedURLException, SQLException { // Local vars to satisfy compiler warnings String curDriver = curDriverIn; String curCharset = curCharsetIn; String curTrustStore = curTrustStoreIn; Properties sysProps = System.getProperties(); if (curDriver == null) { // If explicit driver not specified curDriver = ((driver == null) ? DEFAULT_JDBC_DRIVER : driver); } if (curCharset == null && charset != null) { curCharset = charset; } if (curTrustStore == null && truststore != null) { curTrustStore = truststore; } if (curCharset == null) { sysProps.remove("sqlfile.charset"); } else { sysProps.put("sqlfile.charset", curCharset); } if (curTrustStore == null) { sysProps.remove("javax.net.ssl.trustStore"); } else { sysProps.put("javax.net.ssl.trustStore", curTrustStore); } String urlString = null; try { urlString = expandSysPropVars(url); } catch (IllegalArgumentException iae) { throw new MalformedURLException(iae.getMessage() + " for URL '" + url + "'"); } String userString = null; if (username != null) try { userString = expandSysPropVars(username); } catch (IllegalArgumentException iae) { throw new MalformedURLException(iae.getMessage() + " for user name '" + username + "'"); } String passwordString = null; if (password != null) try { passwordString = expandSysPropVars(password); } catch (IllegalArgumentException iae) { throw new MalformedURLException(iae.getMessage() + " for password"); } Class.forName(curDriver); // This is not necessary for jdbc:odbc or if class loaded by a // service resource file. Consider checking for that. Connection c = (userString == null) ? DriverManager.getConnection(urlString) : DriverManager.getConnection(urlString, userString, passwordString); if (ti != null) RCData.setTI(c, ti); // Would like to verify the setting made by checking // c.getTransactionIsolation(). Unfortunately, the spec allows for // databases to substitute levels according to some rules, and it's // impossible to know what to expect since custom levels are permitted. // Debug: // System.err.println("TI set to " + ti + "\nPOST: " // + SqlTool.tiToString(c.getTransactionIsolation())); return c; }
[ "public", "Connection", "getConnection", "(", "String", "curDriverIn", ",", "String", "curCharsetIn", ",", "String", "curTrustStoreIn", ")", "throws", "ClassNotFoundException", ",", "MalformedURLException", ",", "SQLException", "{", "// Local vars to satisfy compiler warnings...
Gets a JDBC Connection using the data of this RCData object with specified override elements @return New JDBC Connection
[ "Gets", "a", "JDBC", "Connection", "using", "the", "data", "of", "this", "RCData", "object", "with", "specified", "override", "elements" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/RCData.java#L312-L398
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/RCData.java
RCData.tiToString
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"; case Connection.TRANSACTION_SERIALIZABLE: return "TRANSACTION_SERIALIZABLE"; case Connection.TRANSACTION_NONE: return "TRANSACTION_NONE"; } return "Custom Transaction Isolation numerical value: " + ti; }
java
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"; case Connection.TRANSACTION_SERIALIZABLE: return "TRANSACTION_SERIALIZABLE"; case Connection.TRANSACTION_NONE: return "TRANSACTION_NONE"; } return "Custom Transaction Isolation numerical value: " + ti; }
[ "static", "public", "String", "tiToString", "(", "int", "ti", ")", "{", "switch", "(", "ti", ")", "{", "case", "Connection", ".", "TRANSACTION_READ_UNCOMMITTED", ":", "return", "\"TRANSACTION_READ_UNCOMMITTED\"", ";", "case", "Connection", ".", "TRANSACTION_READ_COM...
Return String for numerical java.sql.Connection Transaction level. Returns null, since DB implementations are free to provide their own transaction isolation levels.
[ "Return", "String", "for", "numerical", "java", ".", "sql", ".", "Connection", "Transaction", "level", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/RCData.java#L468-L482
train
VoltDB/voltdb
src/frontend/org/voltdb/OpsAgent.java
OpsAgent.handleJSONMessageAsDummy
protected void handleJSONMessageAsDummy(JSONObject obj) throws Exception { hostLog.info("Generating dummy response for ops request " + obj); sendOpsResponse(null, obj, OPS_DUMMY); }
java
protected void handleJSONMessageAsDummy(JSONObject obj) throws Exception { hostLog.info("Generating dummy response for ops request " + obj); sendOpsResponse(null, obj, OPS_DUMMY); }
[ "protected", "void", "handleJSONMessageAsDummy", "(", "JSONObject", "obj", ")", "throws", "Exception", "{", "hostLog", ".", "info", "(", "\"Generating dummy response for ops request \"", "+", "obj", ")", ";", "sendOpsResponse", "(", "null", ",", "obj", ",", "OPS_DUM...
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
[ "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...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/OpsAgent.java#L151-L154
train
VoltDB/voltdb
src/frontend/org/voltdb/OpsAgent.java
OpsAgent.performOpsAction
public void performOpsAction(final Connection c, final long clientHandle, final OpsSelector selector, final ParameterSet params) throws Exception { m_es.submit(new Runnable() { @Override public void run() { try { collectStatsImpl(c, clientHandle, selector, params); } catch (Exception e) { hostLog.warn("Exception while attempting to collect stats", e); // ENG-14639, prevent clients like sqlcmd from hanging on exception sendErrorResponse(c, ClientResponse.OPERATIONAL_FAILURE, "Failed to get statistics (" + e.getMessage() + ").", clientHandle); } } }); }
java
public void performOpsAction(final Connection c, final long clientHandle, final OpsSelector selector, final ParameterSet params) throws Exception { m_es.submit(new Runnable() { @Override public void run() { try { collectStatsImpl(c, clientHandle, selector, params); } catch (Exception e) { hostLog.warn("Exception while attempting to collect stats", e); // ENG-14639, prevent clients like sqlcmd from hanging on exception sendErrorResponse(c, ClientResponse.OPERATIONAL_FAILURE, "Failed to get statistics (" + e.getMessage() + ").", clientHandle); } } }); }
[ "public", "void", "performOpsAction", "(", "final", "Connection", "c", ",", "final", "long", "clientHandle", ",", "final", "OpsSelector", "selector", ",", "final", "ParameterSet", "params", ")", "throws", "Exception", "{", "m_es", ".", "submit", "(", "new", "R...
Perform the action associated with this agent, using the provided ParameterSet. This is the entry point to the OPS system.
[ "Perform", "the", "action", "associated", "with", "this", "agent", "using", "the", "provided", "ParameterSet", ".", "This", "is", "the", "entry", "point", "to", "the", "OPS", "system", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/OpsAgent.java#L283-L300
train
VoltDB/voltdb
src/frontend/org/voltdb/OpsAgent.java
OpsAgent.distributeOpsWork
protected void distributeOpsWork(PendingOpsRequest newRequest, JSONObject obj) throws Exception { if (m_pendingRequests.size() > MAX_IN_FLIGHT_REQUESTS) { /* * Defensively check for an expired request not caught * by timeout check. Should never happen. */ Iterator<Entry<Long, PendingOpsRequest>> iter = m_pendingRequests.entrySet().iterator(); final long now = System.currentTimeMillis(); boolean foundExpiredRequest = false; while (iter.hasNext()) { PendingOpsRequest por = iter.next().getValue(); if (now - por.startTime > OPS_COLLECTION_TIMEOUT * 2) { iter.remove(); foundExpiredRequest = true; } } if (!foundExpiredRequest) { sendErrorResponse(newRequest.c, ClientResponse.GRACEFUL_FAILURE, "Too many pending stat requests", newRequest.clientData); return; } } final long requestId = m_nextRequestId++; m_pendingRequests.put(requestId, newRequest); newRequest.timer = m_es.schedule(new Runnable() { @Override public void run() { checkForRequestTimeout(requestId); } }, OPS_COLLECTION_TIMEOUT, TimeUnit.MILLISECONDS); // selector, subselector, interval filled in by parse... obj.put("requestId", requestId); obj.put("returnAddress", m_mailbox.getHSId()); int siteId = CoreUtils.getSiteIdFromHSId(m_mailbox.getHSId()); byte payloadBytes[] = CompressionService.compressBytes(obj.toString(4).getBytes("UTF-8")); for (int hostId : m_messenger.getLiveHostIds()) { long agentHsId = CoreUtils.getHSIdFromHostAndSite(hostId, siteId); newRequest.expectedOpsResponses++; BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[] {JSON_PAYLOAD}, payloadBytes); m_mailbox.send(agentHsId, bpm); } }
java
protected void distributeOpsWork(PendingOpsRequest newRequest, JSONObject obj) throws Exception { if (m_pendingRequests.size() > MAX_IN_FLIGHT_REQUESTS) { /* * Defensively check for an expired request not caught * by timeout check. Should never happen. */ Iterator<Entry<Long, PendingOpsRequest>> iter = m_pendingRequests.entrySet().iterator(); final long now = System.currentTimeMillis(); boolean foundExpiredRequest = false; while (iter.hasNext()) { PendingOpsRequest por = iter.next().getValue(); if (now - por.startTime > OPS_COLLECTION_TIMEOUT * 2) { iter.remove(); foundExpiredRequest = true; } } if (!foundExpiredRequest) { sendErrorResponse(newRequest.c, ClientResponse.GRACEFUL_FAILURE, "Too many pending stat requests", newRequest.clientData); return; } } final long requestId = m_nextRequestId++; m_pendingRequests.put(requestId, newRequest); newRequest.timer = m_es.schedule(new Runnable() { @Override public void run() { checkForRequestTimeout(requestId); } }, OPS_COLLECTION_TIMEOUT, TimeUnit.MILLISECONDS); // selector, subselector, interval filled in by parse... obj.put("requestId", requestId); obj.put("returnAddress", m_mailbox.getHSId()); int siteId = CoreUtils.getSiteIdFromHSId(m_mailbox.getHSId()); byte payloadBytes[] = CompressionService.compressBytes(obj.toString(4).getBytes("UTF-8")); for (int hostId : m_messenger.getLiveHostIds()) { long agentHsId = CoreUtils.getHSIdFromHostAndSite(hostId, siteId); newRequest.expectedOpsResponses++; BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[] {JSON_PAYLOAD}, payloadBytes); m_mailbox.send(agentHsId, bpm); } }
[ "protected", "void", "distributeOpsWork", "(", "PendingOpsRequest", "newRequest", ",", "JSONObject", "obj", ")", "throws", "Exception", "{", "if", "(", "m_pendingRequests", ".", "size", "(", ")", ">", "MAX_IN_FLIGHT_REQUESTS", ")", "{", "/*\n * Defensively...
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 this service.
[ "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", ...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/OpsAgent.java#L308-L355
train
VoltDB/voltdb
src/frontend/org/voltdb/OpsAgent.java
OpsAgent.sendClientResponse
protected void sendClientResponse(PendingOpsRequest request) { byte statusCode = ClientResponse.SUCCESS; String statusString = null; /* * It is possible not to receive a table response if a feature is not enabled */ // All of the null/empty table handling/detecting/generation sucks. Just making it // work for now, not making it pretty. --izzy VoltTable responseTables[] = request.aggregateTables; if (responseTables == null || responseTables.length == 0) { responseTables = new VoltTable[0]; statusCode = ClientResponse.GRACEFUL_FAILURE; statusString = "Requested info \"" + request.subselector + "\" is not yet available or not supported in the current configuration."; } ClientResponseImpl response = new ClientResponseImpl(statusCode, ClientResponse.UNINITIALIZED_APP_STATUS_CODE, null, responseTables, statusString); response.setClientHandle(request.clientData); ByteBuffer buf = ByteBuffer.allocate(response.getSerializedSize() + 4); buf.putInt(buf.capacity() - 4); response.flattenToBuffer(buf).flip(); request.c.writeStream().enqueue(buf); }
java
protected void sendClientResponse(PendingOpsRequest request) { byte statusCode = ClientResponse.SUCCESS; String statusString = null; /* * It is possible not to receive a table response if a feature is not enabled */ // All of the null/empty table handling/detecting/generation sucks. Just making it // work for now, not making it pretty. --izzy VoltTable responseTables[] = request.aggregateTables; if (responseTables == null || responseTables.length == 0) { responseTables = new VoltTable[0]; statusCode = ClientResponse.GRACEFUL_FAILURE; statusString = "Requested info \"" + request.subselector + "\" is not yet available or not supported in the current configuration."; } ClientResponseImpl response = new ClientResponseImpl(statusCode, ClientResponse.UNINITIALIZED_APP_STATUS_CODE, null, responseTables, statusString); response.setClientHandle(request.clientData); ByteBuffer buf = ByteBuffer.allocate(response.getSerializedSize() + 4); buf.putInt(buf.capacity() - 4); response.flattenToBuffer(buf).flip(); request.c.writeStream().enqueue(buf); }
[ "protected", "void", "sendClientResponse", "(", "PendingOpsRequest", "request", ")", "{", "byte", "statusCode", "=", "ClientResponse", ".", "SUCCESS", ";", "String", "statusString", "=", "null", ";", "/*\n * It is possible not to receive a table response if a feature ...
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.
[ "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",...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/OpsAgent.java#L379-L404
train
VoltDB/voltdb
src/frontend/org/voltdb/OpsAgent.java
OpsAgent.sendOpsResponse
private void sendOpsResponse(VoltTable[] results, JSONObject obj, byte payloadType) throws Exception { long requestId = obj.getLong("requestId"); long returnAddress = obj.getLong("returnAddress"); // Send a response with no data since the stats is not supported or not yet available if (results == null) { ByteBuffer responseBuffer = ByteBuffer.allocate(8); responseBuffer.putLong(requestId); byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); return; } ByteBuffer[] bufs = new ByteBuffer[results.length]; int statbytes = 0; for (int i = 0; i < results.length; i++) { bufs[i] = results[i].getBuffer(); bufs[i].position(0); statbytes += bufs[i].remaining(); } ByteBuffer responseBuffer = ByteBuffer.allocate( 8 + // requestId 4 * results.length + // length prefix for each stats table + statbytes); responseBuffer.putLong(requestId); for (ByteBuffer buf : bufs) { responseBuffer.putInt(buf.remaining()); responseBuffer.put(buf); } byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); }
java
private void sendOpsResponse(VoltTable[] results, JSONObject obj, byte payloadType) throws Exception { long requestId = obj.getLong("requestId"); long returnAddress = obj.getLong("returnAddress"); // Send a response with no data since the stats is not supported or not yet available if (results == null) { ByteBuffer responseBuffer = ByteBuffer.allocate(8); responseBuffer.putLong(requestId); byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); return; } ByteBuffer[] bufs = new ByteBuffer[results.length]; int statbytes = 0; for (int i = 0; i < results.length; i++) { bufs[i] = results[i].getBuffer(); bufs[i].position(0); statbytes += bufs[i].remaining(); } ByteBuffer responseBuffer = ByteBuffer.allocate( 8 + // requestId 4 * results.length + // length prefix for each stats table + statbytes); responseBuffer.putLong(requestId); for (ByteBuffer buf : bufs) { responseBuffer.putInt(buf.remaining()); responseBuffer.put(buf); } byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); }
[ "private", "void", "sendOpsResponse", "(", "VoltTable", "[", "]", "results", ",", "JSONObject", "obj", ",", "byte", "payloadType", ")", "throws", "Exception", "{", "long", "requestId", "=", "obj", ".", "getLong", "(", "\"requestId\"", ")", ";", "long", "retu...
Return the results of distributed work to the original requesting agent. Used by subclasses to respond after they've done their local work.
[ "Return", "the", "results", "of", "distributed", "work", "to", "the", "original", "requesting", "agent", ".", "Used", "by", "subclasses", "to", "respond", "after", "they", "ve", "done", "their", "local", "work", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/OpsAgent.java#L414-L449
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/StatementCompiler.java
StatementCompiler.addUDFDependences
private static void addUDFDependences(Function function, Statement catalogStmt) { Procedure procedure = (Procedure)catalogStmt.getParent(); addFunctionDependence(function, procedure, catalogStmt); addStatementDependence(function, catalogStmt); }
java
private static void addUDFDependences(Function function, Statement catalogStmt) { Procedure procedure = (Procedure)catalogStmt.getParent(); addFunctionDependence(function, procedure, catalogStmt); addStatementDependence(function, catalogStmt); }
[ "private", "static", "void", "addUDFDependences", "(", "Function", "function", ",", "Statement", "catalogStmt", ")", "{", "Procedure", "procedure", "=", "(", "Procedure", ")", "catalogStmt", ".", "getParent", "(", ")", ";", "addFunctionDependence", "(", "function"...
Add all statement dependences, both ways. @param function The function to add as dependee. @param procedure The procedure of the statement. @param catalogStmt The statement to add as depender.
[ "Add", "all", "statement", "dependences", "both", "ways", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L372-L376
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/StatementCompiler.java
StatementCompiler.addFunctionDependence
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(stmtName); } } String statementName = procedure.getTypeName() + ":" + catalogStmt.getTypeName(); if (stmtSet.contains(statementName)) { return; } stmtSet.add(statementName); StringBuilder sb = new StringBuilder(); // We will add this procedure:statement pair. So make sure we have // an initial comma. Note that an empty set must be represented // by an empty string. We represent the set {pp:ss, qq:tt}, // where "pp" and "qq" are procedures and "ss" and "tt" are // statements in their procedures respectively, with // the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will // never find "ppp:sss" by accident. // // Do to this, when we add something to string we start with a single // comma, and then add "qq:tt," at the end. sb.append(","); for (String stmtName : stmtSet) { sb.append(stmtName + ","); } function.setStmtdependers(sb.toString()); }
java
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(stmtName); } } String statementName = procedure.getTypeName() + ":" + catalogStmt.getTypeName(); if (stmtSet.contains(statementName)) { return; } stmtSet.add(statementName); StringBuilder sb = new StringBuilder(); // We will add this procedure:statement pair. So make sure we have // an initial comma. Note that an empty set must be represented // by an empty string. We represent the set {pp:ss, qq:tt}, // where "pp" and "qq" are procedures and "ss" and "tt" are // statements in their procedures respectively, with // the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will // never find "ppp:sss" by accident. // // Do to this, when we add something to string we start with a single // comma, and then add "qq:tt," at the end. sb.append(","); for (String stmtName : stmtSet) { sb.append(stmtName + ","); } function.setStmtdependers(sb.toString()); }
[ "private", "static", "void", "addFunctionDependence", "(", "Function", "function", ",", "Procedure", "procedure", ",", "Statement", "catalogStmt", ")", "{", "String", "funcDeps", "=", "function", ".", "getStmtdependers", "(", ")", ";", "Set", "<", "String", ">",...
Add a dependence to a function of a statement. The function's dependence string is altered with this function. @param function The function to add as dependee. @param procedure The procedure of the statement. @param catalogStmt The statement to add as depender.
[ "Add", "a", "dependence", "to", "a", "function", "of", "a", "statement", ".", "The", "function", "s", "dependence", "string", "is", "altered", "with", "this", "function", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L386-L418
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/StatementCompiler.java
StatementCompiler.addStatementDependence
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 functionName = function.getTypeName(); if (fnSet.contains(functionName)) { return; } fnSet.add(functionName); StringBuilder sb = new StringBuilder(); sb.append(","); for (String fnName : fnSet) { sb.append(fnName + ","); } catalogStmt.setFunctiondependees(sb.toString()); }
java
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 functionName = function.getTypeName(); if (fnSet.contains(functionName)) { return; } fnSet.add(functionName); StringBuilder sb = new StringBuilder(); sb.append(","); for (String fnName : fnSet) { sb.append(fnName + ","); } catalogStmt.setFunctiondependees(sb.toString()); }
[ "private", "static", "void", "addStatementDependence", "(", "Function", "function", ",", "Statement", "catalogStmt", ")", "{", "String", "fnDeps", "=", "catalogStmt", ".", "getFunctiondependees", "(", ")", ";", "Set", "<", "String", ">", "fnSet", "=", "new", "...
Add a dependence of a statement to a function. The statement's dependence string is altered with this function. @param function The function to add as dependee. @param catalogStmt The statement to add as depender.
[ "Add", "a", "dependence", "of", "a", "statement", "to", "a", "function", ".", "The", "statement", "s", "dependence", "string", "is", "altered", "with", "this", "function", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L427-L449
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/StatementCompiler.java
StatementCompiler.fragmentReferencesPersistentTable
static boolean fragmentReferencesPersistentTable(AbstractPlanNode node) { if (node == null) return false; // these nodes can read/modify persistent tables if (node instanceof AbstractScanPlanNode) return true; if (node instanceof InsertPlanNode) return true; if (node instanceof DeletePlanNode) return true; if (node instanceof UpdatePlanNode) return true; // recursively check out children for (int i = 0; i < node.getChildCount(); i++) { AbstractPlanNode child = node.getChild(i); if (fragmentReferencesPersistentTable(child)) return true; } // if nothing found, return false return false; }
java
static boolean fragmentReferencesPersistentTable(AbstractPlanNode node) { if (node == null) return false; // these nodes can read/modify persistent tables if (node instanceof AbstractScanPlanNode) return true; if (node instanceof InsertPlanNode) return true; if (node instanceof DeletePlanNode) return true; if (node instanceof UpdatePlanNode) return true; // recursively check out children for (int i = 0; i < node.getChildCount(); i++) { AbstractPlanNode child = node.getChild(i); if (fragmentReferencesPersistentTable(child)) return true; } // if nothing found, return false return false; }
[ "static", "boolean", "fragmentReferencesPersistentTable", "(", "AbstractPlanNode", "node", ")", "{", "if", "(", "node", "==", "null", ")", "return", "false", ";", "// these nodes can read/modify persistent tables", "if", "(", "node", "instanceof", "AbstractScanPlanNode", ...
Check through a plan graph and return true if it ever touches a persistent table.
[ "Check", "through", "a", "plan", "graph", "and", "return", "true", "if", "it", "ever", "touches", "a", "persistent", "table", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L480-L503
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/StatementCompiler.java
StatementCompiler.compileNibbleDeleteProcedure
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, countingQuery, "0"); String deleteQuery = genDeleteSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, deleteQuery, "1"); String valueAtQuery = genValueAtOffsetSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, valueAtQuery, "2"); return newCatProc; }
java
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, countingQuery, "0"); String deleteQuery = genDeleteSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, deleteQuery, "1"); String valueAtQuery = genValueAtOffsetSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, valueAtQuery, "2"); return newCatProc; }
[ "public", "static", "Procedure", "compileNibbleDeleteProcedure", "(", "Table", "catTable", ",", "String", "procName", ",", "Column", "col", ",", "ComparisonOperation", "comp", ")", "{", "Procedure", "newCatProc", "=", "addProcedure", "(", "catTable", ",", "procName"...
Generate small deletion queries by using count - select - delete pattern. 1) First query finds number of rows meet the delete condition. 2) Second query finds the cut-off value if number of rows to be deleted is higher than maximum delete chunk size. 3) Third query deletes rows selected by above queries.
[ "Generate", "small", "deletion", "queries", "by", "using", "count", "-", "select", "-", "delete", "pattern", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L796-L810
train
VoltDB/voltdb
src/frontend/org/voltdb/compiler/StatementCompiler.java
StatementCompiler.compileMigrateProcedure
public static Procedure compileMigrateProcedure(Table table, String procName, Column column, ComparisonOperation comparison) { Procedure proc = addProcedure(table, procName); // Select count(*) StringBuilder sb = new StringBuilder(); sb.append("SELECT COUNT(*) FROM " + table.getTypeName()); sb.append(" WHERE not migrating AND " + column.getName() + " " + comparison.toString() + " ?;"); addStatement(table, proc, sb.toString(), "0"); // Get cutoff value sb.setLength(0); sb.append("SELECT " + column.getName() + " FROM " + table.getTypeName()); sb.append(" WHERE not migrating ORDER BY " + column.getName()); if (comparison == ComparisonOperation.LTE || comparison == ComparisonOperation.LT) { sb.append(" ASC OFFSET ? LIMIT 1;"); } else { sb.append(" DESC OFFSET ? LIMIT 1;"); } addStatement(table, proc, sb.toString(), "1"); // Migrate sb.setLength(0); sb.append("MIGRATE FROM " + table.getTypeName()); sb.append(" WHERE not migrating AND " + column.getName() + " " + comparison.toString() + " ?;"); addStatement(table, proc, sb.toString(), "2"); return proc; }
java
public static Procedure compileMigrateProcedure(Table table, String procName, Column column, ComparisonOperation comparison) { Procedure proc = addProcedure(table, procName); // Select count(*) StringBuilder sb = new StringBuilder(); sb.append("SELECT COUNT(*) FROM " + table.getTypeName()); sb.append(" WHERE not migrating AND " + column.getName() + " " + comparison.toString() + " ?;"); addStatement(table, proc, sb.toString(), "0"); // Get cutoff value sb.setLength(0); sb.append("SELECT " + column.getName() + " FROM " + table.getTypeName()); sb.append(" WHERE not migrating ORDER BY " + column.getName()); if (comparison == ComparisonOperation.LTE || comparison == ComparisonOperation.LT) { sb.append(" ASC OFFSET ? LIMIT 1;"); } else { sb.append(" DESC OFFSET ? LIMIT 1;"); } addStatement(table, proc, sb.toString(), "1"); // Migrate sb.setLength(0); sb.append("MIGRATE FROM " + table.getTypeName()); sb.append(" WHERE not migrating AND " + column.getName() + " " + comparison.toString() + " ?;"); addStatement(table, proc, sb.toString(), "2"); return proc; }
[ "public", "static", "Procedure", "compileMigrateProcedure", "(", "Table", "table", ",", "String", "procName", ",", "Column", "column", ",", "ComparisonOperation", "comparison", ")", "{", "Procedure", "proc", "=", "addProcedure", "(", "table", ",", "procName", ")",...
Generate migrate queries by using count - select - migrate pattern. 1) First query finds number of rows meet the migrate condition. 2) Second query finds the cut-off value if number of rows to be migrate is higher than maximum migrate chunk size. 3) Third query migrates rows selected by above queries.
[ "Generate", "migrate", "queries", "by", "using", "count", "-", "select", "-", "migrate", "pattern", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L820-L848
train
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Constraints.java
Constraints.constrainedCollection
public static <E> Collection<E> constrainedCollection( Collection<E> collection, Constraint<? super E> constraint) { return new ConstrainedCollection<E>(collection, constraint); }
java
public static <E> Collection<E> constrainedCollection( Collection<E> collection, Constraint<? super E> constraint) { return new ConstrainedCollection<E>(collection, constraint); }
[ "public", "static", "<", "E", ">", "Collection", "<", "E", ">", "constrainedCollection", "(", "Collection", "<", "E", ">", "collection", ",", "Constraint", "<", "?", "super", "E", ">", "constraint", ")", "{", "return", "new", "ConstrainedCollection", "<", ...
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. <p>The returned collection is not serializable. @param collection the collection to constrain @param constraint the constraint that validates added elements @return a constrained view of the collection
[ "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", ".",...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Constraints.java#L51-L54
train
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Constraints.java
Constraints.constrainedSet
public static <E> Set<E> constrainedSet(Set<E> set, Constraint<? super E> constraint) { return new ConstrainedSet<E>(set, constraint); }
java
public static <E> Set<E> constrainedSet(Set<E> set, Constraint<? super E> constraint) { return new ConstrainedSet<E>(set, constraint); }
[ "public", "static", "<", "E", ">", "Set", "<", "E", ">", "constrainedSet", "(", "Set", "<", "E", ">", "set", ",", "Constraint", "<", "?", "super", "E", ">", "constraint", ")", "{", "return", "new", "ConstrainedSet", "<", "E", ">", "(", "set", ",", ...
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. <p>The returned set is not serializable. @param set the set to constrain @param constraint the constraint that validates added elements @return a constrained view of the set
[ "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", ...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Constraints.java#L95-L97
train
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Constraints.java
Constraints.constrainedSortedSet
public static <E> SortedSet<E> constrainedSortedSet( SortedSet<E> sortedSet, Constraint<? super E> constraint) { return new ConstrainedSortedSet<E>(sortedSet, constraint); }
java
public static <E> SortedSet<E> constrainedSortedSet( SortedSet<E> sortedSet, Constraint<? super E> constraint) { return new ConstrainedSortedSet<E>(sortedSet, constraint); }
[ "public", "static", "<", "E", ">", "SortedSet", "<", "E", ">", "constrainedSortedSet", "(", "SortedSet", "<", "E", ">", "sortedSet", ",", "Constraint", "<", "?", "super", "E", ">", "constraint", ")", "{", "return", "new", "ConstrainedSortedSet", "<", "E", ...
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. <p>The returned set is not serializable. @param sortedSet the sorted set to constrain @param constraint the constraint that validates added elements @return a constrained view of the sorted set
[ "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", "constrain...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Constraints.java#L138-L141
train
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Constraints.java
Constraints.constrainedList
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); }
java
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); }
[ "public", "static", "<", "E", ">", "List", "<", "E", ">", "constrainedList", "(", "List", "<", "E", ">", "list", ",", "Constraint", "<", "?", "super", "E", ">", "constraint", ")", "{", "return", "(", "list", "instanceof", "RandomAccess", ")", "?", "n...
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. <p>If {@code list} implements {@link RandomAccess}, so will the returned list. The returned list is not serializable. @param list the list to constrain @param constraint the constraint that validates added elements @return a constrained view of the list
[ "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"...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Constraints.java#L198-L202
train
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/collect/Constraints.java
Constraints.constrainedListIterator
private static <E> ListIterator<E> constrainedListIterator( ListIterator<E> listIterator, Constraint<? super E> constraint) { return new ConstrainedListIterator<E>(listIterator, constraint); }
java
private static <E> ListIterator<E> constrainedListIterator( ListIterator<E> listIterator, Constraint<? super E> constraint) { return new ConstrainedListIterator<E>(listIterator, constraint); }
[ "private", "static", "<", "E", ">", "ListIterator", "<", "E", ">", "constrainedListIterator", "(", "ListIterator", "<", "E", ">", "listIterator", ",", "Constraint", "<", "?", "super", "E", ">", "constraint", ")", "{", "return", "new", "ConstrainedListIterator"...
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. @param listIterator the iterator for which to return a constrained view @param constraint the constraint for elements in the list @return a constrained view of the specified iterator
[ "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", "b...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Constraints.java#L280-L283
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/TableBase.java
TableBase.createIndex
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, migrating, constraint, forward); return newIndex; }
java
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, migrating, constraint, forward); return newIndex; }
[ "public", "final", "Index", "createIndex", "(", "PersistentStore", "store", ",", "HsqlName", "name", ",", "int", "[", "]", "columns", ",", "boolean", "[", "]", "descending", ",", "boolean", "[", "]", "nullsLast", ",", "boolean", "unique", ",", "boolean", "...
Create new memory-resident index. For MEMORY and TEXT tables.
[ "Create", "new", "memory", "-", "resident", "index", ".", "For", "MEMORY", "and", "TEXT", "tables", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TableBase.java#L492-L501
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/types/BitType.java
BitType.getCombinedType
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; break; case Types.SQL_BIT_VARYING : newType = other; break; case Types.SQL_BINARY : case Types.SQL_VARBINARY : case Types.SQL_BLOB : return other.getCombinedType(this, operation); default : throw Error.error(ErrorCode.X_42562); } if (newPrecision > maxBitPrecision) { if (typeCode == Types.SQL_BIT) { // Standard disallows type length reduction throw Error.error(ErrorCode.X_42570); } newPrecision = maxBitPrecision; } return getBitType(newType.typeCode, newPrecision); }
java
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; break; case Types.SQL_BIT_VARYING : newType = other; break; case Types.SQL_BINARY : case Types.SQL_VARBINARY : case Types.SQL_BLOB : return other.getCombinedType(this, operation); default : throw Error.error(ErrorCode.X_42562); } if (newPrecision > maxBitPrecision) { if (typeCode == Types.SQL_BIT) { // Standard disallows type length reduction throw Error.error(ErrorCode.X_42570); } newPrecision = maxBitPrecision; } return getBitType(newType.typeCode, newPrecision); }
[ "public", "Type", "getCombinedType", "(", "Type", "other", ",", "int", "operation", ")", "{", "if", "(", "operation", "!=", "OpTypes", ".", "CONCAT", ")", "{", "return", "getAggregateType", "(", "other", ")", ";", "}", "Type", "newType", ";", "long", "ne...
Returns type for concat
[ "Returns", "type", "for", "concat" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/types/BitType.java#L149-L191
train
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/Pause.java
Pause.run
public VoltTable[] run(SystemProcedureExecutionContext ctx) { // Choose the lowest site ID on this host to actually flip the bit if (ctx.isLowestSiteId()) { VoltDBInterface voltdb = VoltDB.instance(); OperationMode opMode = voltdb.getMode(); if (LOG.isDebugEnabled()) { LOG.debug("voltdb opmode is " + opMode); } ZooKeeper zk = voltdb.getHostMessenger().getZK(); try { Stat stat; OperationMode zkMode = null; Code code; do { stat = new Stat(); code = Code.BADVERSION; try { byte [] data = zk.getData(VoltZK.operationMode, false, stat); if (LOG.isDebugEnabled()) { LOG.debug("zkMode is " + (zkMode == null ? "(null)" : OperationMode.valueOf(data))); } zkMode = data == null ? opMode : OperationMode.valueOf(data); if (zkMode == PAUSED) { if (LOG.isDebugEnabled()) { LOG.debug("read node at version " + stat.getVersion() + ", txn " + ll(stat.getMzxid())); } break; } stat = zk.setData(VoltZK.operationMode, PAUSED.getBytes(), stat.getVersion()); code = Code.OK; zkMode = PAUSED; if (LOG.isDebugEnabled()) { LOG.debug("!WROTE! node at version " + stat.getVersion() + ", txn " + ll(stat.getMzxid())); } break; } catch (BadVersionException ex) { code = ex.code(); } } while (zkMode != PAUSED && code == Code.BADVERSION); m_stat = stat; voltdb.getHostMessenger().pause(); voltdb.setMode(PAUSED); // for snmp SnmpTrapSender snmp = voltdb.getSnmpTrapSender(); if (snmp != null) { snmp.pause("Cluster paused."); } } catch (Exception e) { throw new RuntimeException(e); } } // Force a tick so that stats will be updated. // Primarily added to get latest table stats for DR pause and empty db check. ctx.getSiteProcedureConnection().tick(); VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); t.addRow(VoltSystemProcedure.STATUS_OK); return (new VoltTable[] {t}); }
java
public VoltTable[] run(SystemProcedureExecutionContext ctx) { // Choose the lowest site ID on this host to actually flip the bit if (ctx.isLowestSiteId()) { VoltDBInterface voltdb = VoltDB.instance(); OperationMode opMode = voltdb.getMode(); if (LOG.isDebugEnabled()) { LOG.debug("voltdb opmode is " + opMode); } ZooKeeper zk = voltdb.getHostMessenger().getZK(); try { Stat stat; OperationMode zkMode = null; Code code; do { stat = new Stat(); code = Code.BADVERSION; try { byte [] data = zk.getData(VoltZK.operationMode, false, stat); if (LOG.isDebugEnabled()) { LOG.debug("zkMode is " + (zkMode == null ? "(null)" : OperationMode.valueOf(data))); } zkMode = data == null ? opMode : OperationMode.valueOf(data); if (zkMode == PAUSED) { if (LOG.isDebugEnabled()) { LOG.debug("read node at version " + stat.getVersion() + ", txn " + ll(stat.getMzxid())); } break; } stat = zk.setData(VoltZK.operationMode, PAUSED.getBytes(), stat.getVersion()); code = Code.OK; zkMode = PAUSED; if (LOG.isDebugEnabled()) { LOG.debug("!WROTE! node at version " + stat.getVersion() + ", txn " + ll(stat.getMzxid())); } break; } catch (BadVersionException ex) { code = ex.code(); } } while (zkMode != PAUSED && code == Code.BADVERSION); m_stat = stat; voltdb.getHostMessenger().pause(); voltdb.setMode(PAUSED); // for snmp SnmpTrapSender snmp = voltdb.getSnmpTrapSender(); if (snmp != null) { snmp.pause("Cluster paused."); } } catch (Exception e) { throw new RuntimeException(e); } } // Force a tick so that stats will be updated. // Primarily added to get latest table stats for DR pause and empty db check. ctx.getSiteProcedureConnection().tick(); VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); t.addRow(VoltSystemProcedure.STATUS_OK); return (new VoltTable[] {t}); }
[ "public", "VoltTable", "[", "]", "run", "(", "SystemProcedureExecutionContext", "ctx", ")", "{", "// Choose the lowest site ID on this host to actually flip the bit", "if", "(", "ctx", ".", "isLowestSiteId", "(", ")", ")", "{", "VoltDBInterface", "voltdb", "=", "VoltDB"...
Enter admin mode @param ctx Internal parameter. Not user-accessible. @return Standard STATUS table.
[ "Enter", "admin", "mode" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/Pause.java#L68-L131
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java
StatementDMQL.setGeneratedColumnInfo
@Override public void setGeneratedColumnInfo(int generate, ResultMetaData meta) { // can support INSERT_SELECT also if (type != StatementTypes.INSERT) { return; } int colIndex = baseTable.getIdentityColumnIndex(); if (colIndex == -1) { return; } switch (generate) { case ResultConstants.RETURN_NO_GENERATED_KEYS : return; case ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES : int[] columnIndexes = meta.getGeneratedColumnIndexes(); if (columnIndexes.length != 1) { return; } if (columnIndexes[0] != colIndex) { return; } // $FALL-THROUGH$ case ResultConstants.RETURN_GENERATED_KEYS : generatedIndexes = new int[]{ colIndex }; break; case ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES : String[] columnNames = meta.getGeneratedColumnNames(); if (columnNames.length != 1) { return; } if (baseTable.findColumn(columnNames[0]) != colIndex) { return; } generatedIndexes = new int[]{ colIndex }; break; } generatedResultMetaData = ResultMetaData.newResultMetaData(generatedIndexes.length); for (int i = 0; i < generatedIndexes.length; i++) { ColumnSchema column = baseTable.getColumn(generatedIndexes[i]); generatedResultMetaData.columns[i] = column; } generatedResultMetaData.prepareData(); }
java
@Override public void setGeneratedColumnInfo(int generate, ResultMetaData meta) { // can support INSERT_SELECT also if (type != StatementTypes.INSERT) { return; } int colIndex = baseTable.getIdentityColumnIndex(); if (colIndex == -1) { return; } switch (generate) { case ResultConstants.RETURN_NO_GENERATED_KEYS : return; case ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES : int[] columnIndexes = meta.getGeneratedColumnIndexes(); if (columnIndexes.length != 1) { return; } if (columnIndexes[0] != colIndex) { return; } // $FALL-THROUGH$ case ResultConstants.RETURN_GENERATED_KEYS : generatedIndexes = new int[]{ colIndex }; break; case ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES : String[] columnNames = meta.getGeneratedColumnNames(); if (columnNames.length != 1) { return; } if (baseTable.findColumn(columnNames[0]) != colIndex) { return; } generatedIndexes = new int[]{ colIndex }; break; } generatedResultMetaData = ResultMetaData.newResultMetaData(generatedIndexes.length); for (int i = 0; i < generatedIndexes.length; i++) { ColumnSchema column = baseTable.getColumn(generatedIndexes[i]); generatedResultMetaData.columns[i] = column; } generatedResultMetaData.prepareData(); }
[ "@", "Override", "public", "void", "setGeneratedColumnInfo", "(", "int", "generate", ",", "ResultMetaData", "meta", ")", "{", "// can support INSERT_SELECT also", "if", "(", "type", "!=", "StatementTypes", ".", "INSERT", ")", "{", "return", ";", "}", "int", "col...
For the creation of the statement
[ "For", "the", "creation", "of", "the", "statement" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java#L240-L300
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java
StatementDMQL.checkAccessRights
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[i]); } for (int i = 0; i < routines.length; i++) { if (routines[i].isLibraryRoutine()) { continue; } session.getGrantee().checkAccess(routines[i]); } for (int i = 0; i < rangeVariables.length; i++) { RangeVariable range = rangeVariables[i]; if (range.rangeTable.getSchemaName() == SqlInvariants.SYSTEM_SCHEMA_HSQLNAME) { continue; } session.getGrantee().checkSelect(range.rangeTable, range.usedColumns); } switch (type) { case StatementTypes.CALL : { break; } case StatementTypes.INSERT : { session.getGrantee().checkInsert(targetTable, insertCheckColumns); break; } case StatementTypes.SELECT_CURSOR : break; case StatementTypes.DELETE_WHERE : { session.getGrantee().checkDelete(targetTable); break; } case StatementTypes.UPDATE_WHERE : { session.getGrantee().checkUpdate(targetTable, updateCheckColumns); break; } case StatementTypes.MERGE : { session.getGrantee().checkInsert(targetTable, insertCheckColumns); session.getGrantee().checkUpdate(targetTable, updateCheckColumns); break; } } }
java
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[i]); } for (int i = 0; i < routines.length; i++) { if (routines[i].isLibraryRoutine()) { continue; } session.getGrantee().checkAccess(routines[i]); } for (int i = 0; i < rangeVariables.length; i++) { RangeVariable range = rangeVariables[i]; if (range.rangeTable.getSchemaName() == SqlInvariants.SYSTEM_SCHEMA_HSQLNAME) { continue; } session.getGrantee().checkSelect(range.rangeTable, range.usedColumns); } switch (type) { case StatementTypes.CALL : { break; } case StatementTypes.INSERT : { session.getGrantee().checkInsert(targetTable, insertCheckColumns); break; } case StatementTypes.SELECT_CURSOR : break; case StatementTypes.DELETE_WHERE : { session.getGrantee().checkDelete(targetTable); break; } case StatementTypes.UPDATE_WHERE : { session.getGrantee().checkUpdate(targetTable, updateCheckColumns); break; } case StatementTypes.MERGE : { session.getGrantee().checkInsert(targetTable, insertCheckColumns); session.getGrantee().checkUpdate(targetTable, updateCheckColumns); break; } } }
[ "void", "checkAccessRights", "(", "Session", "session", ")", "{", "if", "(", "targetTable", "!=", "null", "&&", "!", "targetTable", ".", "isTemp", "(", ")", ")", "{", "targetTable", ".", "checkDataReadOnly", "(", ")", ";", "session", ".", "checkReadWrite", ...
Determines if the authorizations are adequate to execute the compiled object. Completion requires the list of all database objects in a compiled statement.
[ "Determines", "if", "the", "authorizations", "are", "adequate", "to", "execute", "the", "compiled", "object", ".", "Completion", "requires", "the", "list", "of", "all", "database", "objects", "in", "a", "compiled", "statement", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java#L437-L506
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java
StatementDMQL.getResultMetaData
@Override 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, "CompiledStatement.getResultMetaData()"); } }
java
@Override 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, "CompiledStatement.getResultMetaData()"); } }
[ "@", "Override", "public", "ResultMetaData", "getResultMetaData", "(", ")", "{", "switch", "(", "type", ")", "{", "case", "StatementTypes", ".", "DELETE_WHERE", ":", "case", "StatementTypes", ".", "INSERT", ":", "case", "StatementTypes", ".", "UPDATE_WHERE", ":"...
Returns the metadata, which is empty if the CompiledStatement does not generate a Result.
[ "Returns", "the", "metadata", "which", "is", "empty", "if", "the", "CompiledStatement", "does", "not", "generate", "a", "Result", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementDMQL.java#L524-L540
train