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
third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java
Util.readTxnBytes
public static byte[] readTxnBytes(InputArchive ia) throws IOException { try{ byte[] bytes = ia.readBuffer("txtEntry"); // Since we preallocate, we define EOF to be an // empty transaction if (bytes.length == 0) return bytes; if (ia.readByte("EOF") != 'B') { LOG.error("Last transaction was partial."); return null; } return bytes; }catch(EOFException e){} return null; }
java
public static byte[] readTxnBytes(InputArchive ia) throws IOException { try{ byte[] bytes = ia.readBuffer("txtEntry"); // Since we preallocate, we define EOF to be an // empty transaction if (bytes.length == 0) return bytes; if (ia.readByte("EOF") != 'B') { LOG.error("Last transaction was partial."); return null; } return bytes; }catch(EOFException e){} return null; }
[ "public", "static", "byte", "[", "]", "readTxnBytes", "(", "InputArchive", "ia", ")", "throws", "IOException", "{", "try", "{", "byte", "[", "]", "bytes", "=", "ia", ".", "readBuffer", "(", "\"txtEntry\"", ")", ";", "// Since we preallocate, we define EOF to be ...
Reads a transaction entry from the input archive. @param ia archive to read from @return null if the entry is corrupted or EOF has been reached; a buffer (possible empty) containing serialized transaction record. @throws IOException
[ "Reads", "a", "transaction", "entry", "from", "the", "input", "archive", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L231-L245
train
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java
Util.marshallTxnEntry
public static byte[] marshallTxnEntry(TxnHeader hdr, Record txn) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputArchive boa = BinaryOutputArchive.getArchive(baos); hdr.serialize(boa, "hdr"); if (txn != null) { txn.serialize(boa, "txn"); } return baos.toByteArray(); }
java
public static byte[] marshallTxnEntry(TxnHeader hdr, Record txn) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputArchive boa = BinaryOutputArchive.getArchive(baos); hdr.serialize(boa, "hdr"); if (txn != null) { txn.serialize(boa, "txn"); } return baos.toByteArray(); }
[ "public", "static", "byte", "[", "]", "marshallTxnEntry", "(", "TxnHeader", "hdr", ",", "Record", "txn", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "OutputArchive", "boa", "=", "BinaryO...
Serializes transaction header and transaction data into a byte buffer. @param hdr transaction header @param txn transaction data @return serialized transaction record @throws IOException
[ "Serializes", "transaction", "header", "and", "transaction", "data", "into", "a", "byte", "buffer", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L256-L266
train
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java
Util.writeTxnBytes
public static void writeTxnBytes(OutputArchive oa, byte[] bytes) throws IOException { oa.writeBuffer(bytes, "txnEntry"); oa.writeByte((byte) 0x42, "EOR"); // 'B' }
java
public static void writeTxnBytes(OutputArchive oa, byte[] bytes) throws IOException { oa.writeBuffer(bytes, "txnEntry"); oa.writeByte((byte) 0x42, "EOR"); // 'B' }
[ "public", "static", "void", "writeTxnBytes", "(", "OutputArchive", "oa", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "oa", ".", "writeBuffer", "(", "bytes", ",", "\"txnEntry\"", ")", ";", "oa", ".", "writeByte", "(", "(", "byte", "...
Write the serialized transaction record to the output archive. @param oa output archive @param bytes serialized trasnaction record @throws IOException
[ "Write", "the", "serialized", "transaction", "record", "to", "the", "output", "archive", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L275-L279
train
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java
Util.sortDataDir
public static List<File> sortDataDir(File[] files, String prefix, boolean ascending) { if(files==null) return new ArrayList<File>(0); List<File> filelist = Arrays.asList(files); Collections.sort(filelist, new DataDirFileComparator(prefix, ascending)); return filelist; }
java
public static List<File> sortDataDir(File[] files, String prefix, boolean ascending) { if(files==null) return new ArrayList<File>(0); List<File> filelist = Arrays.asList(files); Collections.sort(filelist, new DataDirFileComparator(prefix, ascending)); return filelist; }
[ "public", "static", "List", "<", "File", ">", "sortDataDir", "(", "File", "[", "]", "files", ",", "String", "prefix", ",", "boolean", "ascending", ")", "{", "if", "(", "files", "==", "null", ")", "return", "new", "ArrayList", "<", "File", ">", "(", "...
Sort the list of files. Recency as determined by the version component of the file name. @param files array of files @param prefix files not matching this prefix are assumed to have a version = -1) @param ascending true sorted in ascending order, false results in descending order @return sorted input files
[ "Sort", "the", "list", "of", "files", ".", "Recency", "as", "determined", "by", "the", "version", "component", "of", "the", "file", "name", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L317-L324
train
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/SwapTablesPlanNode.java
SwapTablesPlanNode.diagnoseIndexMismatch
private List<String> diagnoseIndexMismatch(Index theIndex, Index otherIndex) { List<String> mismatchedAttrs = new ArrayList<>(); // Pairs of matching indexes must agree on type (int hash, etc.). if (theIndex.getType() != otherIndex.getType()) { mismatchedAttrs.add("index type (hash vs tree)"); } // Pairs of matching indexes must agree whether they are (assume)unique. if (theIndex.getUnique() != otherIndex.getUnique() || theIndex.getAssumeunique() != otherIndex.getAssumeunique()) { mismatchedAttrs.add("UNIQUE attribute"); } // Pairs of matching indexes must agree whether they are partial // and if so, agree on the predicate. String thePredicateJSON = theIndex.getPredicatejson(); String otherPredicateJSON = otherIndex.getPredicatejson(); if (thePredicateJSON == null) { if (otherPredicateJSON != null) { mismatchedAttrs.add("WHERE predicate"); } } else if ( ! thePredicateJSON.equals(otherPredicateJSON)) { mismatchedAttrs.add("WHERE predicate"); } // Pairs of matching indexes must agree that they do or do not index // expressions and, if so, agree on the expressions. String theExprsJSON = theIndex.getExpressionsjson(); String otherExprsJSON = otherIndex.getExpressionsjson(); if (theExprsJSON == null) { if (otherExprsJSON != null) { mismatchedAttrs.add("indexed expression"); } } else if ( ! theExprsJSON.equals(otherExprsJSON)) { mismatchedAttrs.add("indexed expression"); } // Indexes must agree on the columns they are based on, // identifiable by the columns' order in the table. CatalogMap<ColumnRef> theColumns = theIndex.getColumns(); int theColumnCount = theColumns.size(); CatalogMap<ColumnRef> otherColumns = otherIndex.getColumns(); if (theColumnCount != otherColumns.size() ) { mismatchedAttrs.add("indexed expression"); } Iterator<ColumnRef> theColumnIterator = theColumns.iterator(); Iterator<ColumnRef> otherColumnIterator = otherColumns.iterator(); for (int ii = 0 ;ii < theColumnCount; ++ii) { int theColIndex = theColumnIterator.next().getColumn().getIndex(); int otherColIndex = otherColumnIterator.next().getColumn().getIndex(); if (theColIndex != otherColIndex) { mismatchedAttrs.add("indexed expression"); } } return mismatchedAttrs; }
java
private List<String> diagnoseIndexMismatch(Index theIndex, Index otherIndex) { List<String> mismatchedAttrs = new ArrayList<>(); // Pairs of matching indexes must agree on type (int hash, etc.). if (theIndex.getType() != otherIndex.getType()) { mismatchedAttrs.add("index type (hash vs tree)"); } // Pairs of matching indexes must agree whether they are (assume)unique. if (theIndex.getUnique() != otherIndex.getUnique() || theIndex.getAssumeunique() != otherIndex.getAssumeunique()) { mismatchedAttrs.add("UNIQUE attribute"); } // Pairs of matching indexes must agree whether they are partial // and if so, agree on the predicate. String thePredicateJSON = theIndex.getPredicatejson(); String otherPredicateJSON = otherIndex.getPredicatejson(); if (thePredicateJSON == null) { if (otherPredicateJSON != null) { mismatchedAttrs.add("WHERE predicate"); } } else if ( ! thePredicateJSON.equals(otherPredicateJSON)) { mismatchedAttrs.add("WHERE predicate"); } // Pairs of matching indexes must agree that they do or do not index // expressions and, if so, agree on the expressions. String theExprsJSON = theIndex.getExpressionsjson(); String otherExprsJSON = otherIndex.getExpressionsjson(); if (theExprsJSON == null) { if (otherExprsJSON != null) { mismatchedAttrs.add("indexed expression"); } } else if ( ! theExprsJSON.equals(otherExprsJSON)) { mismatchedAttrs.add("indexed expression"); } // Indexes must agree on the columns they are based on, // identifiable by the columns' order in the table. CatalogMap<ColumnRef> theColumns = theIndex.getColumns(); int theColumnCount = theColumns.size(); CatalogMap<ColumnRef> otherColumns = otherIndex.getColumns(); if (theColumnCount != otherColumns.size() ) { mismatchedAttrs.add("indexed expression"); } Iterator<ColumnRef> theColumnIterator = theColumns.iterator(); Iterator<ColumnRef> otherColumnIterator = otherColumns.iterator(); for (int ii = 0 ;ii < theColumnCount; ++ii) { int theColIndex = theColumnIterator.next().getColumn().getIndex(); int otherColIndex = otherColumnIterator.next().getColumn().getIndex(); if (theColIndex != otherColIndex) { mismatchedAttrs.add("indexed expression"); } } return mismatchedAttrs; }
[ "private", "List", "<", "String", ">", "diagnoseIndexMismatch", "(", "Index", "theIndex", ",", "Index", "otherIndex", ")", "{", "List", "<", "String", ">", "mismatchedAttrs", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Pairs of matching indexes must agree on...
Give two strings, return a list of attributes that do not match @param theIndex @param otherIndex @return list of attributes that do not match
[ "Give", "two", "strings", "return", "a", "list", "of", "attributes", "that", "do", "not", "match" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/SwapTablesPlanNode.java#L354-L415
train
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/SwapTablesPlanNode.java
SwapTablesPlanNode.validateTableCompatibility
private void validateTableCompatibility(String theName, String otherName, Table theTable, Table otherTable, FailureMessage failureMessage) { if (theTable.getIsdred() != otherTable.getIsdred()) { failureMessage.addReason("To swap table " + theName + " with table " + otherName + " both tables must be DR enabled or both tables must not be DR enabled."); } if (theTable.getIsreplicated() != otherTable.getIsreplicated()) { failureMessage.addReason("one table is partitioned and the other is not"); } if (theTable.getTuplelimit() != otherTable.getTuplelimit()) { failureMessage.addReason("the tables differ in the LIMIT PARTITION ROWS constraint"); } if ((theTable.getMaterializer() != null || ! theTable.getMvhandlerinfo().isEmpty()) || (otherTable.getMaterializer() != null || ! otherTable.getMvhandlerinfo().isEmpty())) { failureMessage.addReason("one or both of the tables is actually a view"); } StringBuilder viewNames = new StringBuilder(); if (viewsDependOn(theTable, viewNames)) { failureMessage.addReason(theName + " is referenced in views " + viewNames.toString()); } viewNames.setLength(0); if (viewsDependOn(otherTable, viewNames)) { failureMessage.addReason(otherName + " is referenced in views " + viewNames.toString()); } }
java
private void validateTableCompatibility(String theName, String otherName, Table theTable, Table otherTable, FailureMessage failureMessage) { if (theTable.getIsdred() != otherTable.getIsdred()) { failureMessage.addReason("To swap table " + theName + " with table " + otherName + " both tables must be DR enabled or both tables must not be DR enabled."); } if (theTable.getIsreplicated() != otherTable.getIsreplicated()) { failureMessage.addReason("one table is partitioned and the other is not"); } if (theTable.getTuplelimit() != otherTable.getTuplelimit()) { failureMessage.addReason("the tables differ in the LIMIT PARTITION ROWS constraint"); } if ((theTable.getMaterializer() != null || ! theTable.getMvhandlerinfo().isEmpty()) || (otherTable.getMaterializer() != null || ! otherTable.getMvhandlerinfo().isEmpty())) { failureMessage.addReason("one or both of the tables is actually a view"); } StringBuilder viewNames = new StringBuilder(); if (viewsDependOn(theTable, viewNames)) { failureMessage.addReason(theName + " is referenced in views " + viewNames.toString()); } viewNames.setLength(0); if (viewsDependOn(otherTable, viewNames)) { failureMessage.addReason(otherName + " is referenced in views " + viewNames.toString()); } }
[ "private", "void", "validateTableCompatibility", "(", "String", "theName", ",", "String", "otherName", ",", "Table", "theTable", ",", "Table", "otherTable", ",", "FailureMessage", "failureMessage", ")", "{", "if", "(", "theTable", ".", "getIsdred", "(", ")", "!=...
Flag any issues of incompatibility between the two table operands of a swap by appending error details to a feedback buffer. These details and possibly others should get attached to a PlannerErrorException's message by the caller. @param theName the first argument to the table swap @param otherName the second argument to the tble swap @param theTable the catalog Table definition named by theName @param otherTable the catalog Table definition named by otherName @return the current feedback output separator, it will be == TRUE_FB_SEPARATOR if the feedback buffer is not empty.
[ "Flag", "any", "issues", "of", "incompatibility", "between", "the", "two", "table", "operands", "of", "a", "swap", "by", "appending", "error", "details", "to", "a", "feedback", "buffer", ".", "These", "details", "and", "possibly", "others", "should", "get", ...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/SwapTablesPlanNode.java#L496-L528
train
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/SwapTablesPlanNode.java
SwapTablesPlanNode.validateColumnCompatibility
private void validateColumnCompatibility(String theName, String otherName, Table theTable, Table otherTable, FailureMessage failureMessage) { CatalogMap<Column> theColumns = theTable.getColumns(); int theColCount = theColumns.size(); CatalogMap<Column> otherColumns = otherTable.getColumns(); if (theColCount != otherColumns.size()) { failureMessage.addReason("the tables have different numbers of columns"); return; } Column[] theColArray = new Column[theColumns.size()]; for (Column theColumn : theColumns) { theColArray[theColumn.getIndex()] = theColumn; } for (Column otherColumn : otherColumns) { int colIndex = otherColumn.getIndex(); String colName = otherColumn.getTypeName(); if (colIndex < theColCount) { Column theColumn = theColArray[colIndex]; if (theColumn.getTypeName().equals(colName)) { if (theColumn.getType() != otherColumn.getType() || theColumn.getSize() != otherColumn.getSize() || theColumn.getInbytes() != otherColumn.getInbytes()) { failureMessage.addReason("columns named " + colName + " have different types or sizes"); } continue; } } Column matchedByName = theColumns.get(colName); if (matchedByName != null) { failureMessage.addReason(colName + " is in a different ordinal position in the two tables"); } else { failureMessage.addReason(colName + " appears in " + otherName + " but not in " + theName); } } if ( ! theTable.getIsreplicated() && ! otherTable.getIsreplicated() ) { if (! theTable.getPartitioncolumn().getTypeName().equals( otherTable.getPartitioncolumn().getTypeName())) { failureMessage.addReason("the tables are not partitioned on the same column"); } } }
java
private void validateColumnCompatibility(String theName, String otherName, Table theTable, Table otherTable, FailureMessage failureMessage) { CatalogMap<Column> theColumns = theTable.getColumns(); int theColCount = theColumns.size(); CatalogMap<Column> otherColumns = otherTable.getColumns(); if (theColCount != otherColumns.size()) { failureMessage.addReason("the tables have different numbers of columns"); return; } Column[] theColArray = new Column[theColumns.size()]; for (Column theColumn : theColumns) { theColArray[theColumn.getIndex()] = theColumn; } for (Column otherColumn : otherColumns) { int colIndex = otherColumn.getIndex(); String colName = otherColumn.getTypeName(); if (colIndex < theColCount) { Column theColumn = theColArray[colIndex]; if (theColumn.getTypeName().equals(colName)) { if (theColumn.getType() != otherColumn.getType() || theColumn.getSize() != otherColumn.getSize() || theColumn.getInbytes() != otherColumn.getInbytes()) { failureMessage.addReason("columns named " + colName + " have different types or sizes"); } continue; } } Column matchedByName = theColumns.get(colName); if (matchedByName != null) { failureMessage.addReason(colName + " is in a different ordinal position in the two tables"); } else { failureMessage.addReason(colName + " appears in " + otherName + " but not in " + theName); } } if ( ! theTable.getIsreplicated() && ! otherTable.getIsreplicated() ) { if (! theTable.getPartitioncolumn().getTypeName().equals( otherTable.getPartitioncolumn().getTypeName())) { failureMessage.addReason("the tables are not partitioned on the same column"); } } }
[ "private", "void", "validateColumnCompatibility", "(", "String", "theName", ",", "String", "otherName", ",", "Table", "theTable", ",", "Table", "otherTable", ",", "FailureMessage", "failureMessage", ")", "{", "CatalogMap", "<", "Column", ">", "theColumns", "=", "t...
Flag any issues of incompatibility between the columns of the two table operands of a swap by appending error details to a feedback buffer. These details and possibly others should get attached to a PlannerErrorException's message by the caller. @param theName the first argument to the table swap @param otherName the second argument to the tble swap @param theTable the catalog Table definition named by theName @param otherTable the catalog Table definition named by otherName @return the current feedback output separator, it will be == TRUE_FB_SEPARATOR if the feedback buffer is not empty.
[ "Flag", "any", "issues", "of", "incompatibility", "between", "the", "columns", "of", "the", "two", "table", "operands", "of", "a", "swap", "by", "appending", "error", "details", "to", "a", "feedback", "buffer", ".", "These", "details", "and", "possibly", "ot...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/SwapTablesPlanNode.java#L568-L615
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.growIfNeeded
private final void growIfNeeded(int minimumDesired) { if (buffer.b().remaining() < minimumDesired) { // Compute the size of the new buffer int newCapacity = buffer.b().capacity(); int newRemaining = newCapacity - buffer.b().position(); while (newRemaining < minimumDesired) { newRemaining += newCapacity; newCapacity *= 2; } // Allocate and copy BBContainer next; if (isDirect) { next = DBBPool.allocateDirect(newCapacity); } else { next = DBBPool.wrapBB(ByteBuffer.allocate(newCapacity)); } buffer.b().flip(); next.b().put(buffer.b()); assert next.b().remaining() == newRemaining; buffer.discard(); buffer = next; if (callback != null) callback.onBufferGrow(this); assert(buffer.b().order() == ByteOrder.BIG_ENDIAN); } }
java
private final void growIfNeeded(int minimumDesired) { if (buffer.b().remaining() < minimumDesired) { // Compute the size of the new buffer int newCapacity = buffer.b().capacity(); int newRemaining = newCapacity - buffer.b().position(); while (newRemaining < minimumDesired) { newRemaining += newCapacity; newCapacity *= 2; } // Allocate and copy BBContainer next; if (isDirect) { next = DBBPool.allocateDirect(newCapacity); } else { next = DBBPool.wrapBB(ByteBuffer.allocate(newCapacity)); } buffer.b().flip(); next.b().put(buffer.b()); assert next.b().remaining() == newRemaining; buffer.discard(); buffer = next; if (callback != null) callback.onBufferGrow(this); assert(buffer.b().order() == ByteOrder.BIG_ENDIAN); } }
[ "private", "final", "void", "growIfNeeded", "(", "int", "minimumDesired", ")", "{", "if", "(", "buffer", ".", "b", "(", ")", ".", "remaining", "(", ")", "<", "minimumDesired", ")", "{", "// Compute the size of the new buffer", "int", "newCapacity", "=", "buffe...
Resizes the internal byte buffer with a simple doubling policy, if needed.
[ "Resizes", "the", "internal", "byte", "buffer", "with", "a", "simple", "doubling", "policy", "if", "needed", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L116-L141
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.serialize
public static byte[] serialize(FastSerializable object) throws IOException { FastSerializer out = new FastSerializer(); object.writeExternal(out); return out.getBBContainer().b().array(); }
java
public static byte[] serialize(FastSerializable object) throws IOException { FastSerializer out = new FastSerializer(); object.writeExternal(out); return out.getBBContainer().b().array(); }
[ "public", "static", "byte", "[", "]", "serialize", "(", "FastSerializable", "object", ")", "throws", "IOException", "{", "FastSerializer", "out", "=", "new", "FastSerializer", "(", ")", ";", "object", ".", "writeExternal", "(", "out", ")", ";", "return", "ou...
Get the byte version of object. This is a shortcut utility method when you only need to serialize a single object. @return The byte array representation for <code>object</code>.
[ "Get", "the", "byte", "version", "of", "object", ".", "This", "is", "a", "shortcut", "utility", "method", "when", "you", "only", "need", "to", "serialize", "a", "single", "object", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L149-L153
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.getBytes
public byte[] getBytes() { byte[] retval = new byte[buffer.b().position()]; int position = buffer.b().position(); buffer.b().rewind(); buffer.b().get(retval); assert position == buffer.b().position(); return retval; }
java
public byte[] getBytes() { byte[] retval = new byte[buffer.b().position()]; int position = buffer.b().position(); buffer.b().rewind(); buffer.b().get(retval); assert position == buffer.b().position(); return retval; }
[ "public", "byte", "[", "]", "getBytes", "(", ")", "{", "byte", "[", "]", "retval", "=", "new", "byte", "[", "buffer", ".", "b", "(", ")", ".", "position", "(", ")", "]", ";", "int", "position", "=", "buffer", ".", "b", "(", ")", ".", "position"...
This method is slow and horrible. It entails an extra copy. Don't use it! Ever! Not even for test! Just say no to test only code. It will also leak the BBContainer if this FS is being used with a pool.
[ "This", "method", "is", "slow", "and", "horrible", ".", "It", "entails", "an", "extra", "copy", ".", "Don", "t", "use", "it!", "Ever!", "Not", "even", "for", "test!", "Just", "say", "no", "to", "test", "only", "code", ".", "It", "will", "also", "leak...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L165-L172
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.getBuffer
public ByteBuffer getBuffer() { assert(isDirect == false); assert(buffer.b().hasArray()); assert(!buffer.b().isDirect()); buffer.b().flip(); return buffer.b().asReadOnlyBuffer(); }
java
public ByteBuffer getBuffer() { assert(isDirect == false); assert(buffer.b().hasArray()); assert(!buffer.b().isDirect()); buffer.b().flip(); return buffer.b().asReadOnlyBuffer(); }
[ "public", "ByteBuffer", "getBuffer", "(", ")", "{", "assert", "(", "isDirect", "==", "false", ")", ";", "assert", "(", "buffer", ".", "b", "(", ")", ".", "hasArray", "(", ")", ")", ";", "assert", "(", "!", "buffer", ".", "b", "(", ")", ".", "isDi...
Return a readOnly slice of this buffer. Flips the internal buffer. May not be, usefully, invoked multiple times on the same internal state. Only use this if using a non-direct ByteBuffer!
[ "Return", "a", "readOnly", "slice", "of", "this", "buffer", ".", "Flips", "the", "internal", "buffer", ".", "May", "not", "be", "usefully", "invoked", "multiple", "times", "on", "the", "same", "internal", "state", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L181-L187
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.getHexEncodedBytes
public String getHexEncodedBytes() { buffer.b().flip(); byte bytes[] = new byte[buffer.b().remaining()]; buffer.b().get(bytes); String hex = Encoder.hexEncode(bytes); buffer.discard(); return hex; }
java
public String getHexEncodedBytes() { buffer.b().flip(); byte bytes[] = new byte[buffer.b().remaining()]; buffer.b().get(bytes); String hex = Encoder.hexEncode(bytes); buffer.discard(); return hex; }
[ "public", "String", "getHexEncodedBytes", "(", ")", "{", "buffer", ".", "b", "(", ")", ".", "flip", "(", ")", ";", "byte", "bytes", "[", "]", "=", "new", "byte", "[", "buffer", ".", "b", "(", ")", ".", "remaining", "(", ")", "]", ";", "buffer", ...
Get a ascii-string-safe version of the binary value using a hex encoding. @return A hex-encoded string value representing the serialized objects.
[ "Get", "a", "ascii", "-", "string", "-", "safe", "version", "of", "the", "binary", "value", "using", "a", "hex", "encoding", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L206-L213
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeString
public static void writeString(String string, ByteBuffer buffer) throws IOException { if (string == null) { buffer.putInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = string.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; buffer.putInt(len); buffer.put(strbytes); }
java
public static void writeString(String string, ByteBuffer buffer) throws IOException { if (string == null) { buffer.putInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = string.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; buffer.putInt(len); buffer.put(strbytes); }
[ "public", "static", "void", "writeString", "(", "String", "string", ",", "ByteBuffer", "buffer", ")", "throws", "IOException", "{", "if", "(", "string", "==", "null", ")", "{", "buffer", ".", "putInt", "(", "VoltType", ".", "NULL_STRING_LENGTH", ")", ";", ...
Write a string in the standard VoltDB way without wrapping the byte buffer.
[ "Write", "a", "string", "in", "the", "standard", "VoltDB", "way", "without", "wrapping", "the", "byte", "buffer", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L230-L241
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeString
public void writeString(String string) throws IOException { if (string == null) { writeInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = string.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; writeInt(len); write(strbytes); }
java
public void writeString(String string) throws IOException { if (string == null) { writeInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = string.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; writeInt(len); write(strbytes); }
[ "public", "void", "writeString", "(", "String", "string", ")", "throws", "IOException", "{", "if", "(", "string", "==", "null", ")", "{", "writeInt", "(", "VoltType", ".", "NULL_STRING_LENGTH", ")", ";", "return", ";", "}", "byte", "[", "]", "strbytes", ...
Write a string in the standard VoltDB way. That is, two bytes of length info followed by the bytes of characters encoded in UTF-8. @param string The string value to be serialized. @throws IOException Rethrows any IOExceptions thrown.
[ "Write", "a", "string", "in", "the", "standard", "VoltDB", "way", ".", "That", "is", "two", "bytes", "of", "length", "info", "followed", "by", "the", "bytes", "of", "characters", "encoded", "in", "UTF", "-", "8", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L251-L262
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeVarbinary
public void writeVarbinary(byte[] bin) throws IOException { if (bin == null) { writeInt(VoltType.NULL_STRING_LENGTH); return; } if (bin.length > VoltType.MAX_VALUE_LENGTH) { throw new IOException("Varbinary exceeds maximum length of " + VoltType.MAX_VALUE_LENGTH + " bytes."); } writeInt(bin.length); write(bin); }
java
public void writeVarbinary(byte[] bin) throws IOException { if (bin == null) { writeInt(VoltType.NULL_STRING_LENGTH); return; } if (bin.length > VoltType.MAX_VALUE_LENGTH) { throw new IOException("Varbinary exceeds maximum length of " + VoltType.MAX_VALUE_LENGTH + " bytes."); } writeInt(bin.length); write(bin); }
[ "public", "void", "writeVarbinary", "(", "byte", "[", "]", "bin", ")", "throws", "IOException", "{", "if", "(", "bin", "==", "null", ")", "{", "writeInt", "(", "VoltType", ".", "NULL_STRING_LENGTH", ")", ";", "return", ";", "}", "if", "(", "bin", ".", ...
Write a varbinary in the standard VoltDB way. That is, four bytes of length info followed by the bytes. @param bin The byte array value to be serialized. @throws IOException Rethrows any IOExceptions thrown.
[ "Write", "a", "varbinary", "in", "the", "standard", "VoltDB", "way", ".", "That", "is", "four", "bytes", "of", "length", "info", "followed", "by", "the", "bytes", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L271-L283
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeTable
public void writeTable(VoltTable table) throws IOException { int len = table.getSerializedSize(); growIfNeeded(len); table.flattenToBuffer(buffer.b()); }
java
public void writeTable(VoltTable table) throws IOException { int len = table.getSerializedSize(); growIfNeeded(len); table.flattenToBuffer(buffer.b()); }
[ "public", "void", "writeTable", "(", "VoltTable", "table", ")", "throws", "IOException", "{", "int", "len", "=", "table", ".", "getSerializedSize", "(", ")", ";", "growIfNeeded", "(", "len", ")", ";", "table", ".", "flattenToBuffer", "(", "buffer", ".", "b...
Write a table using it's ByteBuffer serialization code.
[ "Write", "a", "table", "using", "it", "s", "ByteBuffer", "serialization", "code", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L288-L292
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeInvocation
public void writeInvocation(StoredProcedureInvocation invocation) throws IOException { int len = invocation.getSerializedSize(); growIfNeeded(len); invocation.flattenToBuffer(buffer.b()); }
java
public void writeInvocation(StoredProcedureInvocation invocation) throws IOException { int len = invocation.getSerializedSize(); growIfNeeded(len); invocation.flattenToBuffer(buffer.b()); }
[ "public", "void", "writeInvocation", "(", "StoredProcedureInvocation", "invocation", ")", "throws", "IOException", "{", "int", "len", "=", "invocation", ".", "getSerializedSize", "(", ")", ";", "growIfNeeded", "(", "len", ")", ";", "invocation", ".", "flattenToBuf...
Write an SPI using it's ByteBuffer serialization code.
[ "Write", "an", "SPI", "using", "it", "s", "ByteBuffer", "serialization", "code", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L297-L301
train
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeParameterSet
public void writeParameterSet(ParameterSet params) throws IOException { int len = params.getSerializedSize(); growIfNeeded(len); params.flattenToBuffer(buffer.b()); }
java
public void writeParameterSet(ParameterSet params) throws IOException { int len = params.getSerializedSize(); growIfNeeded(len); params.flattenToBuffer(buffer.b()); }
[ "public", "void", "writeParameterSet", "(", "ParameterSet", "params", ")", "throws", "IOException", "{", "int", "len", "=", "params", ".", "getSerializedSize", "(", ")", ";", "growIfNeeded", "(", "len", ")", ";", "params", ".", "flattenToBuffer", "(", "buffer"...
Write a ParameterSet using it's ByteBuffer serialization code.
[ "Write", "a", "ParameterSet", "using", "it", "s", "ByteBuffer", "serialization", "code", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L306-L310
train
VoltDB/voltdb
src/frontend/org/voltcore/network/PicoNetwork.java
PicoNetwork.start
public void start(InputHandler ih, Set<Long> verbotenThreads) { m_ih = ih; m_verbotenThreads = verbotenThreads; startSetup(); m_thread.start(); }
java
public void start(InputHandler ih, Set<Long> verbotenThreads) { m_ih = ih; m_verbotenThreads = verbotenThreads; startSetup(); m_thread.start(); }
[ "public", "void", "start", "(", "InputHandler", "ih", ",", "Set", "<", "Long", ">", "verbotenThreads", ")", "{", "m_ih", "=", "ih", ";", "m_verbotenThreads", "=", "verbotenThreads", ";", "startSetup", "(", ")", ";", "m_thread", ".", "start", "(", ")", ";...
Start this VoltNetwork's thread. populate the verbotenThreads set with the id of the thread that is created
[ "Start", "this", "VoltNetwork", "s", "thread", ".", "populate", "the", "verbotenThreads", "set", "with", "the", "id", "of", "the", "thread", "that", "is", "created" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/network/PicoNetwork.java#L124-L129
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.execute
@Override public boolean execute(String sql) throws SQLException { checkClosed(); VoltSQL query = VoltSQL.parseSQL(sql); return this.execute(query); }
java
@Override public boolean execute(String sql) throws SQLException { checkClosed(); VoltSQL query = VoltSQL.parseSQL(sql); return this.execute(query); }
[ "@", "Override", "public", "boolean", "execute", "(", "String", "sql", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "VoltSQL", "query", "=", "VoltSQL", ".", "parseSQL", "(", "sql", ")", ";", "return", "this", ".", "execute", "(", "qu...
Executes the given SQL statement, which may return multiple results.
[ "Executes", "the", "given", "SQL", "statement", "which", "may", "return", "multiple", "results", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L382-L388
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.execute
@Override public boolean execute(String sql, String[] columnNames) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public boolean execute(String sql, String[] columnNames) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "boolean", "execute", "(", "String", "sql", ",", "String", "[", "]", "columnNames", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
[ "Executes", "the", "given", "SQL", "statement", "which", "may", "return", "multiple", "results", "and", "signals", "the", "driver", "that", "the", "auto", "-", "generated", "keys", "indicated", "in", "the", "given", "array", "should", "be", "made", "available"...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L407-L412
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.executeBatch
@Override public int[] executeBatch() throws SQLException { checkClosed(); closeCurrentResult(); if (batch == null || batch.size() == 0) { return new int[0]; } int[] updateCounts = new int[batch.size()]; // keep a running total of update counts int runningUpdateCount = 0; int i = 0; try { for (; i < batch.size(); i++) { setCurrentResult( null, (int) batch.get(i).execute( sourceConnection.NativeConnection, this.m_timeout, sourceConnection.queryTimeOutUnit)[0].fetchRow( 0).getLong(0)); updateCounts[i] = this.lastUpdateCount; runningUpdateCount += this.lastUpdateCount; } } catch (SQLException x) { updateCounts[i] = EXECUTE_FAILED; throw new BatchUpdateException(Arrays.copyOf(updateCounts, i + 1), x); } finally { clearBatch(); } // replace the update count from the last statement with the update count // from the last batch. this.lastUpdateCount = runningUpdateCount; return updateCounts; }
java
@Override public int[] executeBatch() throws SQLException { checkClosed(); closeCurrentResult(); if (batch == null || batch.size() == 0) { return new int[0]; } int[] updateCounts = new int[batch.size()]; // keep a running total of update counts int runningUpdateCount = 0; int i = 0; try { for (; i < batch.size(); i++) { setCurrentResult( null, (int) batch.get(i).execute( sourceConnection.NativeConnection, this.m_timeout, sourceConnection.queryTimeOutUnit)[0].fetchRow( 0).getLong(0)); updateCounts[i] = this.lastUpdateCount; runningUpdateCount += this.lastUpdateCount; } } catch (SQLException x) { updateCounts[i] = EXECUTE_FAILED; throw new BatchUpdateException(Arrays.copyOf(updateCounts, i + 1), x); } finally { clearBatch(); } // replace the update count from the last statement with the update count // from the last batch. this.lastUpdateCount = runningUpdateCount; return updateCounts; }
[ "@", "Override", "public", "int", "[", "]", "executeBatch", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "closeCurrentResult", "(", ")", ";", "if", "(", "batch", "==", "null", "||", "batch", ".", "size", "(", ")", "==", "0", ...
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
[ "Submits", "a", "batch", "of", "commands", "to", "the", "database", "for", "execution", "and", "if", "all", "commands", "execute", "successfully", "returns", "an", "array", "of", "update", "counts", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L415-L454
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.executeQuery
@Override public ResultSet executeQuery(String sql) throws SQLException { checkClosed(); VoltSQL query = VoltSQL.parseSQL(sql); if (!query.isOfType(VoltSQL.TYPE_SELECT)) { throw SQLError.get(SQLError.ILLEGAL_STATEMENT, sql); } return this.executeQuery(query); }
java
@Override public ResultSet executeQuery(String sql) throws SQLException { checkClosed(); VoltSQL query = VoltSQL.parseSQL(sql); if (!query.isOfType(VoltSQL.TYPE_SELECT)) { throw SQLError.get(SQLError.ILLEGAL_STATEMENT, sql); } return this.executeQuery(query); }
[ "@", "Override", "public", "ResultSet", "executeQuery", "(", "String", "sql", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "VoltSQL", "query", "=", "VoltSQL", ".", "parseSQL", "(", "sql", ")", ";", "if", "(", "!", "query", ".", "isOf...
Executes the given SQL statement, which returns a single ResultSet object.
[ "Executes", "the", "given", "SQL", "statement", "which", "returns", "a", "single", "ResultSet", "object", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L463-L472
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.setFetchDirection
@Override public void setFetchDirection(int direction) throws SQLException { checkClosed(); if ((direction != ResultSet.FETCH_FORWARD) && (direction != ResultSet.FETCH_REVERSE) && (direction != ResultSet.FETCH_UNKNOWN)) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, direction); } this.fetchDirection = direction; }
java
@Override public void setFetchDirection(int direction) throws SQLException { checkClosed(); if ((direction != ResultSet.FETCH_FORWARD) && (direction != ResultSet.FETCH_REVERSE) && (direction != ResultSet.FETCH_UNKNOWN)) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, direction); } this.fetchDirection = direction; }
[ "@", "Override", "public", "void", "setFetchDirection", "(", "int", "direction", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "if", "(", "(", "direction", "!=", "ResultSet", ".", "FETCH_FORWARD", ")", "&&", "(", "direction", "!=", "Resul...
Gives the driver a hint as to the direction in which rows will be processed in ResultSet objects created using this Statement object.
[ "Gives", "the", "driver", "a", "hint", "as", "to", "the", "direction", "in", "which", "rows", "will", "be", "processed", "in", "ResultSet", "objects", "created", "using", "this", "Statement", "object", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L700-L708
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.setFetchSize
@Override public void setFetchSize(int rows) throws SQLException { checkClosed(); if (rows < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, rows); } this.fetchSize = rows; }
java
@Override public void setFetchSize(int rows) throws SQLException { checkClosed(); if (rows < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, rows); } this.fetchSize = rows; }
[ "@", "Override", "public", "void", "setFetchSize", "(", "int", "rows", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "if", "(", "rows", "<", "0", ")", "{", "throw", "SQLError", ".", "get", "(", "SQLError", ".", "ILLEGAL_ARGUMENT", ","...
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for ResultSet objects genrated by this Statement.
[ "Gives", "the", "JDBC", "driver", "a", "hint", "as", "to", "the", "number", "of", "rows", "that", "should", "be", "fetched", "from", "the", "database", "when", "more", "rows", "are", "needed", "for", "ResultSet", "objects", "genrated", "by", "this", "State...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L711-L719
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.setMaxFieldSize
@Override public void setMaxFieldSize(int max) throws SQLException { checkClosed(); if (max < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, max); } throw SQLError.noSupport(); // Not supported by provider - no point trashing data we received from the server just to simulate the feature while not getting any gains! }
java
@Override public void setMaxFieldSize(int max) throws SQLException { checkClosed(); if (max < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, max); } throw SQLError.noSupport(); // Not supported by provider - no point trashing data we received from the server just to simulate the feature while not getting any gains! }
[ "@", "Override", "public", "void", "setMaxFieldSize", "(", "int", "max", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "if", "(", "max", "<", "0", ")", "{", "throw", "SQLError", ".", "get", "(", "SQLError", ".", "ILLEGAL_ARGUMENT", ",...
Sets the limit for the maximum number of bytes that can be returned for character and binary column values in a ResultSet object produced by this Statement object.
[ "Sets", "the", "limit", "for", "the", "maximum", "number", "of", "bytes", "that", "can", "be", "returned", "for", "character", "and", "binary", "column", "values", "in", "a", "ResultSet", "object", "produced", "by", "this", "Statement", "object", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L722-L730
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.setMaxRows
@Override public void setMaxRows(int max) throws SQLException { checkClosed(); if (max < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, max); } this.maxRows = max; }
java
@Override public void setMaxRows(int max) throws SQLException { checkClosed(); if (max < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, max); } this.maxRows = max; }
[ "@", "Override", "public", "void", "setMaxRows", "(", "int", "max", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "if", "(", "max", "<", "0", ")", "{", "throw", "SQLError", ".", "get", "(", "SQLError", ".", "ILLEGAL_ARGUMENT", ",", ...
Sets the limit for the maximum number of rows that any ResultSet object generated by this Statement object can contain to the given number.
[ "Sets", "the", "limit", "for", "the", "maximum", "number", "of", "rows", "that", "any", "ResultSet", "object", "generated", "by", "this", "Statement", "object", "can", "contain", "to", "the", "given", "number", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L733-L741
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.setQueryTimeout
@Override public void setQueryTimeout(int seconds) throws SQLException { checkClosed(); if (seconds < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, seconds); } if (seconds == 0) { this.m_timeout = Integer.MAX_VALUE; } else { this.m_timeout = seconds; } }
java
@Override public void setQueryTimeout(int seconds) throws SQLException { checkClosed(); if (seconds < 0) { throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, seconds); } if (seconds == 0) { this.m_timeout = Integer.MAX_VALUE; } else { this.m_timeout = seconds; } }
[ "@", "Override", "public", "void", "setQueryTimeout", "(", "int", "seconds", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "if", "(", "seconds", "<", "0", ")", "{", "throw", "SQLError", ".", "get", "(", "SQLError", ".", "ILLEGAL_ARGUMEN...
0 is infinite in our case its Integer.MAX_VALUE
[ "0", "is", "infinite", "in", "our", "case", "its", "Integer", ".", "MAX_VALUE" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L753-L765
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/SpInitiator.java
SpInitiator.updateReplicasForJoin
public void updateReplicasForJoin(TransactionState snapshotTransactionState) { long[] replicasAdded = new long[0]; if (m_term != null) { replicasAdded = ((SpTerm) m_term).updateReplicas(snapshotTransactionState); } m_scheduler.forwardPendingTaskToRejoinNode(replicasAdded, snapshotTransactionState.m_spHandle); }
java
public void updateReplicasForJoin(TransactionState snapshotTransactionState) { long[] replicasAdded = new long[0]; if (m_term != null) { replicasAdded = ((SpTerm) m_term).updateReplicas(snapshotTransactionState); } m_scheduler.forwardPendingTaskToRejoinNode(replicasAdded, snapshotTransactionState.m_spHandle); }
[ "public", "void", "updateReplicasForJoin", "(", "TransactionState", "snapshotTransactionState", ")", "{", "long", "[", "]", "replicasAdded", "=", "new", "long", "[", "0", "]", ";", "if", "(", "m_term", "!=", "null", ")", "{", "replicasAdded", "=", "(", "(", ...
This will be called from Snapshot in elastic joining or rejoining cases.
[ "This", "will", "be", "called", "from", "Snapshot", "in", "elastic", "joining", "or", "rejoining", "cases", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/SpInitiator.java#L348-L354
train
VoltDB/voltdb
examples/bank-offers/client/bankoffers/PersonGenerator.java
PersonGenerator.newPerson
public Person newPerson() { Person p = new Person(); p.firstname = firstnames[rand.nextInt(firstnames.length)]; p.lastname = lastnames[rand.nextInt(lastnames.length)]; p.sex = sexes[rand.nextInt(2)]; p.dob = randomDOB(); // state and area code match int i = rand.nextInt(areaCodes.length); p.phonenumber = randomPhone(areaCodes[i]); p.state = states[i]; return p; }
java
public Person newPerson() { Person p = new Person(); p.firstname = firstnames[rand.nextInt(firstnames.length)]; p.lastname = lastnames[rand.nextInt(lastnames.length)]; p.sex = sexes[rand.nextInt(2)]; p.dob = randomDOB(); // state and area code match int i = rand.nextInt(areaCodes.length); p.phonenumber = randomPhone(areaCodes[i]); p.state = states[i]; return p; }
[ "public", "Person", "newPerson", "(", ")", "{", "Person", "p", "=", "new", "Person", "(", ")", ";", "p", ".", "firstname", "=", "firstnames", "[", "rand", ".", "nextInt", "(", "firstnames", ".", "length", ")", "]", ";", "p", ".", "lastname", "=", "...
generate a random person
[ "generate", "a", "random", "person" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/bank-offers/client/bankoffers/PersonGenerator.java#L116-L129
train
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/PlanNodeTree.java
PlanNodeTree.loadFromJSONPlan
public void loadFromJSONPlan(JSONObject jobj, Database db) throws JSONException { if (jobj.has(Members.PLAN_NODES_LISTS)) { JSONArray jplanNodesArray = jobj.getJSONArray(Members.PLAN_NODES_LISTS); for (int i = 0; i < jplanNodesArray.length(); ++i) { JSONObject jplanNodesObj = jplanNodesArray.getJSONObject(i); JSONArray jplanNodes = jplanNodesObj.getJSONArray(Members.PLAN_NODES); int stmtId = jplanNodesObj.getInt(Members.STATEMENT_ID); loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db); } } else { // There is only one statement in the plan. Its id is set to 0 by default int stmtId = 0; JSONArray jplanNodes = jobj.getJSONArray(Members.PLAN_NODES); loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db); } // Connect the parent and child statements for (List<AbstractPlanNode> nextPlanNodes : m_planNodesListMap.values()) { for (AbstractPlanNode node : nextPlanNodes) { connectNodesIfNecessary(node); } } }
java
public void loadFromJSONPlan(JSONObject jobj, Database db) throws JSONException { if (jobj.has(Members.PLAN_NODES_LISTS)) { JSONArray jplanNodesArray = jobj.getJSONArray(Members.PLAN_NODES_LISTS); for (int i = 0; i < jplanNodesArray.length(); ++i) { JSONObject jplanNodesObj = jplanNodesArray.getJSONObject(i); JSONArray jplanNodes = jplanNodesObj.getJSONArray(Members.PLAN_NODES); int stmtId = jplanNodesObj.getInt(Members.STATEMENT_ID); loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db); } } else { // There is only one statement in the plan. Its id is set to 0 by default int stmtId = 0; JSONArray jplanNodes = jobj.getJSONArray(Members.PLAN_NODES); loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db); } // Connect the parent and child statements for (List<AbstractPlanNode> nextPlanNodes : m_planNodesListMap.values()) { for (AbstractPlanNode node : nextPlanNodes) { connectNodesIfNecessary(node); } } }
[ "public", "void", "loadFromJSONPlan", "(", "JSONObject", "jobj", ",", "Database", "db", ")", "throws", "JSONException", "{", "if", "(", "jobj", ".", "has", "(", "Members", ".", "PLAN_NODES_LISTS", ")", ")", "{", "JSONArray", "jplanNodesArray", "=", "jobj", "...
Load json plan. The plan must have either "PLAN_NODE" array in case of a statement without subqueries or "PLAN_NODES_LISTS" array of "PLAN_NODE" arrays for each sub statement. @param jobj @param db @throws JSONException
[ "Load", "json", "plan", ".", "The", "plan", "must", "have", "either", "PLAN_NODE", "array", "in", "case", "of", "a", "statement", "without", "subqueries", "or", "PLAN_NODES_LISTS", "array", "of", "PLAN_NODE", "arrays", "for", "each", "sub", "statement", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/PlanNodeTree.java#L133-L156
train
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/PlanNodeTree.java
PlanNodeTree.loadPlanNodesFromJSONArrays
private void loadPlanNodesFromJSONArrays(int stmtId, JSONArray jArray, Database db) { List<AbstractPlanNode> planNodes = new ArrayList<>(); int size = jArray.length(); try { for (int i = 0; i < size; i++) { JSONObject jobj = jArray.getJSONObject(i); String nodeTypeStr = jobj.getString("PLAN_NODE_TYPE"); PlanNodeType nodeType = PlanNodeType.get(nodeTypeStr); AbstractPlanNode apn = nodeType.getPlanNodeClass().newInstance(); apn.loadFromJSONObject(jobj, db); planNodes.add(apn); } //link children and parents for (int i = 0; i < size; i++) { JSONObject jobj = jArray.getJSONObject(i); if (jobj.has("CHILDREN_IDS")) { AbstractPlanNode parent = planNodes.get(i); JSONArray children = jobj.getJSONArray("CHILDREN_IDS"); for (int j = 0; j < children.length(); j++) { AbstractPlanNode child = getNodeofId(children.getInt(j), planNodes); parent.addAndLinkChild(child); } } } m_planNodesListMap.put(stmtId, planNodes); } catch (JSONException | InstantiationException | IllegalAccessException e) { System.err.println(e); e.printStackTrace(); } }
java
private void loadPlanNodesFromJSONArrays(int stmtId, JSONArray jArray, Database db) { List<AbstractPlanNode> planNodes = new ArrayList<>(); int size = jArray.length(); try { for (int i = 0; i < size; i++) { JSONObject jobj = jArray.getJSONObject(i); String nodeTypeStr = jobj.getString("PLAN_NODE_TYPE"); PlanNodeType nodeType = PlanNodeType.get(nodeTypeStr); AbstractPlanNode apn = nodeType.getPlanNodeClass().newInstance(); apn.loadFromJSONObject(jobj, db); planNodes.add(apn); } //link children and parents for (int i = 0; i < size; i++) { JSONObject jobj = jArray.getJSONObject(i); if (jobj.has("CHILDREN_IDS")) { AbstractPlanNode parent = planNodes.get(i); JSONArray children = jobj.getJSONArray("CHILDREN_IDS"); for (int j = 0; j < children.length(); j++) { AbstractPlanNode child = getNodeofId(children.getInt(j), planNodes); parent.addAndLinkChild(child); } } } m_planNodesListMap.put(stmtId, planNodes); } catch (JSONException | InstantiationException | IllegalAccessException e) { System.err.println(e); e.printStackTrace(); } }
[ "private", "void", "loadPlanNodesFromJSONArrays", "(", "int", "stmtId", ",", "JSONArray", "jArray", ",", "Database", "db", ")", "{", "List", "<", "AbstractPlanNode", ">", "planNodes", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "size", "=", "jArray"...
Load plan nodes from the "PLAN_NODE" array. All the nodes are from a substatement with the id = stmtId @param stmtId @param jArray - PLAN_NODES @param db @throws JSONException
[ "Load", "plan", "nodes", "from", "the", "PLAN_NODE", "array", ".", "All", "the", "nodes", "are", "from", "a", "substatement", "with", "the", "id", "=", "stmtId" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/PlanNodeTree.java#L255-L287
train
VoltDB/voltdb
src/frontend/org/voltdb/importer/ImporterLifeCycleManager.java
ImporterLifeCycleManager.configure
public final void configure(Properties props, FormatterBuilder formatterBuilder) { Map<URI, ImporterConfig> configs = m_factory.createImporterConfigurations(props, formatterBuilder); m_configs = new ImmutableMap.Builder<URI, ImporterConfig>() .putAll(configs) .putAll(Maps.filterKeys(m_configs, not(in(configs.keySet())))) .build(); }
java
public final void configure(Properties props, FormatterBuilder formatterBuilder) { Map<URI, ImporterConfig> configs = m_factory.createImporterConfigurations(props, formatterBuilder); m_configs = new ImmutableMap.Builder<URI, ImporterConfig>() .putAll(configs) .putAll(Maps.filterKeys(m_configs, not(in(configs.keySet())))) .build(); }
[ "public", "final", "void", "configure", "(", "Properties", "props", ",", "FormatterBuilder", "formatterBuilder", ")", "{", "Map", "<", "URI", ",", "ImporterConfig", ">", "configs", "=", "m_factory", ".", "createImporterConfigurations", "(", "props", ",", "formatte...
This will be called for every importer configuration section for this importer type. @param props Properties defined in a configuration section for this importer
[ "This", "will", "be", "called", "for", "every", "importer", "configuration", "section", "for", "this", "importer", "type", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/ImporterLifeCycleManager.java#L85-L92
train
VoltDB/voltdb
src/frontend/org/voltdb/importer/ImporterLifeCycleManager.java
ImporterLifeCycleManager.stop
public final void stop() { m_stopping = true; ImmutableMap<URI, AbstractImporter> oldReference; boolean success = false; do { // onChange also could set m_importers. Use while loop to pick up latest ref oldReference = m_importers.get(); success = m_importers.compareAndSet(oldReference, ImmutableMap.<URI, AbstractImporter> of()); } while (!success); if (!m_starting.get()) return; stopImporters(oldReference.values()); if (!m_factory.isImporterRunEveryWhere()) { m_distributer.registerChannels(m_distributerDesignation, Collections.<URI> emptySet()); m_distributer.unregisterCallback(m_distributerDesignation); } if (m_executorService == null) { return; } //graceful shutdown to allow importers to properly process post shutdown tasks. m_executorService.shutdown(); try { m_executorService.awaitTermination(60, TimeUnit.SECONDS); m_executorService = null; } catch (InterruptedException ex) { //Should never come here. s_logger.warn("Unexpected interrupted exception waiting for " + m_factory.getTypeName() + " to shutdown", ex); } }
java
public final void stop() { m_stopping = true; ImmutableMap<URI, AbstractImporter> oldReference; boolean success = false; do { // onChange also could set m_importers. Use while loop to pick up latest ref oldReference = m_importers.get(); success = m_importers.compareAndSet(oldReference, ImmutableMap.<URI, AbstractImporter> of()); } while (!success); if (!m_starting.get()) return; stopImporters(oldReference.values()); if (!m_factory.isImporterRunEveryWhere()) { m_distributer.registerChannels(m_distributerDesignation, Collections.<URI> emptySet()); m_distributer.unregisterCallback(m_distributerDesignation); } if (m_executorService == null) { return; } //graceful shutdown to allow importers to properly process post shutdown tasks. m_executorService.shutdown(); try { m_executorService.awaitTermination(60, TimeUnit.SECONDS); m_executorService = null; } catch (InterruptedException ex) { //Should never come here. s_logger.warn("Unexpected interrupted exception waiting for " + m_factory.getTypeName() + " to shutdown", ex); } }
[ "public", "final", "void", "stop", "(", ")", "{", "m_stopping", "=", "true", ";", "ImmutableMap", "<", "URI", ",", "AbstractImporter", ">", "oldReference", ";", "boolean", "success", "=", "false", ";", "do", "{", "// onChange also could set m_importers. Use while ...
This is called by the importer framework to stop importers. All resources for this importer will be unregistered from the resource distributer.
[ "This", "is", "called", "by", "the", "importer", "framework", "to", "stop", "importers", ".", "All", "resources", "for", "this", "importer", "will", "be", "unregistered", "from", "the", "resource", "distributer", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/ImporterLifeCycleManager.java#L251-L283
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/DeterminismHash.java
DeterminismHash.get
public int[] get() { int includedHashes = Math.min(m_hashCount, MAX_HASHES_COUNT); int[] retval = new int[includedHashes + HEADER_OFFSET]; System.arraycopy(m_hashes, 0, retval, HEADER_OFFSET, includedHashes); m_inputCRC.update(m_hashCount); m_inputCRC.update(m_catalogVersion); retval[0] = (int) m_inputCRC.getValue(); retval[1] = m_catalogVersion; retval[2] = m_hashCount; return retval; }
java
public int[] get() { int includedHashes = Math.min(m_hashCount, MAX_HASHES_COUNT); int[] retval = new int[includedHashes + HEADER_OFFSET]; System.arraycopy(m_hashes, 0, retval, HEADER_OFFSET, includedHashes); m_inputCRC.update(m_hashCount); m_inputCRC.update(m_catalogVersion); retval[0] = (int) m_inputCRC.getValue(); retval[1] = m_catalogVersion; retval[2] = m_hashCount; return retval; }
[ "public", "int", "[", "]", "get", "(", ")", "{", "int", "includedHashes", "=", "Math", ".", "min", "(", "m_hashCount", ",", "MAX_HASHES_COUNT", ")", ";", "int", "[", "]", "retval", "=", "new", "int", "[", "includedHashes", "+", "HEADER_OFFSET", "]", ";...
Serialize the running hashes to an array and complete the overall hash for the first int value in the array.
[ "Serialize", "the", "running", "hashes", "to", "an", "array", "and", "complete", "the", "overall", "hash", "for", "the", "first", "int", "value", "in", "the", "array", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/DeterminismHash.java#L79-L90
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/DeterminismHash.java
DeterminismHash.offerStatement
public void offerStatement(int stmtHash, int offset, ByteBuffer psetBuffer) { m_inputCRC.update(stmtHash); m_inputCRC.updateFromPosition(offset, psetBuffer); if (m_hashCount < MAX_HASHES_COUNT) { m_hashes[m_hashCount] = stmtHash; m_hashes[m_hashCount + 1] = (int) m_inputCRC.getValue(); } m_hashCount += 2; }
java
public void offerStatement(int stmtHash, int offset, ByteBuffer psetBuffer) { m_inputCRC.update(stmtHash); m_inputCRC.updateFromPosition(offset, psetBuffer); if (m_hashCount < MAX_HASHES_COUNT) { m_hashes[m_hashCount] = stmtHash; m_hashes[m_hashCount + 1] = (int) m_inputCRC.getValue(); } m_hashCount += 2; }
[ "public", "void", "offerStatement", "(", "int", "stmtHash", ",", "int", "offset", ",", "ByteBuffer", "psetBuffer", ")", "{", "m_inputCRC", ".", "update", "(", "stmtHash", ")", ";", "m_inputCRC", ".", "updateFromPosition", "(", "offset", ",", "psetBuffer", ")",...
Update the overall hash. Add a pair of ints to the array if the size isn't too large.
[ "Update", "the", "overall", "hash", ".", "Add", "a", "pair", "of", "ints", "to", "the", "array", "if", "the", "size", "isn", "t", "too", "large", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/DeterminismHash.java#L96-L105
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/DeterminismHash.java
DeterminismHash.compareHashes
public static int compareHashes(int[] leftHashes, int[] rightHashes) { assert(leftHashes != null); assert(rightHashes != null); assert(leftHashes.length >= 3); assert(rightHashes.length >= 3); // Compare total checksum first if (leftHashes[0] == rightHashes[0]) { return -1; } int includedHashLeft = Math.min(leftHashes[2], MAX_HASHES_COUNT); int includedHashRight = Math.min(rightHashes[2], MAX_HASHES_COUNT); int includedHashMin = Math.min(includedHashLeft, includedHashRight); int pos = 0; for(int i = HEADER_OFFSET ; i < HEADER_OFFSET + includedHashMin; i += 2) { if(leftHashes[i] != rightHashes[i] || leftHashes[i + 1] != rightHashes[i + 1]) { return pos; } pos++; } // If the number of per-statement hashes is more than MAX_HASHES_COUNT and // the mismatched hash isn't included in the per-statement hashes return HASH_NOT_INCLUDE; }
java
public static int compareHashes(int[] leftHashes, int[] rightHashes) { assert(leftHashes != null); assert(rightHashes != null); assert(leftHashes.length >= 3); assert(rightHashes.length >= 3); // Compare total checksum first if (leftHashes[0] == rightHashes[0]) { return -1; } int includedHashLeft = Math.min(leftHashes[2], MAX_HASHES_COUNT); int includedHashRight = Math.min(rightHashes[2], MAX_HASHES_COUNT); int includedHashMin = Math.min(includedHashLeft, includedHashRight); int pos = 0; for(int i = HEADER_OFFSET ; i < HEADER_OFFSET + includedHashMin; i += 2) { if(leftHashes[i] != rightHashes[i] || leftHashes[i + 1] != rightHashes[i + 1]) { return pos; } pos++; } // If the number of per-statement hashes is more than MAX_HASHES_COUNT and // the mismatched hash isn't included in the per-statement hashes return HASH_NOT_INCLUDE; }
[ "public", "static", "int", "compareHashes", "(", "int", "[", "]", "leftHashes", ",", "int", "[", "]", "rightHashes", ")", "{", "assert", "(", "leftHashes", "!=", "null", ")", ";", "assert", "(", "rightHashes", "!=", "null", ")", ";", "assert", "(", "le...
Compare two hash arrays return true if the same. For now, just compares first integer value in array.
[ "Compare", "two", "hash", "arrays", "return", "true", "if", "the", "same", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/DeterminismHash.java#L112-L135
train
VoltDB/voltdb
src/frontend/org/voltdb/iv2/DeterminismHash.java
DeterminismHash.description
public static String description(int[] hashes, int m_hashMismatchPos) { assert(hashes != null); assert(hashes.length >= 3); StringBuilder sb = new StringBuilder(); sb.append("Full Hash ").append(hashes[0]); sb.append(", Catalog Version ").append(hashes[1]); sb.append(", Statement Count ").append(hashes[2] / 2); int includedHashes = Math.min(hashes[2], MAX_HASHES_COUNT); int pos = 0; for (int i = HEADER_OFFSET; i < HEADER_OFFSET + includedHashes; i += 2) { sb.append("\n Ran Statement ").append(hashes[i]); sb.append(" with Parameters ").append(hashes[i + 1]); if(pos == m_hashMismatchPos) { sb.append(" <--- ALERT: Hash mismatch starts from here!"); } pos++; } if (hashes[2] > MAX_HASHES_COUNT) { sb.append("\n Additional SQL statements truncated."); if (m_hashMismatchPos == DeterminismHash.HASH_NOT_INCLUDE) { sb.append("\n The mismatched hash is also truncated. " + "For debugging purpose, use VOLTDB_OPTS=\"-DMAX_STATEMENTS_WITH_DETAIL=<hashcount>\" to set to a higher value, " + "it could impact performance."); } } return sb.toString(); }
java
public static String description(int[] hashes, int m_hashMismatchPos) { assert(hashes != null); assert(hashes.length >= 3); StringBuilder sb = new StringBuilder(); sb.append("Full Hash ").append(hashes[0]); sb.append(", Catalog Version ").append(hashes[1]); sb.append(", Statement Count ").append(hashes[2] / 2); int includedHashes = Math.min(hashes[2], MAX_HASHES_COUNT); int pos = 0; for (int i = HEADER_OFFSET; i < HEADER_OFFSET + includedHashes; i += 2) { sb.append("\n Ran Statement ").append(hashes[i]); sb.append(" with Parameters ").append(hashes[i + 1]); if(pos == m_hashMismatchPos) { sb.append(" <--- ALERT: Hash mismatch starts from here!"); } pos++; } if (hashes[2] > MAX_HASHES_COUNT) { sb.append("\n Additional SQL statements truncated."); if (m_hashMismatchPos == DeterminismHash.HASH_NOT_INCLUDE) { sb.append("\n The mismatched hash is also truncated. " + "For debugging purpose, use VOLTDB_OPTS=\"-DMAX_STATEMENTS_WITH_DETAIL=<hashcount>\" to set to a higher value, " + "it could impact performance."); } } return sb.toString(); }
[ "public", "static", "String", "description", "(", "int", "[", "]", "hashes", ",", "int", "m_hashMismatchPos", ")", "{", "assert", "(", "hashes", "!=", "null", ")", ";", "assert", "(", "hashes", ".", "length", ">=", "3", ")", ";", "StringBuilder", "sb", ...
Log the contents of the hash array
[ "Log", "the", "contents", "of", "the", "hash", "array" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/DeterminismHash.java#L140-L168
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/FileUtil.java
FileUtil.renameOverwrite
private boolean renameOverwrite(String oldname, String newname) { boolean deleted = delete(newname); if (exists(oldname)) { File file = new File(oldname); return file.renameTo(new File(newname)); } return deleted; }
java
private boolean renameOverwrite(String oldname, String newname) { boolean deleted = delete(newname); if (exists(oldname)) { File file = new File(oldname); return file.renameTo(new File(newname)); } return deleted; }
[ "private", "boolean", "renameOverwrite", "(", "String", "oldname", ",", "String", "newname", ")", "{", "boolean", "deleted", "=", "delete", "(", "newname", ")", ";", "if", "(", "exists", "(", "oldname", ")", ")", "{", "File", "file", "=", "new", "File", ...
Rename the file with oldname to newname. If a file with newname already exists, it is deleted before the renaming operation proceeds. If a file with oldname does not exist, no file will exist after the operation.
[ "Rename", "the", "file", "with", "oldname", "to", "newname", ".", "If", "a", "file", "with", "newname", "already", "exists", "it", "is", "deleted", "before", "the", "renaming", "operation", "proceeds", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/FileUtil.java#L169-L180
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/FileUtil.java
FileUtil.canonicalOrAbsolutePath
public String canonicalOrAbsolutePath(String path) { try { return canonicalPath(path); } catch (Exception e) { return absolutePath(path); } }
java
public String canonicalOrAbsolutePath(String path) { try { return canonicalPath(path); } catch (Exception e) { return absolutePath(path); } }
[ "public", "String", "canonicalOrAbsolutePath", "(", "String", "path", ")", "{", "try", "{", "return", "canonicalPath", "(", "path", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "absolutePath", "(", "path", ")", ";", "}", "}" ]
Retrieves the canonical path for the given path, or the absolute path if attemting to retrieve the canonical path fails. @param path the path for which to retrieve the canonical or absolute path @return the canonical or absolute path
[ "Retrieves", "the", "canonical", "path", "for", "the", "given", "path", "or", "the", "absolute", "path", "if", "attemting", "to", "retrieve", "the", "canonical", "path", "fails", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/FileUtil.java#L253-L260
train
VoltDB/voltdb
src/frontend/org/voltdb/StatementStats.java
StatementStats.isCoordinatorStatsUsable
private boolean isCoordinatorStatsUsable(boolean incremental) { if (m_coordinatorTask == null) { return false; } if (incremental) { return m_coordinatorTask.m_timedInvocations - m_coordinatorTask.m_lastTimedInvocations > 0; } return m_coordinatorTask.m_timedInvocations > 0; }
java
private boolean isCoordinatorStatsUsable(boolean incremental) { if (m_coordinatorTask == null) { return false; } if (incremental) { return m_coordinatorTask.m_timedInvocations - m_coordinatorTask.m_lastTimedInvocations > 0; } return m_coordinatorTask.m_timedInvocations > 0; }
[ "private", "boolean", "isCoordinatorStatsUsable", "(", "boolean", "incremental", ")", "{", "if", "(", "m_coordinatorTask", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "incremental", ")", "{", "return", "m_coordinatorTask", ".", "m_timedInvoca...
if any coordinator task is executed at all.
[ "if", "any", "coordinator", "task", "is", "executed", "at", "all", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StatementStats.java#L47-L55
train
VoltDB/voltdb
src/frontend/org/voltdb/StatementStats.java
StatementStats.getIncrementalMinResultSizeAndReset
public int getIncrementalMinResultSizeAndReset() { int retval = m_workerTask.m_incrMinResultSize; m_workerTask.m_incrMinResultSize = Integer.MAX_VALUE; if (isCoordinatorStatsUsable(true)) { m_coordinatorTask.m_incrMinResultSize = Integer.MAX_VALUE; } return retval; }
java
public int getIncrementalMinResultSizeAndReset() { int retval = m_workerTask.m_incrMinResultSize; m_workerTask.m_incrMinResultSize = Integer.MAX_VALUE; if (isCoordinatorStatsUsable(true)) { m_coordinatorTask.m_incrMinResultSize = Integer.MAX_VALUE; } return retval; }
[ "public", "int", "getIncrementalMinResultSizeAndReset", "(", ")", "{", "int", "retval", "=", "m_workerTask", ".", "m_incrMinResultSize", ";", "m_workerTask", ".", "m_incrMinResultSize", "=", "Integer", ".", "MAX_VALUE", ";", "if", "(", "isCoordinatorStatsUsable", "(",...
The result size should be taken from the final output, coming from the coordinator task.
[ "The", "result", "size", "should", "be", "taken", "from", "the", "final", "output", "coming", "from", "the", "coordinator", "task", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StatementStats.java#L178-L185
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.compileAlterTableDropTTL
private Statement compileAlterTableDropTTL(Table t) { if (t.getTTL() == null) { throw Error.error(ErrorCode.X_42501); } if (!StringUtil.isEmpty(t.getTTL().migrationTarget)) { throw unexpectedToken("May not drop migration target"); } Object[] args = new Object[] { t.getName(), Integer.valueOf(SchemaObject.CONSTRAINT), Boolean.valueOf(false), Boolean.valueOf(false) }; return new StatementSchema(null, StatementTypes.DROP_TTL, args, null, t.getName()); }
java
private Statement compileAlterTableDropTTL(Table t) { if (t.getTTL() == null) { throw Error.error(ErrorCode.X_42501); } if (!StringUtil.isEmpty(t.getTTL().migrationTarget)) { throw unexpectedToken("May not drop migration target"); } Object[] args = new Object[] { t.getName(), Integer.valueOf(SchemaObject.CONSTRAINT), Boolean.valueOf(false), Boolean.valueOf(false) }; return new StatementSchema(null, StatementTypes.DROP_TTL, args, null, t.getName()); }
[ "private", "Statement", "compileAlterTableDropTTL", "(", "Table", "t", ")", "{", "if", "(", "t", ".", "getTTL", "(", ")", "==", "null", ")", "{", "throw", "Error", ".", "error", "(", "ErrorCode", ".", "X_42501", ")", ";", "}", "if", "(", "!", "String...
VoltDB extension, drop TTL
[ "VoltDB", "extension", "drop", "TTL" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L996-L1010
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.compileTriggerSetStatement
StatementDMQL compileTriggerSetStatement(Table table, RangeVariable[] rangeVars) { read(); Expression[] updateExpressions; int[] columnMap; OrderedHashSet colNames = new OrderedHashSet(); HsqlArrayList exprList = new HsqlArrayList(); RangeVariable[] targetRangeVars = new RangeVariable[]{ rangeVars[TriggerDef.NEW_ROW] }; readSetClauseList(targetRangeVars, colNames, exprList); columnMap = table.getColumnIndexes(colNames); updateExpressions = new Expression[exprList.size()]; exprList.toArray(updateExpressions); resolveUpdateExpressions(table, rangeVars, columnMap, updateExpressions, RangeVariable.emptyArray); StatementDMQL cs = new StatementDML(session, table, rangeVars, columnMap, updateExpressions, compileContext); return cs; }
java
StatementDMQL compileTriggerSetStatement(Table table, RangeVariable[] rangeVars) { read(); Expression[] updateExpressions; int[] columnMap; OrderedHashSet colNames = new OrderedHashSet(); HsqlArrayList exprList = new HsqlArrayList(); RangeVariable[] targetRangeVars = new RangeVariable[]{ rangeVars[TriggerDef.NEW_ROW] }; readSetClauseList(targetRangeVars, colNames, exprList); columnMap = table.getColumnIndexes(colNames); updateExpressions = new Expression[exprList.size()]; exprList.toArray(updateExpressions); resolveUpdateExpressions(table, rangeVars, columnMap, updateExpressions, RangeVariable.emptyArray); StatementDMQL cs = new StatementDML(session, table, rangeVars, columnMap, updateExpressions, compileContext); return cs; }
[ "StatementDMQL", "compileTriggerSetStatement", "(", "Table", "table", ",", "RangeVariable", "[", "]", "rangeVars", ")", "{", "read", "(", ")", ";", "Expression", "[", "]", "updateExpressions", ";", "int", "[", "]", "columnMap", ";", "OrderedHashSet", "colNames",...
Creates SET Statement for a trigger row from this parse context.
[ "Creates", "SET", "Statement", "for", "a", "trigger", "row", "from", "this", "parse", "context", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L2875-L2901
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.readColumnDefinitionOrNull
ColumnSchema readColumnDefinitionOrNull(Table table, HsqlName hsqlName, HsqlArrayList constraintList) { boolean isIdentity = false; boolean isPKIdentity = false; boolean identityAlways = false; Expression generateExpr = null; boolean isNullable = true; Expression defaultExpr = null; Type typeObject; NumberSequence sequence = null; if (token.tokenType == Tokens.IDENTITY) { read(); isIdentity = true; isPKIdentity = true; typeObject = Type.SQL_INTEGER; sequence = new NumberSequence(null, 0, 1, typeObject); } else if (token.tokenType == Tokens.COMMA) { ; return null; } else { typeObject = readTypeDefinition(true); } if (isIdentity) {} else if (token.tokenType == Tokens.DEFAULT) { read(); defaultExpr = readDefaultClause(typeObject); } else if (token.tokenType == Tokens.GENERATED && !isIdentity) { read(); if (token.tokenType == Tokens.BY) { read(); readThis(Tokens.DEFAULT); } else { readThis(Tokens.ALWAYS); identityAlways = true; } readThis(Tokens.AS); if (token.tokenType == Tokens.IDENTITY) { read(); sequence = new NumberSequence(null, typeObject); sequence.setAlways(identityAlways); if (token.tokenType == Tokens.OPENBRACKET) { read(); readSequenceOptions(sequence, false, false); readThis(Tokens.CLOSEBRACKET); } isIdentity = true; } else if (token.tokenType == Tokens.OPENBRACKET) { read(); generateExpr = XreadValueExpression(); readThis(Tokens.CLOSEBRACKET); } } ColumnSchema column = new ColumnSchema(hsqlName, typeObject, isNullable, false, defaultExpr); readColumnConstraints(table, column, constraintList); if (token.tokenType == Tokens.IDENTITY && !isIdentity) { read(); isIdentity = true; isPKIdentity = true; sequence = new NumberSequence(null, 0, 1, typeObject); } if (isIdentity) { column.setIdentity(sequence); } if (isPKIdentity && !column.isPrimaryKey()) { OrderedHashSet set = new OrderedHashSet(); set.add(column.getName().name); HsqlName constName = database.nameManager.newAutoName("PK", table.getSchemaName(), table.getName(), SchemaObject.CONSTRAINT); Constraint c = new Constraint(constName, true, set, Constraint.PRIMARY_KEY); constraintList.set(0, c); column.setPrimaryKey(true); } return column; }
java
ColumnSchema readColumnDefinitionOrNull(Table table, HsqlName hsqlName, HsqlArrayList constraintList) { boolean isIdentity = false; boolean isPKIdentity = false; boolean identityAlways = false; Expression generateExpr = null; boolean isNullable = true; Expression defaultExpr = null; Type typeObject; NumberSequence sequence = null; if (token.tokenType == Tokens.IDENTITY) { read(); isIdentity = true; isPKIdentity = true; typeObject = Type.SQL_INTEGER; sequence = new NumberSequence(null, 0, 1, typeObject); } else if (token.tokenType == Tokens.COMMA) { ; return null; } else { typeObject = readTypeDefinition(true); } if (isIdentity) {} else if (token.tokenType == Tokens.DEFAULT) { read(); defaultExpr = readDefaultClause(typeObject); } else if (token.tokenType == Tokens.GENERATED && !isIdentity) { read(); if (token.tokenType == Tokens.BY) { read(); readThis(Tokens.DEFAULT); } else { readThis(Tokens.ALWAYS); identityAlways = true; } readThis(Tokens.AS); if (token.tokenType == Tokens.IDENTITY) { read(); sequence = new NumberSequence(null, typeObject); sequence.setAlways(identityAlways); if (token.tokenType == Tokens.OPENBRACKET) { read(); readSequenceOptions(sequence, false, false); readThis(Tokens.CLOSEBRACKET); } isIdentity = true; } else if (token.tokenType == Tokens.OPENBRACKET) { read(); generateExpr = XreadValueExpression(); readThis(Tokens.CLOSEBRACKET); } } ColumnSchema column = new ColumnSchema(hsqlName, typeObject, isNullable, false, defaultExpr); readColumnConstraints(table, column, constraintList); if (token.tokenType == Tokens.IDENTITY && !isIdentity) { read(); isIdentity = true; isPKIdentity = true; sequence = new NumberSequence(null, 0, 1, typeObject); } if (isIdentity) { column.setIdentity(sequence); } if (isPKIdentity && !column.isPrimaryKey()) { OrderedHashSet set = new OrderedHashSet(); set.add(column.getName().name); HsqlName constName = database.nameManager.newAutoName("PK", table.getSchemaName(), table.getName(), SchemaObject.CONSTRAINT); Constraint c = new Constraint(constName, true, set, Constraint.PRIMARY_KEY); constraintList.set(0, c); column.setPrimaryKey(true); } return column; }
[ "ColumnSchema", "readColumnDefinitionOrNull", "(", "Table", "table", ",", "HsqlName", "hsqlName", ",", "HsqlArrayList", "constraintList", ")", "{", "boolean", "isIdentity", "=", "false", ";", "boolean", "isPKIdentity", "=", "false", ";", "boolean", "identityAlways", ...
Responsible for handling the creation of table columns during the process of executing CREATE TABLE or ADD COLUMN etc. statements. @param table this table @param hsqlName column name @param constraintList list of constraints @return a Column object with indicated attributes
[ "Responsible", "for", "handling", "the", "creation", "of", "table", "columns", "during", "the", "process", "of", "executing", "CREATE", "TABLE", "or", "ADD", "COLUMN", "etc", ".", "statements", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L2912-L3013
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.readCheckConstraintCondition
void readCheckConstraintCondition(Constraint c) { readThis(Tokens.OPENBRACKET); startRecording(); isCheckOrTriggerCondition = true; Expression condition = XreadBooleanValueExpression(); isCheckOrTriggerCondition = false; Token[] tokens = getRecordedStatement(); readThis(Tokens.CLOSEBRACKET); c.check = condition; c.checkStatement = Token.getSQL(tokens); }
java
void readCheckConstraintCondition(Constraint c) { readThis(Tokens.OPENBRACKET); startRecording(); isCheckOrTriggerCondition = true; Expression condition = XreadBooleanValueExpression(); isCheckOrTriggerCondition = false; Token[] tokens = getRecordedStatement(); readThis(Tokens.CLOSEBRACKET); c.check = condition; c.checkStatement = Token.getSQL(tokens); }
[ "void", "readCheckConstraintCondition", "(", "Constraint", "c", ")", "{", "readThis", "(", "Tokens", ".", "OPENBRACKET", ")", ";", "startRecording", "(", ")", ";", "isCheckOrTriggerCondition", "=", "true", ";", "Expression", "condition", "=", "XreadBooleanValueExpre...
Responsible for handling check constraints section of CREATE TABLE ... @param c check constraint
[ "Responsible", "for", "handling", "check", "constraints", "section", "of", "CREATE", "TABLE", "..." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L3475-L3492
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.readColumnList
private int[] readColumnList(Table table, boolean ascOrDesc) { OrderedHashSet set = readColumnNames(ascOrDesc); return table.getColumnIndexes(set); }
java
private int[] readColumnList(Table table, boolean ascOrDesc) { OrderedHashSet set = readColumnNames(ascOrDesc); return table.getColumnIndexes(set); }
[ "private", "int", "[", "]", "readColumnList", "(", "Table", "table", ",", "boolean", "ascOrDesc", ")", "{", "OrderedHashSet", "set", "=", "readColumnNames", "(", "ascOrDesc", ")", ";", "return", "table", ".", "getColumnIndexes", "(", "set", ")", ";", "}" ]
Process a bracketed column list as used in the declaration of SQL CONSTRAINTS and return an array containing the indexes of the columns within the table. @param table table that contains the columns @param ascOrDesc boolean @return array of column indexes
[ "Process", "a", "bracketed", "column", "list", "as", "used", "in", "the", "declaration", "of", "SQL", "CONSTRAINTS", "and", "return", "an", "array", "containing", "the", "indexes", "of", "the", "columns", "within", "the", "table", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L3503-L3508
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.processAlterTableRename
void processAlterTableRename(Table table) { HsqlName name = readNewSchemaObjectName(SchemaObject.TABLE); name.setSchemaIfNull(table.getSchemaName()); if (table.getSchemaName() != name.schema) { throw Error.error(ErrorCode.X_42505); } database.schemaManager.renameSchemaObject(table.getName(), name); }
java
void processAlterTableRename(Table table) { HsqlName name = readNewSchemaObjectName(SchemaObject.TABLE); name.setSchemaIfNull(table.getSchemaName()); if (table.getSchemaName() != name.schema) { throw Error.error(ErrorCode.X_42505); } database.schemaManager.renameSchemaObject(table.getName(), name); }
[ "void", "processAlterTableRename", "(", "Table", "table", ")", "{", "HsqlName", "name", "=", "readNewSchemaObjectName", "(", "SchemaObject", ".", "TABLE", ")", ";", "name", ".", "setSchemaIfNull", "(", "table", ".", "getSchemaName", "(", ")", ")", ";", "if", ...
Responsible for handling tail of ALTER TABLE ... RENAME ... @param table table
[ "Responsible", "for", "handling", "tail", "of", "ALTER", "TABLE", "...", "RENAME", "..." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L3901-L3912
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.processAlterTableDropColumn
void processAlterTableDropColumn(Table table, String colName, boolean cascade) { int colindex = table.getColumnIndex(colName); if (table.getColumnCount() == 1) { throw Error.error(ErrorCode.X_42591); } session.commit(false); TableWorks tableWorks = new TableWorks(session, table); tableWorks.dropColumn(colindex, cascade); //VoltDB extension to support Time to live if (table.getTTL() != null && colName.equalsIgnoreCase(table.getTTL().ttlColumn.getName().name)) { table.dropTTL(); } }
java
void processAlterTableDropColumn(Table table, String colName, boolean cascade) { int colindex = table.getColumnIndex(colName); if (table.getColumnCount() == 1) { throw Error.error(ErrorCode.X_42591); } session.commit(false); TableWorks tableWorks = new TableWorks(session, table); tableWorks.dropColumn(colindex, cascade); //VoltDB extension to support Time to live if (table.getTTL() != null && colName.equalsIgnoreCase(table.getTTL().ttlColumn.getName().name)) { table.dropTTL(); } }
[ "void", "processAlterTableDropColumn", "(", "Table", "table", ",", "String", "colName", ",", "boolean", "cascade", ")", "{", "int", "colindex", "=", "table", ".", "getColumnIndex", "(", "colName", ")", ";", "if", "(", "table", ".", "getColumnCount", "(", ")"...
Responsible for handling tail of ALTER TABLE ... DROP COLUMN ...
[ "Responsible", "for", "handling", "tail", "of", "ALTER", "TABLE", "...", "DROP", "COLUMN", "..." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L4221-L4240
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.processAlterTableDropConstraint
void processAlterTableDropConstraint(Table table, String name, boolean cascade) { session.commit(false); TableWorks tableWorks = new TableWorks(session, table); tableWorks.dropConstraint(name, cascade); return; }
java
void processAlterTableDropConstraint(Table table, String name, boolean cascade) { session.commit(false); TableWorks tableWorks = new TableWorks(session, table); tableWorks.dropConstraint(name, cascade); return; }
[ "void", "processAlterTableDropConstraint", "(", "Table", "table", ",", "String", "name", ",", "boolean", "cascade", ")", "{", "session", ".", "commit", "(", "false", ")", ";", "TableWorks", "tableWorks", "=", "new", "TableWorks", "(", "session", ",", "table", ...
Responsible for handling tail of ALTER TABLE ... DROP CONSTRAINT ...
[ "Responsible", "for", "handling", "tail", "of", "ALTER", "TABLE", "...", "DROP", "CONSTRAINT", "..." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L4275-L4285
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.processAlterColumnType
private void processAlterColumnType(Table table, ColumnSchema oldCol, boolean fullDefinition) { ColumnSchema newCol; if (oldCol.isGenerated()) { throw Error.error(ErrorCode.X_42561); } if (fullDefinition) { HsqlArrayList list = new HsqlArrayList(); Constraint c = table.getPrimaryConstraint(); if (c == null) { c = new Constraint(null, true, null, Constraint.TEMP); } list.add(c); newCol = readColumnDefinitionOrNull(table, oldCol.getName(), list); if (newCol == null) { throw Error.error(ErrorCode.X_42000); } if (oldCol.isIdentity() && newCol.isIdentity()) { throw Error.error(ErrorCode.X_42525); } if (list.size() > 1) { // A VoltDB extension to support establishing or preserving the NOT NULL // attribute of an altered column. if (voltDBacceptNotNullConstraint(list)) { newCol.setNullable(false); } else // End of VoltDB extension throw Error.error(ErrorCode.X_42524); } } else { Type type = readTypeDefinition(true); if (oldCol.isIdentity()) { if (!type.isIntegralType()) { throw Error.error(ErrorCode.X_42561); } } newCol = oldCol.duplicate(); newCol.setType(type); } TableWorks tw = new TableWorks(session, table); tw.retypeColumn(oldCol, newCol); }
java
private void processAlterColumnType(Table table, ColumnSchema oldCol, boolean fullDefinition) { ColumnSchema newCol; if (oldCol.isGenerated()) { throw Error.error(ErrorCode.X_42561); } if (fullDefinition) { HsqlArrayList list = new HsqlArrayList(); Constraint c = table.getPrimaryConstraint(); if (c == null) { c = new Constraint(null, true, null, Constraint.TEMP); } list.add(c); newCol = readColumnDefinitionOrNull(table, oldCol.getName(), list); if (newCol == null) { throw Error.error(ErrorCode.X_42000); } if (oldCol.isIdentity() && newCol.isIdentity()) { throw Error.error(ErrorCode.X_42525); } if (list.size() > 1) { // A VoltDB extension to support establishing or preserving the NOT NULL // attribute of an altered column. if (voltDBacceptNotNullConstraint(list)) { newCol.setNullable(false); } else // End of VoltDB extension throw Error.error(ErrorCode.X_42524); } } else { Type type = readTypeDefinition(true); if (oldCol.isIdentity()) { if (!type.isIntegralType()) { throw Error.error(ErrorCode.X_42561); } } newCol = oldCol.duplicate(); newCol.setType(type); } TableWorks tw = new TableWorks(session, table); tw.retypeColumn(oldCol, newCol); }
[ "private", "void", "processAlterColumnType", "(", "Table", "table", ",", "ColumnSchema", "oldCol", ",", "boolean", "fullDefinition", ")", "{", "ColumnSchema", "newCol", ";", "if", "(", "oldCol", ".", "isGenerated", "(", ")", ")", "{", "throw", "Error", ".", ...
Allows changes to type of column or addition of an IDENTITY generator. IDENTITY is not removed if it does not appear in new column definition Constraint definitions are not allowed
[ "Allows", "changes", "to", "type", "of", "column", "or", "addition", "of", "an", "IDENTITY", "generator", ".", "IDENTITY", "is", "not", "removed", "if", "it", "does", "not", "appear", "in", "new", "column", "definition", "Constraint", "definitions", "are", "...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L4727-L4782
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.processAlterColumnRename
private void processAlterColumnRename(Table table, ColumnSchema column) { checkIsSimpleName(); if (table.findColumn(token.tokenString) > -1) { throw Error.error(ErrorCode.X_42504, token.tokenString); } database.schemaManager.checkColumnIsReferenced(table.getName(), column.getName()); session.commit(false); table.renameColumn(column, token.tokenString, isDelimitedIdentifier()); read(); }
java
private void processAlterColumnRename(Table table, ColumnSchema column) { checkIsSimpleName(); if (table.findColumn(token.tokenString) > -1) { throw Error.error(ErrorCode.X_42504, token.tokenString); } database.schemaManager.checkColumnIsReferenced(table.getName(), column.getName()); session.commit(false); table.renameColumn(column, token.tokenString, isDelimitedIdentifier()); read(); }
[ "private", "void", "processAlterColumnRename", "(", "Table", "table", ",", "ColumnSchema", "column", ")", "{", "checkIsSimpleName", "(", ")", ";", "if", "(", "table", ".", "findColumn", "(", "token", ".", "tokenString", ")", ">", "-", "1", ")", "{", "throw...
Responsible for handling tail of ALTER COLUMN ... RENAME ...
[ "Responsible", "for", "handling", "tail", "of", "ALTER", "COLUMN", "...", "RENAME", "..." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L4787-L4800
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.readLimitConstraintCondition
void readLimitConstraintCondition(Constraint c) { readThis(Tokens.PARTITION); readThis(Tokens.ROWS); int rowsLimit = readInteger(); c.rowsLimit = rowsLimit; // The optional EXECUTE (DELETE ...) clause if (readIfThis(Tokens.EXECUTE)) { // Capture the statement between parentheses following the EXECUTE keyword, // as in // // LIMIT PARTITION ROWS 10 EXECUTE (DELETE FROM tbl WHERE b = 1) // readThis(Tokens.OPENBRACKET); startRecording(); int numOpenBrackets = 1; while (numOpenBrackets > 0) { switch(token.tokenType) { case Tokens.OPENBRACKET: numOpenBrackets++; read(); break; case Tokens.CLOSEBRACKET: numOpenBrackets--; if (numOpenBrackets > 0) { // don't want the final parenthesis read(); } break; case Tokens.X_ENDPARSE: throw unexpectedToken(); default: read(); } } Token[] stmtTokens = getRecordedStatement(); // This captures the DELETE statement exactly, including embedded whitespace, etc. c.rowsLimitDeleteStmt = Token.getSQL(stmtTokens); readThis(Tokens.CLOSEBRACKET); } }
java
void readLimitConstraintCondition(Constraint c) { readThis(Tokens.PARTITION); readThis(Tokens.ROWS); int rowsLimit = readInteger(); c.rowsLimit = rowsLimit; // The optional EXECUTE (DELETE ...) clause if (readIfThis(Tokens.EXECUTE)) { // Capture the statement between parentheses following the EXECUTE keyword, // as in // // LIMIT PARTITION ROWS 10 EXECUTE (DELETE FROM tbl WHERE b = 1) // readThis(Tokens.OPENBRACKET); startRecording(); int numOpenBrackets = 1; while (numOpenBrackets > 0) { switch(token.tokenType) { case Tokens.OPENBRACKET: numOpenBrackets++; read(); break; case Tokens.CLOSEBRACKET: numOpenBrackets--; if (numOpenBrackets > 0) { // don't want the final parenthesis read(); } break; case Tokens.X_ENDPARSE: throw unexpectedToken(); default: read(); } } Token[] stmtTokens = getRecordedStatement(); // This captures the DELETE statement exactly, including embedded whitespace, etc. c.rowsLimitDeleteStmt = Token.getSQL(stmtTokens); readThis(Tokens.CLOSEBRACKET); } }
[ "void", "readLimitConstraintCondition", "(", "Constraint", "c", ")", "{", "readThis", "(", "Tokens", ".", "PARTITION", ")", ";", "readThis", "(", "Tokens", ".", "ROWS", ")", ";", "int", "rowsLimit", "=", "readInteger", "(", ")", ";", "c", ".", "rowsLimit",...
Responsible for handling Volt limit constraints section of CREATE TABLE ... @param c check constraint
[ "Responsible", "for", "handling", "Volt", "limit", "constraints", "section", "of", "CREATE", "TABLE", "..." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L5482-L5530
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.XreadExpressions
private java.util.List<Expression> XreadExpressions(java.util.List<Boolean> ascDesc) { return XreadExpressions(ascDesc, false); }
java
private java.util.List<Expression> XreadExpressions(java.util.List<Boolean> ascDesc) { return XreadExpressions(ascDesc, false); }
[ "private", "java", ".", "util", ".", "List", "<", "Expression", ">", "XreadExpressions", "(", "java", ".", "util", ".", "List", "<", "Boolean", ">", "ascDesc", ")", "{", "return", "XreadExpressions", "(", "ascDesc", ",", "false", ")", ";", "}" ]
Default disallow empty parenthesis
[ "Default", "disallow", "empty", "parenthesis" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L5533-L5535
train
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/Request.java
Request.isValid
static boolean isValid(int type) { // make sure this is always synchronized with Zoodefs!! switch (type) { case OpCode.notification: return false; case OpCode.create: case OpCode.delete: case OpCode.createSession: case OpCode.exists: case OpCode.getData: case OpCode.setData: case OpCode.sync: case OpCode.getACL: case OpCode.setACL: case OpCode.getChildren: case OpCode.getChildren2: case OpCode.ping: case OpCode.closeSession: case OpCode.setWatches: return true; default: return false; } }
java
static boolean isValid(int type) { // make sure this is always synchronized with Zoodefs!! switch (type) { case OpCode.notification: return false; case OpCode.create: case OpCode.delete: case OpCode.createSession: case OpCode.exists: case OpCode.getData: case OpCode.setData: case OpCode.sync: case OpCode.getACL: case OpCode.setACL: case OpCode.getChildren: case OpCode.getChildren2: case OpCode.ping: case OpCode.closeSession: case OpCode.setWatches: return true; default: return false; } }
[ "static", "boolean", "isValid", "(", "int", "type", ")", "{", "// make sure this is always synchronized with Zoodefs!!", "switch", "(", "type", ")", "{", "case", "OpCode", ".", "notification", ":", "return", "false", ";", "case", "OpCode", ".", "create", ":", "c...
is the packet type a valid packet in zookeeper @param type the type of the packet @return true if a valid packet, false if not
[ "is", "the", "packet", "type", "a", "valid", "packet", "in", "zookeeper" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/Request.java#L112-L135
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.startSeekingFor
public void startSeekingFor( final Set<Long> hsids, final Map<Long,Boolean> inTrouble) { // if the mesh hsids change we need to reset if (!m_hsids.equals(hsids)) { if (!m_hsids.isEmpty()) clear(); m_hsids = ImmutableSortedSet.copyOf(hsids); } // determine the survivors m_survivors = m_strategy.accept(survivorPicker, Pair.of(m_hsids, inTrouble)); // start accumulating link failure graphing info add(m_selfHsid, inTrouble); }
java
public void startSeekingFor( final Set<Long> hsids, final Map<Long,Boolean> inTrouble) { // if the mesh hsids change we need to reset if (!m_hsids.equals(hsids)) { if (!m_hsids.isEmpty()) clear(); m_hsids = ImmutableSortedSet.copyOf(hsids); } // determine the survivors m_survivors = m_strategy.accept(survivorPicker, Pair.of(m_hsids, inTrouble)); // start accumulating link failure graphing info add(m_selfHsid, inTrouble); }
[ "public", "void", "startSeekingFor", "(", "final", "Set", "<", "Long", ">", "hsids", ",", "final", "Map", "<", "Long", ",", "Boolean", ">", "inTrouble", ")", "{", "// if the mesh hsids change we need to reset", "if", "(", "!", "m_hsids", ".", "equals", "(", ...
Start accumulate site links graphing information @param hsids pre-failure mesh hsids @param inTrouble a map where each key is a failed site, and its value is a boolean that indicates whether or not the failure was witnessed directly or reported by some other site
[ "Start", "accumulate", "site", "links", "graphing", "information" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L87-L99
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.removeValues
static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) { Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator(); while (itr.hasNext()) { Map.Entry<Long, Long> e = itr.next(); if (values.contains(e.getValue())) { itr.remove(); } } }
java
static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) { Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator(); while (itr.hasNext()) { Map.Entry<Long, Long> e = itr.next(); if (values.contains(e.getValue())) { itr.remove(); } } }
[ "static", "protected", "void", "removeValues", "(", "TreeMultimap", "<", "Long", ",", "Long", ">", "mm", ",", "Set", "<", "Long", ">", "values", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "Long", ",", "Long", ">", ">", "itr", "=", "mm", "...
Convenience method that remove all instances of the given values from the given map @param mm a multimap @param values a set of values that need to be removed
[ "Convenience", "method", "that", "remove", "all", "instances", "of", "the", "given", "values", "from", "the", "given", "map" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L116-L124
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.amongDeadHsids
public static Predicate<Map.Entry<Long, Boolean>> amongDeadHsids(final Set<Long> hsids) { return new Predicate<Map.Entry<Long,Boolean>>() { @Override public boolean apply(Entry<Long, Boolean> e) { return hsids.contains(e.getKey()) && e.getValue(); } }; }
java
public static Predicate<Map.Entry<Long, Boolean>> amongDeadHsids(final Set<Long> hsids) { return new Predicate<Map.Entry<Long,Boolean>>() { @Override public boolean apply(Entry<Long, Boolean> e) { return hsids.contains(e.getKey()) && e.getValue(); } }; }
[ "public", "static", "Predicate", "<", "Map", ".", "Entry", "<", "Long", ",", "Boolean", ">", ">", "amongDeadHsids", "(", "final", "Set", "<", "Long", ">", "hsids", ")", "{", "return", "new", "Predicate", "<", "Map", ".", "Entry", "<", "Long", ",", "B...
returns a map entry predicate that tests whether or not the given map entry describes a dead site @param hsids pre-failure mesh hsids @return
[ "returns", "a", "map", "entry", "predicate", "that", "tests", "whether", "or", "not", "the", "given", "map", "entry", "describes", "a", "dead", "site" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L153-L160
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.removeValue
private void removeValue(TreeMultimap<Long, Long> mm, long value) { Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator(); while (itr.hasNext()) { Map.Entry<Long,Long> e = itr.next(); if (e.getValue().equals(value)) { itr.remove(); } } }
java
private void removeValue(TreeMultimap<Long, Long> mm, long value) { Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator(); while (itr.hasNext()) { Map.Entry<Long,Long> e = itr.next(); if (e.getValue().equals(value)) { itr.remove(); } } }
[ "private", "void", "removeValue", "(", "TreeMultimap", "<", "Long", ",", "Long", ">", "mm", ",", "long", "value", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "Long", ",", "Long", ">", ">", "itr", "=", "mm", ".", "entries", "(", ")", ".", ...
Convenience method that remove all instances of the given value from the given map @param mm a multimap @param value a value that needs to be removed
[ "Convenience", "method", "that", "remove", "all", "instances", "of", "the", "given", "value", "from", "the", "given", "map" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L187-L195
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.add
void add(long reportingHsid, final Map<Long,Boolean> failed) { // skip if the reporting site did not belong to the pre // failure mesh if (!m_hsids.contains(reportingHsid)) return; // ship if the reporting site is reporting itself dead Boolean harakiri = failed.get(reportingHsid); if (harakiri != null && harakiri.booleanValue()) return; Set<Long> dead = Sets.newHashSet(); for (Map.Entry<Long, Boolean> e: failed.entrySet()) { // skip if the failed site did not belong to the // pre failure mesh if (!m_hsids.contains(e.getKey())) continue; m_reported.put(e.getKey(), reportingHsid); // if the failure is witnessed add it to the dead graph if (e.getValue()) { m_dead.put(e.getKey(), reportingHsid); dead.add(e.getKey()); } } // once you are witnessed dead you cannot become undead, // but it is not the case for alive nodes, as they can // die. So remove all what the reporting site thought // was alive before this invocation removeValue(m_alive, reportingHsid); for (Long alive: Sets.difference(m_hsids, dead)) { m_alive.put(alive, reportingHsid); } }
java
void add(long reportingHsid, final Map<Long,Boolean> failed) { // skip if the reporting site did not belong to the pre // failure mesh if (!m_hsids.contains(reportingHsid)) return; // ship if the reporting site is reporting itself dead Boolean harakiri = failed.get(reportingHsid); if (harakiri != null && harakiri.booleanValue()) return; Set<Long> dead = Sets.newHashSet(); for (Map.Entry<Long, Boolean> e: failed.entrySet()) { // skip if the failed site did not belong to the // pre failure mesh if (!m_hsids.contains(e.getKey())) continue; m_reported.put(e.getKey(), reportingHsid); // if the failure is witnessed add it to the dead graph if (e.getValue()) { m_dead.put(e.getKey(), reportingHsid); dead.add(e.getKey()); } } // once you are witnessed dead you cannot become undead, // but it is not the case for alive nodes, as they can // die. So remove all what the reporting site thought // was alive before this invocation removeValue(m_alive, reportingHsid); for (Long alive: Sets.difference(m_hsids, dead)) { m_alive.put(alive, reportingHsid); } }
[ "void", "add", "(", "long", "reportingHsid", ",", "final", "Map", "<", "Long", ",", "Boolean", ">", "failed", ")", "{", "// skip if the reporting site did not belong to the pre", "// failure mesh", "if", "(", "!", "m_hsids", ".", "contains", "(", "reportingHsid", ...
Adds alive and dead graph information @param reportingHsid site reporting failures @param failures seen by the reporting site
[ "Adds", "alive", "and", "dead", "graph", "information" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L249-L281
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.add
public void add(long reportingHsid, SiteFailureMessage sfm) { // skip if the reporting site did not belong to the pre // failure mesh, or the reporting site is reporting itself // dead, or none of the sites in the safe transaction map // are among the known hsids if ( !m_hsids.contains(reportingHsid) || !sfm.m_survivors.contains(reportingHsid)) return; Set<Long> survivors = sfm.m_survivors; if (Sets.filter(sfm.getObservedFailedSites(), in(m_hsids)).isEmpty()) { survivors = m_hsids; } // dead = pre failure mesh - survivors Set<Long> dead = Sets.difference(m_hsids, survivors); removeValue(m_dead, reportingHsid); // add dead graph nodes for (long w: dead) { if (!m_hsids.contains(w)) continue; m_dead.put(w,reportingHsid); } // Remove all what the reporting site thought // was alive before this invocation removeValue(m_alive, reportingHsid); // add alive graph nodes for (long s: survivors) { if (!m_hsids.contains(s)) continue; m_alive.put(s, reportingHsid); } for (long s: sfm.getFailedSites()) { if (!m_hsids.contains(s)) continue; m_reported.put(s, reportingHsid); } }
java
public void add(long reportingHsid, SiteFailureMessage sfm) { // skip if the reporting site did not belong to the pre // failure mesh, or the reporting site is reporting itself // dead, or none of the sites in the safe transaction map // are among the known hsids if ( !m_hsids.contains(reportingHsid) || !sfm.m_survivors.contains(reportingHsid)) return; Set<Long> survivors = sfm.m_survivors; if (Sets.filter(sfm.getObservedFailedSites(), in(m_hsids)).isEmpty()) { survivors = m_hsids; } // dead = pre failure mesh - survivors Set<Long> dead = Sets.difference(m_hsids, survivors); removeValue(m_dead, reportingHsid); // add dead graph nodes for (long w: dead) { if (!m_hsids.contains(w)) continue; m_dead.put(w,reportingHsid); } // Remove all what the reporting site thought // was alive before this invocation removeValue(m_alive, reportingHsid); // add alive graph nodes for (long s: survivors) { if (!m_hsids.contains(s)) continue; m_alive.put(s, reportingHsid); } for (long s: sfm.getFailedSites()) { if (!m_hsids.contains(s)) continue; m_reported.put(s, reportingHsid); } }
[ "public", "void", "add", "(", "long", "reportingHsid", ",", "SiteFailureMessage", "sfm", ")", "{", "// skip if the reporting site did not belong to the pre", "// failure mesh, or the reporting site is reporting itself", "// dead, or none of the sites in the safe transaction map", "// are...
Adds alive and dead graph information from a reporting site survivor set @param reportingHsid the reporting site @param sfm a {@link SiteFailureMessage} containing that site's survivor set
[ "Adds", "alive", "and", "dead", "graph", "information", "from", "a", "reporting", "site", "survivor", "set" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L290-L328
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.seenByInterconnectedPeers
protected boolean seenByInterconnectedPeers( Set<Long> destinations, Set<Long> origins) { Set<Long> seers = Multimaps.filterValues(m_alive, in(origins)).keySet(); int before = origins.size(); origins.addAll(seers); if (origins.containsAll(destinations)) { return true; } else if (origins.size() == before) { return false; } return seenByInterconnectedPeers(destinations, origins); }
java
protected boolean seenByInterconnectedPeers( Set<Long> destinations, Set<Long> origins) { Set<Long> seers = Multimaps.filterValues(m_alive, in(origins)).keySet(); int before = origins.size(); origins.addAll(seers); if (origins.containsAll(destinations)) { return true; } else if (origins.size() == before) { return false; } return seenByInterconnectedPeers(destinations, origins); }
[ "protected", "boolean", "seenByInterconnectedPeers", "(", "Set", "<", "Long", ">", "destinations", ",", "Set", "<", "Long", ">", "origins", ")", "{", "Set", "<", "Long", ">", "seers", "=", "Multimaps", ".", "filterValues", "(", "m_alive", ",", "in", "(", ...
Walk the alive graph to see if there is a connected path between origins, and destinations @param destinations set of sites that we are looking a path to @param origins set of sites that we are looking a path from @return true origins have path to destinations
[ "Walk", "the", "alive", "graph", "to", "see", "if", "there", "is", "a", "connected", "path", "between", "origins", "and", "destinations" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L443-L454
train
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.forWhomSiteIsDead
public Set<Long> forWhomSiteIsDead(long hsid) { ImmutableSet.Builder<Long> isb = ImmutableSet.builder(); Set<Long> deadBy = m_dead.get(hsid); if ( !deadBy.isEmpty() && m_survivors.contains(hsid) && m_strategy == ArbitrationStrategy.MATCHING_CARDINALITY) { isb.addAll(Sets.filter(deadBy, amongSurvivors)); } return isb.build(); }
java
public Set<Long> forWhomSiteIsDead(long hsid) { ImmutableSet.Builder<Long> isb = ImmutableSet.builder(); Set<Long> deadBy = m_dead.get(hsid); if ( !deadBy.isEmpty() && m_survivors.contains(hsid) && m_strategy == ArbitrationStrategy.MATCHING_CARDINALITY) { isb.addAll(Sets.filter(deadBy, amongSurvivors)); } return isb.build(); }
[ "public", "Set", "<", "Long", ">", "forWhomSiteIsDead", "(", "long", "hsid", ")", "{", "ImmutableSet", ".", "Builder", "<", "Long", ">", "isb", "=", "ImmutableSet", ".", "builder", "(", ")", ";", "Set", "<", "Long", ">", "deadBy", "=", "m_dead", ".", ...
Is the given hsid considered dead by anyone in my survivor set? @param hsid a site hsid @return a subset of my survivor set that considers the given site dead
[ "Is", "the", "given", "hsid", "considered", "dead", "by", "anyone", "in", "my", "survivor", "set?" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L535-L544
train
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java
UpdateApplicationBase.addDDLToCatalog
protected static InMemoryJarfile addDDLToCatalog(Catalog oldCatalog, InMemoryJarfile jarfile, String[] adhocDDLStmts, boolean isXDCR) throws IOException, VoltCompilerException { StringBuilder sb = new StringBuilder(); compilerLog.info("Applying the following DDL to cluster:"); for (String stmt : adhocDDLStmts) { compilerLog.info("\t" + stmt); sb.append(stmt); sb.append(";\n"); } String newDDL = sb.toString(); compilerLog.trace("Adhoc-modified DDL:\n" + newDDL); VoltCompiler compiler = new VoltCompiler(isXDCR); compiler.compileInMemoryJarfileWithNewDDL(jarfile, newDDL, oldCatalog); return jarfile; }
java
protected static InMemoryJarfile addDDLToCatalog(Catalog oldCatalog, InMemoryJarfile jarfile, String[] adhocDDLStmts, boolean isXDCR) throws IOException, VoltCompilerException { StringBuilder sb = new StringBuilder(); compilerLog.info("Applying the following DDL to cluster:"); for (String stmt : adhocDDLStmts) { compilerLog.info("\t" + stmt); sb.append(stmt); sb.append(";\n"); } String newDDL = sb.toString(); compilerLog.trace("Adhoc-modified DDL:\n" + newDDL); VoltCompiler compiler = new VoltCompiler(isXDCR); compiler.compileInMemoryJarfileWithNewDDL(jarfile, newDDL, oldCatalog); return jarfile; }
[ "protected", "static", "InMemoryJarfile", "addDDLToCatalog", "(", "Catalog", "oldCatalog", ",", "InMemoryJarfile", "jarfile", ",", "String", "[", "]", "adhocDDLStmts", ",", "boolean", "isXDCR", ")", "throws", "IOException", ",", "VoltCompilerException", "{", "StringBu...
Append the supplied adhoc DDL to the current catalog's DDL and recompile the jarfile @throws VoltCompilerException
[ "Append", "the", "supplied", "adhoc", "DDL", "to", "the", "current", "catalog", "s", "DDL", "and", "recompile", "the", "jarfile" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java#L312-L328
train
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java
UpdateApplicationBase.makeQuickResponse
static protected CompletableFuture<ClientResponse> makeQuickResponse(byte statusCode, String msg) { ClientResponseImpl cri = new ClientResponseImpl(statusCode, new VoltTable[0], msg); CompletableFuture<ClientResponse> f = new CompletableFuture<>(); f.complete(cri); return f; }
java
static protected CompletableFuture<ClientResponse> makeQuickResponse(byte statusCode, String msg) { ClientResponseImpl cri = new ClientResponseImpl(statusCode, new VoltTable[0], msg); CompletableFuture<ClientResponse> f = new CompletableFuture<>(); f.complete(cri); return f; }
[ "static", "protected", "CompletableFuture", "<", "ClientResponse", ">", "makeQuickResponse", "(", "byte", "statusCode", ",", "String", "msg", ")", "{", "ClientResponseImpl", "cri", "=", "new", "ClientResponseImpl", "(", "statusCode", ",", "new", "VoltTable", "[", ...
Error generating shortcut method
[ "Error", "generating", "shortcut", "method" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java#L400-L405
train
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java
UpdateApplicationBase.verifyAndWriteCatalogJar
protected String verifyAndWriteCatalogJar(CatalogChangeResult ccr) { String procedureName = "@VerifyCatalogAndWriteJar"; CompletableFuture<Map<Integer,ClientResponse>> cf = callNTProcedureOnAllHosts(procedureName, ccr.catalogBytes, ccr.encodedDiffCommands, ccr.catalogHash, ccr.deploymentBytes); Map<Integer, ClientResponse> resultMapByHost = null; String err; long timeoutSeconds = VerifyCatalogAndWriteJar.TIMEOUT; hostLog.info("Max timeout setting for VerifyCatalogAndWriteJar is " + timeoutSeconds + " seconds"); try { Stopwatch sw = Stopwatch.createStarted(); long elapsed = 0; while ((elapsed = sw.elapsed(TimeUnit.SECONDS)) < (timeoutSeconds)) { resultMapByHost = cf.getNow(null); if (resultMapByHost != null) { sw.stop(); break; } if (elapsed < 5) { // do not log under 5 seconds and sleep for 100 milliseconds Thread.sleep(100); continue; } hostLog.info(elapsed + " seconds has elapsed but " + procedureName + " is still wait for remote response." + "The max timeout value is " + timeoutSeconds + " seconds."); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } } catch (Exception e) { err = procedureName + " run everywhere call failed: " + e.getMessage(); hostLog.info(err + ", " + com.google_voltpatches.common.base.Throwables.getStackTraceAsString(e)); return err; } if (resultMapByHost == null) { err = "An invocation of procedure " + procedureName + " on all hosts timed out."; hostLog.info(err); return err; } for (Entry<Integer, ClientResponse> entry : resultMapByHost.entrySet()) { if (entry.getValue().getStatus() != ClientResponseImpl.SUCCESS) { err = "The response from host " + entry.getKey().toString() + " for " + procedureName + " returned failures: " + entry.getValue().getStatusString(); compilerLog.info(err); // hide the internal NT-procedure @VerifyCatalogAndWriteJar from the client message return err; } } return null; }
java
protected String verifyAndWriteCatalogJar(CatalogChangeResult ccr) { String procedureName = "@VerifyCatalogAndWriteJar"; CompletableFuture<Map<Integer,ClientResponse>> cf = callNTProcedureOnAllHosts(procedureName, ccr.catalogBytes, ccr.encodedDiffCommands, ccr.catalogHash, ccr.deploymentBytes); Map<Integer, ClientResponse> resultMapByHost = null; String err; long timeoutSeconds = VerifyCatalogAndWriteJar.TIMEOUT; hostLog.info("Max timeout setting for VerifyCatalogAndWriteJar is " + timeoutSeconds + " seconds"); try { Stopwatch sw = Stopwatch.createStarted(); long elapsed = 0; while ((elapsed = sw.elapsed(TimeUnit.SECONDS)) < (timeoutSeconds)) { resultMapByHost = cf.getNow(null); if (resultMapByHost != null) { sw.stop(); break; } if (elapsed < 5) { // do not log under 5 seconds and sleep for 100 milliseconds Thread.sleep(100); continue; } hostLog.info(elapsed + " seconds has elapsed but " + procedureName + " is still wait for remote response." + "The max timeout value is " + timeoutSeconds + " seconds."); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } } catch (Exception e) { err = procedureName + " run everywhere call failed: " + e.getMessage(); hostLog.info(err + ", " + com.google_voltpatches.common.base.Throwables.getStackTraceAsString(e)); return err; } if (resultMapByHost == null) { err = "An invocation of procedure " + procedureName + " on all hosts timed out."; hostLog.info(err); return err; } for (Entry<Integer, ClientResponse> entry : resultMapByHost.entrySet()) { if (entry.getValue().getStatus() != ClientResponseImpl.SUCCESS) { err = "The response from host " + entry.getKey().toString() + " for " + procedureName + " returned failures: " + entry.getValue().getStatusString(); compilerLog.info(err); // hide the internal NT-procedure @VerifyCatalogAndWriteJar from the client message return err; } } return null; }
[ "protected", "String", "verifyAndWriteCatalogJar", "(", "CatalogChangeResult", "ccr", ")", "{", "String", "procedureName", "=", "\"@VerifyCatalogAndWriteJar\"", ";", "CompletableFuture", "<", "Map", "<", "Integer", ",", "ClientResponse", ">", ">", "cf", "=", "callNTPr...
Run the catalog jar NT procedure to check and write the catalog file. Check the results map from every host and return error message if needed. @return A String describing the error messages. If all hosts return success, NULL is returned.
[ "Run", "the", "catalog", "jar", "NT", "procedure", "to", "check", "and", "write", "the", "catalog", "file", ".", "Check", "the", "results", "map", "from", "every", "host", "and", "return", "error", "message", "if", "needed", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java#L412-L469
train
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java
UpdateApplicationBase.getNextGenerationId
public static long getNextGenerationId() { // ENG-14511- these calls may hit assertion failures in testing environments try { return UniqueIdGenerator.makeIdFromComponents(System.currentTimeMillis(), m_generationId.incrementAndGet(), MpInitiator.MP_INIT_PID); } catch (Throwable t) { // Try resetting the generation m_generationId.set(0L); return UniqueIdGenerator.makeIdFromComponents(System.currentTimeMillis(), m_generationId.incrementAndGet(), MpInitiator.MP_INIT_PID); } }
java
public static long getNextGenerationId() { // ENG-14511- these calls may hit assertion failures in testing environments try { return UniqueIdGenerator.makeIdFromComponents(System.currentTimeMillis(), m_generationId.incrementAndGet(), MpInitiator.MP_INIT_PID); } catch (Throwable t) { // Try resetting the generation m_generationId.set(0L); return UniqueIdGenerator.makeIdFromComponents(System.currentTimeMillis(), m_generationId.incrementAndGet(), MpInitiator.MP_INIT_PID); } }
[ "public", "static", "long", "getNextGenerationId", "(", ")", "{", "// ENG-14511- these calls may hit assertion failures in testing environments", "try", "{", "return", "UniqueIdGenerator", ".", "makeIdFromComponents", "(", "System", ".", "currentTimeMillis", "(", ")", ",", ...
Get a unique id for the next generation for export. @return next generation id (a unique long value)
[ "Get", "a", "unique", "id", "for", "the", "next", "generation", "for", "export", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/UpdateApplicationBase.java#L475-L489
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rights/UserManager.java
UserManager.getUser
public User getUser(String name, String password) { if (name == null) { name = ""; } if (password == null) { password = ""; } User user = get(name); user.checkPassword(password); return user; }
java
public User getUser(String name, String password) { if (name == null) { name = ""; } if (password == null) { password = ""; } User user = get(name); user.checkPassword(password); return user; }
[ "public", "User", "getUser", "(", "String", "name", ",", "String", "password", ")", "{", "if", "(", "name", "==", "null", ")", "{", "name", "=", "\"\"", ";", "}", "if", "(", "password", "==", "null", ")", "{", "password", "=", "\"\"", ";", "}", "...
Returns the User object with the specified name and password from this object's set.
[ "Returns", "the", "User", "object", "with", "the", "specified", "name", "and", "password", "from", "this", "object", "s", "set", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rights/UserManager.java#L159-L174
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rights/UserManager.java
UserManager.get
public User get(String name) { User user = (User) userList.get(name); if (user == null) { throw Error.error(ErrorCode.X_28501, name); } return user; }
java
public User get(String name) { User user = (User) userList.get(name); if (user == null) { throw Error.error(ErrorCode.X_28501, name); } return user; }
[ "public", "User", "get", "(", "String", "name", ")", "{", "User", "user", "=", "(", "User", ")", "userList", ".", "get", "(", "name", ")", ";", "if", "(", "user", "==", "null", ")", "{", "throw", "Error", ".", "error", "(", "ErrorCode", ".", "X_2...
Returns the User object identified by the name argument.
[ "Returns", "the", "User", "object", "identified", "by", "the", "name", "argument", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rights/UserManager.java#L193-L202
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java
HashIndex.reset
void reset(int hashTableSize, int capacity) { // A VoltDB extension to diagnose ArrayOutOfBounds. if (linkTable != null) { voltDBresetCapacity = linkTable.length; } ++voltDBresetCount; voltDBlastResetEvent = voltDBhistoryDepth; voltDBhistoryCapacity = Math.min(voltDBhistoryMaxCapacity, Math.max(voltDBhistoryMinCapacity, voltDBhistoryDepth)); voltDBhistory = new int[voltDBhistoryCapacity]; // End of VoltDB extension int[] newHT = new int[hashTableSize]; int[] newLT = new int[capacity]; // allocate memory before assigning hashTable = newHT; linkTable = newLT; resetTables(); }
java
void reset(int hashTableSize, int capacity) { // A VoltDB extension to diagnose ArrayOutOfBounds. if (linkTable != null) { voltDBresetCapacity = linkTable.length; } ++voltDBresetCount; voltDBlastResetEvent = voltDBhistoryDepth; voltDBhistoryCapacity = Math.min(voltDBhistoryMaxCapacity, Math.max(voltDBhistoryMinCapacity, voltDBhistoryDepth)); voltDBhistory = new int[voltDBhistoryCapacity]; // End of VoltDB extension int[] newHT = new int[hashTableSize]; int[] newLT = new int[capacity]; // allocate memory before assigning hashTable = newHT; linkTable = newLT; resetTables(); }
[ "void", "reset", "(", "int", "hashTableSize", ",", "int", "capacity", ")", "{", "// A VoltDB extension to diagnose ArrayOutOfBounds.", "if", "(", "linkTable", "!=", "null", ")", "{", "voltDBresetCapacity", "=", "linkTable", ".", "length", ";", "}", "++", "voltDBre...
Reset the structure with a new size as empty. @param hashTableSize @param capacity
[ "Reset", "the", "structure", "with", "a", "new", "size", "as", "empty", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java#L97-L117
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java
HashIndex.clear
void clear() { // A VoltDB extension to diagnose ArrayOutOfBounds. if (linkTable != null) { voltDBclearCapacity = linkTable.length; } ++voltDBclearCount; voltDBlastClearEvent = voltDBhistoryDepth; // End of VoltDB extension int to = linkTable.length; int[] intArray = linkTable; while (--to >= 0) { intArray[to] = 0; } resetTables(); }
java
void clear() { // A VoltDB extension to diagnose ArrayOutOfBounds. if (linkTable != null) { voltDBclearCapacity = linkTable.length; } ++voltDBclearCount; voltDBlastClearEvent = voltDBhistoryDepth; // End of VoltDB extension int to = linkTable.length; int[] intArray = linkTable; while (--to >= 0) { intArray[to] = 0; } resetTables(); }
[ "void", "clear", "(", ")", "{", "// A VoltDB extension to diagnose ArrayOutOfBounds.", "if", "(", "linkTable", "!=", "null", ")", "{", "voltDBclearCapacity", "=", "linkTable", ".", "length", ";", "}", "++", "voltDBclearCount", ";", "voltDBlastClearEvent", "=", "volt...
Reset the index as empty.
[ "Reset", "the", "index", "as", "empty", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java#L137-L154
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java
HashIndex.unlinkNode
void unlinkNode(int index, int lastLookup, int lookup) { // A VoltDB extension to diagnose ArrayOutOfBounds. voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = -index-1; // End of VoltDB extension // unlink the node if (lastLookup == -1) { hashTable[index] = linkTable[lookup]; } else { linkTable[lastLookup] = linkTable[lookup]; } // add to reclaimed list linkTable[lookup] = reclaimedNodePointer; reclaimedNodePointer = lookup; elementCount--; }
java
void unlinkNode(int index, int lastLookup, int lookup) { // A VoltDB extension to diagnose ArrayOutOfBounds. voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = -index-1; // End of VoltDB extension // unlink the node if (lastLookup == -1) { hashTable[index] = linkTable[lookup]; } else { linkTable[lastLookup] = linkTable[lookup]; } // add to reclaimed list linkTable[lookup] = reclaimedNodePointer; reclaimedNodePointer = lookup; elementCount--; }
[ "void", "unlinkNode", "(", "int", "index", ",", "int", "lastLookup", ",", "int", "lookup", ")", "{", "// A VoltDB extension to diagnose ArrayOutOfBounds.", "voltDBhistory", "[", "voltDBhistoryDepth", "++", "%", "voltDBhistoryCapacity", "]", "=", "-", "index", "-", "...
Unlink a node from a linked list and link into the reclaimed list. @param index an index into hashTable @param lastLookup either -1 or the node to which the target node is linked @param lookup the node to remove
[ "Unlink", "a", "node", "from", "a", "linked", "list", "and", "link", "into", "the", "reclaimed", "list", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java#L280-L297
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java
HashIndex.removeEmptyNode
boolean removeEmptyNode(int lookup) { // A VoltDB extension to diagnose ArrayOutOfBounds. voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = 1000000 + lookup; // End of VoltDB extension boolean found = false; int lastLookup = -1; for (int i = reclaimedNodePointer; i >= 0; lastLookup = i, i = linkTable[i]) { if (i == lookup) { if (lastLookup == -1) { reclaimedNodePointer = linkTable[lookup]; } else { linkTable[lastLookup] = linkTable[lookup]; } found = true; break; } } if (!found) { return false; } for (int i = 0; i < newNodePointer; i++) { if (linkTable[i] > lookup) { linkTable[i]--; } } System.arraycopy(linkTable, lookup + 1, linkTable, lookup, newNodePointer - lookup - 1); linkTable[newNodePointer - 1] = 0; newNodePointer--; for (int i = 0; i < hashTable.length; i++) { if (hashTable[i] > lookup) { hashTable[i]--; } } return true; }
java
boolean removeEmptyNode(int lookup) { // A VoltDB extension to diagnose ArrayOutOfBounds. voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = 1000000 + lookup; // End of VoltDB extension boolean found = false; int lastLookup = -1; for (int i = reclaimedNodePointer; i >= 0; lastLookup = i, i = linkTable[i]) { if (i == lookup) { if (lastLookup == -1) { reclaimedNodePointer = linkTable[lookup]; } else { linkTable[lastLookup] = linkTable[lookup]; } found = true; break; } } if (!found) { return false; } for (int i = 0; i < newNodePointer; i++) { if (linkTable[i] > lookup) { linkTable[i]--; } } System.arraycopy(linkTable, lookup + 1, linkTable, lookup, newNodePointer - lookup - 1); linkTable[newNodePointer - 1] = 0; newNodePointer--; for (int i = 0; i < hashTable.length; i++) { if (hashTable[i] > lookup) { hashTable[i]--; } } return true; }
[ "boolean", "removeEmptyNode", "(", "int", "lookup", ")", "{", "// A VoltDB extension to diagnose ArrayOutOfBounds.", "voltDBhistory", "[", "voltDBhistoryDepth", "++", "%", "voltDBhistoryCapacity", "]", "=", "1000000", "+", "lookup", ";", "// End of VoltDB extension", "boole...
Remove a node that has already been unlinked. This is not required for index operations. It is used only when the row needs to be removed from the data structures that store the actual indexed data and the nodes need to be contiguous. @param lookup the node to remove @return true if node found in unlinked state
[ "Remove", "a", "node", "that", "has", "already", "been", "unlinked", ".", "This", "is", "not", "required", "for", "index", "operations", ".", "It", "is", "used", "only", "when", "the", "row", "needs", "to", "be", "removed", "from", "the", "data", "struct...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/HashIndex.java#L308-L355
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java
TextCache.translateSep
private static String translateSep(String sep, boolean isProperty) { if (sep == null) { return null; } int next = sep.indexOf(BACKSLASH_CHAR); if (next != -1) { int start = 0; char[] sepArray = sep.toCharArray(); char ch = 0; int len = sep.length(); StringBuffer sb = new StringBuffer(len); do { sb.append(sepArray, start, next - start); start = ++next; if (next >= len) { sb.append(BACKSLASH_CHAR); break; } if (!isProperty) { ch = sepArray[next]; } if (ch == 'n') { sb.append(LF_CHAR); start++; } else if (ch == 'r') { sb.append(CR_CHAR); start++; } else if (ch == 't') { sb.append('\t'); start++; } else if (ch == BACKSLASH_CHAR) { sb.append(BACKSLASH_CHAR); start++; } else if (ch == 'u') { start++; sb.append( (char) Integer.parseInt( sep.substring(start, start + 4), 16)); start += 4; } else if (sep.startsWith("semi", next)) { sb.append(';'); start += 4; } else if (sep.startsWith("space", next)) { sb.append(' '); start += 5; } else if (sep.startsWith("quote", next)) { sb.append(DOUBLE_QUOTE_CHAR); start += 5; } else if (sep.startsWith("apos", next)) { sb.append('\''); start += 4; } else { sb.append(BACKSLASH_CHAR); sb.append(sepArray[next]); start++; } } while ((next = sep.indexOf(BACKSLASH_CHAR, start)) != -1); sb.append(sepArray, start, len - start); sep = sb.toString(); } return sep; }
java
private static String translateSep(String sep, boolean isProperty) { if (sep == null) { return null; } int next = sep.indexOf(BACKSLASH_CHAR); if (next != -1) { int start = 0; char[] sepArray = sep.toCharArray(); char ch = 0; int len = sep.length(); StringBuffer sb = new StringBuffer(len); do { sb.append(sepArray, start, next - start); start = ++next; if (next >= len) { sb.append(BACKSLASH_CHAR); break; } if (!isProperty) { ch = sepArray[next]; } if (ch == 'n') { sb.append(LF_CHAR); start++; } else if (ch == 'r') { sb.append(CR_CHAR); start++; } else if (ch == 't') { sb.append('\t'); start++; } else if (ch == BACKSLASH_CHAR) { sb.append(BACKSLASH_CHAR); start++; } else if (ch == 'u') { start++; sb.append( (char) Integer.parseInt( sep.substring(start, start + 4), 16)); start += 4; } else if (sep.startsWith("semi", next)) { sb.append(';'); start += 4; } else if (sep.startsWith("space", next)) { sb.append(' '); start += 5; } else if (sep.startsWith("quote", next)) { sb.append(DOUBLE_QUOTE_CHAR); start += 5; } else if (sep.startsWith("apos", next)) { sb.append('\''); start += 4; } else { sb.append(BACKSLASH_CHAR); sb.append(sepArray[next]); start++; } } while ((next = sep.indexOf(BACKSLASH_CHAR, start)) != -1); sb.append(sepArray, start, len - start); sep = sb.toString(); } return sep; }
[ "private", "static", "String", "translateSep", "(", "String", "sep", ",", "boolean", "isProperty", ")", "{", "if", "(", "sep", "==", "null", ")", "{", "return", "null", ";", "}", "int", "next", "=", "sep", ".", "indexOf", "(", "BACKSLASH_CHAR", ")", ";...
Translates the escaped characters in a separator string and returns the non-escaped string.
[ "Translates", "the", "escaped", "characters", "in", "a", "separator", "string", "and", "returns", "the", "non", "-", "escaped", "string", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L223-L307
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java
TextCache.open
public void open(boolean readonly) { fileFreePosition = 0; try { dataFile = ScaledRAFile.newScaledRAFile(database, fileName, readonly, ScaledRAFile.DATA_FILE_RAF, null, null); fileFreePosition = dataFile.length(); if (fileFreePosition > Integer.MAX_VALUE) { throw new HsqlException("", "", 0); } initBuffers(); } catch (Exception e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_TextCache_openning_file_error, new Object[] { fileName, e }); } cacheReadonly = readonly; }
java
public void open(boolean readonly) { fileFreePosition = 0; try { dataFile = ScaledRAFile.newScaledRAFile(database, fileName, readonly, ScaledRAFile.DATA_FILE_RAF, null, null); fileFreePosition = dataFile.length(); if (fileFreePosition > Integer.MAX_VALUE) { throw new HsqlException("", "", 0); } initBuffers(); } catch (Exception e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_TextCache_openning_file_error, new Object[] { fileName, e }); } cacheReadonly = readonly; }
[ "public", "void", "open", "(", "boolean", "readonly", ")", "{", "fileFreePosition", "=", "0", ";", "try", "{", "dataFile", "=", "ScaledRAFile", ".", "newScaledRAFile", "(", "database", ",", "fileName", ",", "readonly", ",", "ScaledRAFile", ".", "DATA_FILE_RAF"...
Opens a data source file.
[ "Opens", "a", "data", "source", "file", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L312-L335
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java
TextCache.close
public synchronized void close(boolean write) { if (dataFile == null) { return; } try { cache.saveAll(); boolean empty = (dataFile.length() <= NL.length()); dataFile.close(); dataFile = null; if (empty && !cacheReadonly) { FileUtil.getDefaultInstance().delete(fileName); } } catch (Exception e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_TextCache_closing_file_error, new Object[] { fileName, e }); } }
java
public synchronized void close(boolean write) { if (dataFile == null) { return; } try { cache.saveAll(); boolean empty = (dataFile.length() <= NL.length()); dataFile.close(); dataFile = null; if (empty && !cacheReadonly) { FileUtil.getDefaultInstance().delete(fileName); } } catch (Exception e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_TextCache_closing_file_error, new Object[] { fileName, e }); } }
[ "public", "synchronized", "void", "close", "(", "boolean", "write", ")", "{", "if", "(", "dataFile", "==", "null", ")", "{", "return", ";", "}", "try", "{", "cache", ".", "saveAll", "(", ")", ";", "boolean", "empty", "=", "(", "dataFile", ".", "lengt...
Writes newly created rows to disk. In the current implentation, such rows have already been saved, so this method just removes a source file that has no rows.
[ "Writes", "newly", "created", "rows", "to", "disk", ".", "In", "the", "current", "implentation", "such", "rows", "have", "already", "been", "saved", "so", "this", "method", "just", "removes", "a", "source", "file", "that", "has", "no", "rows", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L346-L371
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java
TextCache.purge
void purge() { uncommittedCache.clear(); try { if (cacheReadonly) { close(false); } else { if (dataFile != null) { dataFile.close(); dataFile = null; } FileUtil.getDefaultInstance().delete(fileName); } } catch (Exception e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_TextCache_purging_file_error, new Object[] { fileName, e }); } }
java
void purge() { uncommittedCache.clear(); try { if (cacheReadonly) { close(false); } else { if (dataFile != null) { dataFile.close(); dataFile = null; } FileUtil.getDefaultInstance().delete(fileName); } } catch (Exception e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_TextCache_purging_file_error, new Object[] { fileName, e }); } }
[ "void", "purge", "(", ")", "{", "uncommittedCache", ".", "clear", "(", ")", ";", "try", "{", "if", "(", "cacheReadonly", ")", "{", "close", "(", "false", ")", ";", "}", "else", "{", "if", "(", "dataFile", "!=", "null", ")", "{", "dataFile", ".", ...
Closes the source file and deletes it if it is not read-only.
[ "Closes", "the", "source", "file", "and", "deletes", "it", "if", "it", "is", "not", "read", "-", "only", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L376-L399
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java
TextCache.findNextUsedLinePos
int findNextUsedLinePos(int pos) { try { int firstPos = pos; int currentPos = pos; boolean wasCR = false; dataFile.seek(pos); while (true) { int c = dataFile.read(); currentPos++; switch (c) { case CR_CHAR : wasCR = true; break; case LF_CHAR : wasCR = false; ((RowInputText) rowIn).skippedLine(); firstPos = currentPos; break; case ' ' : if (wasCR) { wasCR = false; ((RowInputText) rowIn).skippedLine(); } break; case -1 : return -1; default : return firstPos; } } } catch (IOException e) { throw new HsqlException(e.getMessage(), "", 0); } }
java
int findNextUsedLinePos(int pos) { try { int firstPos = pos; int currentPos = pos; boolean wasCR = false; dataFile.seek(pos); while (true) { int c = dataFile.read(); currentPos++; switch (c) { case CR_CHAR : wasCR = true; break; case LF_CHAR : wasCR = false; ((RowInputText) rowIn).skippedLine(); firstPos = currentPos; break; case ' ' : if (wasCR) { wasCR = false; ((RowInputText) rowIn).skippedLine(); } break; case -1 : return -1; default : return firstPos; } } } catch (IOException e) { throw new HsqlException(e.getMessage(), "", 0); } }
[ "int", "findNextUsedLinePos", "(", "int", "pos", ")", "{", "try", "{", "int", "firstPos", "=", "pos", ";", "int", "currentPos", "=", "pos", ";", "boolean", "wasCR", "=", "false", ";", "dataFile", ".", "seek", "(", "pos", ")", ";", "while", "(", "true...
Searches from file pointer, pos, and finds the beginning of the first line that contains any non-space character. Increments the row counter when a blank line is skipped. If none found return -1
[ "Searches", "from", "file", "pointer", "pos", "and", "finds", "the", "beginning", "of", "the", "first", "line", "that", "contains", "any", "non", "-", "space", "character", ".", "Increments", "the", "row", "counter", "when", "a", "blank", "line", "is", "sk...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L616-L662
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java
TextCache.saveRows
protected synchronized void saveRows(CachedObject[] rows, int offset, int count) { if (count == 0) { return; } for (int i = offset; i < offset + count; i++) { CachedObject r = rows[i]; uncommittedCache.put(r.getPos(), r); rows[i] = null; } }
java
protected synchronized void saveRows(CachedObject[] rows, int offset, int count) { if (count == 0) { return; } for (int i = offset; i < offset + count; i++) { CachedObject r = rows[i]; uncommittedCache.put(r.getPos(), r); rows[i] = null; } }
[ "protected", "synchronized", "void", "saveRows", "(", "CachedObject", "[", "]", "rows", ",", "int", "offset", ",", "int", "count", ")", "{", "if", "(", "count", "==", "0", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "offset", ";", "i...
This is called internally when old rows need to be removed from the cache. Text table rows that have not been saved are those that have not been committed yet. So we don't save them but add them to the uncommitted cache until such time that they are committed or rolled back- fredt
[ "This", "is", "called", "internally", "when", "old", "rows", "need", "to", "be", "removed", "from", "the", "cache", ".", "Text", "table", "rows", "that", "have", "not", "been", "saved", "are", "those", "that", "have", "not", "been", "committed", "yet", "...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L697-L711
train
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.copy
public DoubleHistogram copy() { final DoubleHistogram targetHistogram = new DoubleHistogram(configuredHighestToLowestValueRatio, getNumberOfSignificantValueDigits()); targetHistogram.setTrackableValueRange(currentLowestValueInAutoRange, currentHighestValueLimitInAutoRange); integerValuesHistogram.copyInto(targetHistogram.integerValuesHistogram); return targetHistogram; }
java
public DoubleHistogram copy() { final DoubleHistogram targetHistogram = new DoubleHistogram(configuredHighestToLowestValueRatio, getNumberOfSignificantValueDigits()); targetHistogram.setTrackableValueRange(currentLowestValueInAutoRange, currentHighestValueLimitInAutoRange); integerValuesHistogram.copyInto(targetHistogram.integerValuesHistogram); return targetHistogram; }
[ "public", "DoubleHistogram", "copy", "(", ")", "{", "final", "DoubleHistogram", "targetHistogram", "=", "new", "DoubleHistogram", "(", "configuredHighestToLowestValueRatio", ",", "getNumberOfSignificantValueDigits", "(", ")", ")", ";", "targetHistogram", ".", "setTrackabl...
Create a copy of this histogram, complete with data and everything. @return A distinct copy of this histogram.
[ "Create", "a", "copy", "of", "this", "histogram", "complete", "with", "data", "and", "everything", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L583-L589
train
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.add
public void add(final DoubleHistogram fromHistogram) throws ArrayIndexOutOfBoundsException { int arrayLength = fromHistogram.integerValuesHistogram.countsArrayLength; AbstractHistogram fromIntegerHistogram = fromHistogram.integerValuesHistogram; for (int i = 0; i < arrayLength; i++) { long count = fromIntegerHistogram.getCountAtIndex(i); if (count > 0) { recordValueWithCount( fromIntegerHistogram.valueFromIndex(i) * fromHistogram.integerToDoubleValueConversionRatio, count); } } }
java
public void add(final DoubleHistogram fromHistogram) throws ArrayIndexOutOfBoundsException { int arrayLength = fromHistogram.integerValuesHistogram.countsArrayLength; AbstractHistogram fromIntegerHistogram = fromHistogram.integerValuesHistogram; for (int i = 0; i < arrayLength; i++) { long count = fromIntegerHistogram.getCountAtIndex(i); if (count > 0) { recordValueWithCount( fromIntegerHistogram.valueFromIndex(i) * fromHistogram.integerToDoubleValueConversionRatio, count); } } }
[ "public", "void", "add", "(", "final", "DoubleHistogram", "fromHistogram", ")", "throws", "ArrayIndexOutOfBoundsException", "{", "int", "arrayLength", "=", "fromHistogram", ".", "integerValuesHistogram", ".", "countsArrayLength", ";", "AbstractHistogram", "fromIntegerHistog...
Add the contents of another histogram to this one. @param fromHistogram The other histogram. @throws ArrayIndexOutOfBoundsException (may throw) if values in fromHistogram's cannot be covered by this histogram's range
[ "Add", "the", "contents", "of", "another", "histogram", "to", "this", "one", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L665-L677
train
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.subtract
public void subtract(final DoubleHistogram otherHistogram) { int arrayLength = otherHistogram.integerValuesHistogram.countsArrayLength; AbstractHistogram otherIntegerHistogram = otherHistogram.integerValuesHistogram; for (int i = 0; i < arrayLength; i++) { long otherCount = otherIntegerHistogram.getCountAtIndex(i); if (otherCount > 0) { double otherValue = otherIntegerHistogram.valueFromIndex(i) * otherHistogram.integerToDoubleValueConversionRatio; if (getCountAtValue(otherValue) < otherCount) { throw new IllegalArgumentException("otherHistogram count (" + otherCount + ") at value " + otherValue + " is larger than this one's (" + getCountAtValue(otherValue) + ")"); } recordValueWithCount(otherValue, -otherCount); } } }
java
public void subtract(final DoubleHistogram otherHistogram) { int arrayLength = otherHistogram.integerValuesHistogram.countsArrayLength; AbstractHistogram otherIntegerHistogram = otherHistogram.integerValuesHistogram; for (int i = 0; i < arrayLength; i++) { long otherCount = otherIntegerHistogram.getCountAtIndex(i); if (otherCount > 0) { double otherValue = otherIntegerHistogram.valueFromIndex(i) * otherHistogram.integerToDoubleValueConversionRatio; if (getCountAtValue(otherValue) < otherCount) { throw new IllegalArgumentException("otherHistogram count (" + otherCount + ") at value " + otherValue + " is larger than this one's (" + getCountAtValue(otherValue) + ")"); } recordValueWithCount(otherValue, -otherCount); } } }
[ "public", "void", "subtract", "(", "final", "DoubleHistogram", "otherHistogram", ")", "{", "int", "arrayLength", "=", "otherHistogram", ".", "integerValuesHistogram", ".", "countsArrayLength", ";", "AbstractHistogram", "otherIntegerHistogram", "=", "otherHistogram", ".", ...
Subtract the contents of another histogram from this one. @param otherHistogram The other histogram. @throws ArrayIndexOutOfBoundsException (may throw) if values in fromHistogram's cannot be covered by this histogram's range
[ "Subtract", "the", "contents", "of", "another", "histogram", "from", "this", "one", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L720-L735
train
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.highestEquivalentValue
public double highestEquivalentValue(final double value) { double nextNonEquivalentValue = nextNonEquivalentValue(value); // Theoretically, nextNonEquivalentValue - ulp(nextNonEquivalentValue) == nextNonEquivalentValue // is possible (if the ulp size switches right at nextNonEquivalentValue), so drop by 2 ulps and // increment back up to closest within-ulp value. double highestEquivalentValue = nextNonEquivalentValue - (2 * Math.ulp(nextNonEquivalentValue)); while (highestEquivalentValue + Math.ulp(highestEquivalentValue) < nextNonEquivalentValue) { highestEquivalentValue += Math.ulp(highestEquivalentValue); } return highestEquivalentValue; }
java
public double highestEquivalentValue(final double value) { double nextNonEquivalentValue = nextNonEquivalentValue(value); // Theoretically, nextNonEquivalentValue - ulp(nextNonEquivalentValue) == nextNonEquivalentValue // is possible (if the ulp size switches right at nextNonEquivalentValue), so drop by 2 ulps and // increment back up to closest within-ulp value. double highestEquivalentValue = nextNonEquivalentValue - (2 * Math.ulp(nextNonEquivalentValue)); while (highestEquivalentValue + Math.ulp(highestEquivalentValue) < nextNonEquivalentValue) { highestEquivalentValue += Math.ulp(highestEquivalentValue); } return highestEquivalentValue; }
[ "public", "double", "highestEquivalentValue", "(", "final", "double", "value", ")", "{", "double", "nextNonEquivalentValue", "=", "nextNonEquivalentValue", "(", "value", ")", ";", "// Theoretically, nextNonEquivalentValue - ulp(nextNonEquivalentValue) == nextNonEquivalentValue", ...
Get the highest value that is equivalent to the given value within the histogram's resolution. Where "equivalent" means that value samples recorded for any two equivalent values are counted in a common total count. @param value The given value @return The highest value that is equivalent to the given value within the histogram's resolution.
[ "Get", "the", "highest", "value", "that", "is", "equivalent", "to", "the", "given", "value", "within", "the", "histogram", "s", "resolution", ".", "Where", "equivalent", "means", "that", "value", "samples", "recorded", "for", "any", "two", "equivalent", "value...
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L869-L880
train
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java
DoubleHistogram.decodeFromCompressedByteBuffer
public static DoubleHistogram decodeFromCompressedByteBuffer( final ByteBuffer buffer, final long minBarForHighestToLowestValueRatio) throws DataFormatException { return decodeFromCompressedByteBuffer(buffer, Histogram.class, minBarForHighestToLowestValueRatio); }
java
public static DoubleHistogram decodeFromCompressedByteBuffer( final ByteBuffer buffer, final long minBarForHighestToLowestValueRatio) throws DataFormatException { return decodeFromCompressedByteBuffer(buffer, Histogram.class, minBarForHighestToLowestValueRatio); }
[ "public", "static", "DoubleHistogram", "decodeFromCompressedByteBuffer", "(", "final", "ByteBuffer", "buffer", ",", "final", "long", "minBarForHighestToLowestValueRatio", ")", "throws", "DataFormatException", "{", "return", "decodeFromCompressedByteBuffer", "(", "buffer", ","...
Construct a new DoubleHistogram by decoding it from a compressed form in a ByteBuffer. @param buffer The buffer to decode from @param minBarForHighestToLowestValueRatio Force highestTrackableValue to be set at least this high @return The newly constructed DoubleHistogram @throws DataFormatException on error parsing/decompressing the buffer
[ "Construct", "a", "new", "DoubleHistogram", "by", "decoding", "it", "from", "a", "compressed", "form", "in", "a", "ByteBuffer", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L1529-L1533
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/util/GridSwing.java
GridSwing.getValueAt
public Object getValueAt(int row, int col) { if (row >= rows.size()) { return null; } Object[] colArray = (Object[]) rows.elementAt(row); if (col >= colArray.length) { return null; } return colArray[col]; }
java
public Object getValueAt(int row, int col) { if (row >= rows.size()) { return null; } Object[] colArray = (Object[]) rows.elementAt(row); if (col >= colArray.length) { return null; } return colArray[col]; }
[ "public", "Object", "getValueAt", "(", "int", "row", ",", "int", "col", ")", "{", "if", "(", "row", ">=", "rows", ".", "size", "(", ")", ")", "{", "return", "null", ";", "}", "Object", "[", "]", "colArray", "=", "(", "Object", "[", "]", ")", "r...
Get the object at the specified cell location.
[ "Get", "the", "object", "at", "the", "specified", "cell", "location", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/util/GridSwing.java#L172-L185
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/util/GridSwing.java
GridSwing.setHead
public void setHead(Object[] h) { headers = new Object[h.length]; // System.arraycopy(h, 0, headers, 0, h.length); for (int i = 0; i < h.length; i++) { headers[i] = h[i]; } }
java
public void setHead(Object[] h) { headers = new Object[h.length]; // System.arraycopy(h, 0, headers, 0, h.length); for (int i = 0; i < h.length; i++) { headers[i] = h[i]; } }
[ "public", "void", "setHead", "(", "Object", "[", "]", "h", ")", "{", "headers", "=", "new", "Object", "[", "h", ".", "length", "]", ";", "// System.arraycopy(h, 0, headers, 0, h.length);", "for", "(", "int", "i", "=", "0", ";", "i", "<", "h", ".", "len...
Set the name of the column headings.
[ "Set", "the", "name", "of", "the", "column", "headings", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/util/GridSwing.java#L190-L198
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/util/GridSwing.java
GridSwing.addRow
public void addRow(Object[] r) { Object[] row = new Object[r.length]; // System.arraycopy(r, 0, row, 0, r.length); for (int i = 0; i < r.length; i++) { row[i] = r[i]; if (row[i] == null) { // row[i] = "(null)"; } } rows.addElement(row); }
java
public void addRow(Object[] r) { Object[] row = new Object[r.length]; // System.arraycopy(r, 0, row, 0, r.length); for (int i = 0; i < r.length; i++) { row[i] = r[i]; if (row[i] == null) { // row[i] = "(null)"; } } rows.addElement(row); }
[ "public", "void", "addRow", "(", "Object", "[", "]", "r", ")", "{", "Object", "[", "]", "row", "=", "new", "Object", "[", "r", ".", "length", "]", ";", "// System.arraycopy(r, 0, row, 0, r.length);", "for", "(", "int", "i", "=", "0", ";", "i", "<", "...
Append a tuple to the end of the table.
[ "Append", "a", "tuple", "to", "the", "end", "of", "the", "table", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/util/GridSwing.java#L203-L218
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/navigator/RowSetNavigatorClient.java
RowSetNavigatorClient.getCurrent
public Object[] getCurrent() { if (currentPos < 0 || currentPos >= size) { return null; } if (currentPos == currentOffset + table.length) { getBlock(currentOffset + table.length); } return table[currentPos - currentOffset]; }
java
public Object[] getCurrent() { if (currentPos < 0 || currentPos >= size) { return null; } if (currentPos == currentOffset + table.length) { getBlock(currentOffset + table.length); } return table[currentPos - currentOffset]; }
[ "public", "Object", "[", "]", "getCurrent", "(", ")", "{", "if", "(", "currentPos", "<", "0", "||", "currentPos", ">=", "size", ")", "{", "return", "null", ";", "}", "if", "(", "currentPos", "==", "currentOffset", "+", "table", ".", "length", ")", "{...
Returns the current row object. Type of object is implementation defined.
[ "Returns", "the", "current", "row", "object", ".", "Type", "of", "object", "is", "implementation", "defined", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/navigator/RowSetNavigatorClient.java#L111-L122
train
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/navigator/RowSetNavigatorClient.java
RowSetNavigatorClient.getBlock
void getBlock(int offset) { try { RowSetNavigatorClient source = session.getRows(id, offset, baseBlockSize); table = source.table; currentOffset = source.currentOffset; } catch (HsqlException e) {} }
java
void getBlock(int offset) { try { RowSetNavigatorClient source = session.getRows(id, offset, baseBlockSize); table = source.table; currentOffset = source.currentOffset; } catch (HsqlException e) {} }
[ "void", "getBlock", "(", "int", "offset", ")", "{", "try", "{", "RowSetNavigatorClient", "source", "=", "session", ".", "getRows", "(", "id", ",", "offset", ",", "baseBlockSize", ")", ";", "table", "=", "source", ".", "table", ";", "currentOffset", "=", ...
baseBlockSize remains unchanged.
[ "baseBlockSize", "remains", "unchanged", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/navigator/RowSetNavigatorClient.java#L254-L263
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getBestRowIdentifier
@Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getBestRowIdentifier", "(", "String", "catalog", ",", "String", "schema", ",", "String", "table", ",", "int", "scope", ",", "boolean", "nullable", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw...
Retrieves a description of a table's optimal set of columns that uniquely identifies a row.
[ "Retrieves", "a", "description", "of", "a", "table", "s", "optimal", "set", "of", "columns", "that", "uniquely", "identifies", "a", "row", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L147-L152
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getCatalogs
@Override public ResultSet getCatalogs() throws SQLException { checkClosed(); VoltTable result = new VoltTable(new VoltTable.ColumnInfo("TABLE_CAT",VoltType.STRING)); result.addRow(new Object[] { catalogString }); return new JDBC4ResultSet(null, result); }
java
@Override public ResultSet getCatalogs() throws SQLException { checkClosed(); VoltTable result = new VoltTable(new VoltTable.ColumnInfo("TABLE_CAT",VoltType.STRING)); result.addRow(new Object[] { catalogString }); return new JDBC4ResultSet(null, result); }
[ "@", "Override", "public", "ResultSet", "getCatalogs", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "VoltTable", "result", "=", "new", "VoltTable", "(", "new", "VoltTable", ".", "ColumnInfo", "(", "\"TABLE_CAT\"", ",", "VoltType", "."...
Retrieves the catalog names available in this database.
[ "Retrieves", "the", "catalog", "names", "available", "in", "this", "database", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L155-L162
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getDatabaseMajorVersion
@Override public int getDatabaseMajorVersion() throws SQLException { checkClosed(); System.out.println("\n\n\nVERSION: " + versionString); return Integer.valueOf(versionString.split("\\.")[0]); }
java
@Override public int getDatabaseMajorVersion() throws SQLException { checkClosed(); System.out.println("\n\n\nVERSION: " + versionString); return Integer.valueOf(versionString.split("\\.")[0]); }
[ "@", "Override", "public", "int", "getDatabaseMajorVersion", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\\n\\n\\nVERSION: \"", "+", "versionString", ")", ";", "return", "Integer", ".", "...
Retrieves the major version number of the underlying database.
[ "Retrieves", "the", "major", "version", "number", "of", "the", "underlying", "database", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L250-L256
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getFunctions
@Override public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getFunctions", "(", "String", "catalog", ",", "String", "schemaPattern", ",", "String", "functionNamePattern", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ...
Retrieves a description of the system and user functions available in the given catalog.
[ "Retrieves", "a", "description", "of", "the", "system", "and", "user", "functions", "available", "in", "the", "given", "catalog", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L370-L375
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getPrimaryKeys
@Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { assert(table != null && !table.isEmpty()); checkClosed(); this.sysCatalog.setString(1, "PRIMARYKEYS"); JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery(); VoltTable vtable = res.getVoltTable().clone(0); // Filter the primary keys based on table name while (res.next()) { if (res.getString("TABLE_NAME").equals(table)) { vtable.addRow(res.getRowData()); } } return new JDBC4ResultSet(sysCatalog, vtable); }
java
@Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { assert(table != null && !table.isEmpty()); checkClosed(); this.sysCatalog.setString(1, "PRIMARYKEYS"); JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery(); VoltTable vtable = res.getVoltTable().clone(0); // Filter the primary keys based on table name while (res.next()) { if (res.getString("TABLE_NAME").equals(table)) { vtable.addRow(res.getRowData()); } } return new JDBC4ResultSet(sysCatalog, vtable); }
[ "@", "Override", "public", "ResultSet", "getPrimaryKeys", "(", "String", "catalog", ",", "String", "schema", ",", "String", "table", ")", "throws", "SQLException", "{", "assert", "(", "table", "!=", "null", "&&", "!", "table", ".", "isEmpty", "(", ")", ")"...
Retrieves a description of the given table's primary key columns.
[ "Retrieves", "a", "description", "of", "the", "given", "table", "s", "primary", "key", "columns", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L621-L637
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getSchemas
@Override public ResultSet getSchemas() throws SQLException { checkClosed(); VoltTable vtable = new VoltTable( new ColumnInfo("TABLE_SCHEM", VoltType.STRING), new ColumnInfo("TABLE_CATALOG", VoltType.STRING)); JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable); return res; }
java
@Override public ResultSet getSchemas() throws SQLException { checkClosed(); VoltTable vtable = new VoltTable( new ColumnInfo("TABLE_SCHEM", VoltType.STRING), new ColumnInfo("TABLE_CATALOG", VoltType.STRING)); JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable); return res; }
[ "@", "Override", "public", "ResultSet", "getSchemas", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "VoltTable", "vtable", "=", "new", "VoltTable", "(", "new", "ColumnInfo", "(", "\"TABLE_SCHEM\"", ",", "VoltType", ".", "STRING", ")", ...
Retrieves the schema names available in this database.
[ "Retrieves", "the", "schema", "names", "available", "in", "this", "database", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L702-L711
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getTablePrivileges
@Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { checkClosed(); VoltTable vtable = new VoltTable( new ColumnInfo("TABLE_CAT", VoltType.STRING), new ColumnInfo("TABLE_SCHEM", VoltType.STRING), new ColumnInfo("TABLE_NAME", VoltType.STRING), new ColumnInfo("GRANTOR", VoltType.STRING), new ColumnInfo("GRANTEE", VoltType.STRING), new ColumnInfo("PRIVILEGE", VoltType.STRING), new ColumnInfo("IS_GRANTABLE", VoltType.STRING) ); //NB: @SystemCatalog(?) will need additional support if we want to // populate the table. JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable); return res; }
java
@Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { checkClosed(); VoltTable vtable = new VoltTable( new ColumnInfo("TABLE_CAT", VoltType.STRING), new ColumnInfo("TABLE_SCHEM", VoltType.STRING), new ColumnInfo("TABLE_NAME", VoltType.STRING), new ColumnInfo("GRANTOR", VoltType.STRING), new ColumnInfo("GRANTEE", VoltType.STRING), new ColumnInfo("PRIVILEGE", VoltType.STRING), new ColumnInfo("IS_GRANTABLE", VoltType.STRING) ); //NB: @SystemCatalog(?) will need additional support if we want to // populate the table. JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable); return res; }
[ "@", "Override", "public", "ResultSet", "getTablePrivileges", "(", "String", "catalog", ",", "String", "schemaPattern", ",", "String", "tableNamePattern", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "VoltTable", "vtable", "=", "new", "VoltTab...
Retrieves a description of the access rights for each table available in a catalog.
[ "Retrieves", "a", "description", "of", "the", "access", "rights", "for", "each", "table", "available", "in", "a", "catalog", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L788-L805
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.computeJavaPattern
public static Pattern computeJavaPattern(String sqlPattern) { StringBuffer pattern_buff = new StringBuffer(); // Replace "_" with "." (match exactly 1 character) // Replace "%" with ".*" (match 0 or more characters) for (int i=0; i<sqlPattern.length(); i++) { char c = sqlPattern.charAt(i); if (c == '_') { pattern_buff.append('.'); } else if (c == '%') { pattern_buff.append(".*"); } else pattern_buff.append(c); } return Pattern.compile(pattern_buff.toString()); }
java
public static Pattern computeJavaPattern(String sqlPattern) { StringBuffer pattern_buff = new StringBuffer(); // Replace "_" with "." (match exactly 1 character) // Replace "%" with ".*" (match 0 or more characters) for (int i=0; i<sqlPattern.length(); i++) { char c = sqlPattern.charAt(i); if (c == '_') { pattern_buff.append('.'); } else if (c == '%') { pattern_buff.append(".*"); } else pattern_buff.append(c); } return Pattern.compile(pattern_buff.toString()); }
[ "public", "static", "Pattern", "computeJavaPattern", "(", "String", "sqlPattern", ")", "{", "StringBuffer", "pattern_buff", "=", "new", "StringBuffer", "(", ")", ";", "// Replace \"_\" with \".\" (match exactly 1 character)", "// Replace \"%\" with \".*\" (match 0 or more charact...
Convert the users VoltDB SQL pattern into a regex pattern
[ "Convert", "the", "users", "VoltDB", "SQL", "pattern", "into", "a", "regex", "pattern" ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L808-L829
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getTables
@Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { checkClosed(); this.sysCatalog.setString(1, "TABLES"); JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery(); VoltTable vtable = res.getVoltTable().clone(0); List<String> typeStrings = null; if (types != null) { typeStrings = Arrays.asList(types); } // If no pattern is specified, default to matching any/all. if (tableNamePattern == null || tableNamePattern.length() == 0) { tableNamePattern = "%"; } Pattern table_pattern = computeJavaPattern(tableNamePattern); // Filter tables based on type and pattern while (res.next()) { if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) { Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME")); if (table_matcher.matches()) { vtable.addRow(res.getRowData()); } } } return new JDBC4ResultSet(this.sysCatalog, vtable); }
java
@Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { checkClosed(); this.sysCatalog.setString(1, "TABLES"); JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery(); VoltTable vtable = res.getVoltTable().clone(0); List<String> typeStrings = null; if (types != null) { typeStrings = Arrays.asList(types); } // If no pattern is specified, default to matching any/all. if (tableNamePattern == null || tableNamePattern.length() == 0) { tableNamePattern = "%"; } Pattern table_pattern = computeJavaPattern(tableNamePattern); // Filter tables based on type and pattern while (res.next()) { if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) { Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME")); if (table_matcher.matches()) { vtable.addRow(res.getRowData()); } } } return new JDBC4ResultSet(this.sysCatalog, vtable); }
[ "@", "Override", "public", "ResultSet", "getTables", "(", "String", "catalog", ",", "String", "schemaPattern", ",", "String", "tableNamePattern", ",", "String", "[", "]", "types", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "this", ".", ...
Retrieves a description of the tables available in the given catalog.
[ "Retrieves", "a", "description", "of", "the", "tables", "available", "in", "the", "given", "catalog", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L832-L865
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getTableTypes
@Override public ResultSet getTableTypes() throws SQLException { checkClosed(); VoltTable vtable = new VoltTable(new ColumnInfo("TABLE_TYPE", VoltType.STRING)); for (String type : tableTypes) { vtable.addRow(type); } JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable); return res; }
java
@Override public ResultSet getTableTypes() throws SQLException { checkClosed(); VoltTable vtable = new VoltTable(new ColumnInfo("TABLE_TYPE", VoltType.STRING)); for (String type : tableTypes) { vtable.addRow(type); } JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable); return res; }
[ "@", "Override", "public", "ResultSet", "getTableTypes", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "VoltTable", "vtable", "=", "new", "VoltTable", "(", "new", "ColumnInfo", "(", "\"TABLE_TYPE\"", ",", "VoltType", ".", "STRING", ")"...
Retrieves the table types available in this database.
[ "Retrieves", "the", "table", "types", "available", "in", "this", "database", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L868-L878
train
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getTypeInfo
@Override public ResultSet getTypeInfo() throws SQLException { checkClosed(); this.sysCatalog.setString(1, "TYPEINFO"); ResultSet res = this.sysCatalog.executeQuery(); return res; }
java
@Override public ResultSet getTypeInfo() throws SQLException { checkClosed(); this.sysCatalog.setString(1, "TYPEINFO"); ResultSet res = this.sysCatalog.executeQuery(); return res; }
[ "@", "Override", "public", "ResultSet", "getTypeInfo", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "this", ".", "sysCatalog", ".", "setString", "(", "1", ",", "\"TYPEINFO\"", ")", ";", "ResultSet", "res", "=", "this", ".", "sysCa...
Retrieves a description of all the data types supported by this database.
[ "Retrieves", "a", "description", "of", "all", "the", "data", "types", "supported", "by", "this", "database", "." ]
8afc1031e475835344b5497ea9e7203bc95475ac
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L892-L899
train