You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/11/21 15:50:15 UTC
svn commit: r1204526 -
/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/
Author: kwright
Date: Mon Nov 21 14:50:14 2011
New Revision: 1204526
URL: http://svn.apache.org/viewvc?rev=1204526&view=rev
Log:
Instead of linking rowIDs and nodeIDs back and forth, just use the same ID, since there's a correspondence.
Removed:
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeIDFactoryKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeRowRefKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexRowNodeRefKey.java
Modified:
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Index.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexAccessor.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeEqualsKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeGreaterKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeLesserKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeParentKey.java
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableStore.java
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Index.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Index.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Index.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Index.java Mon Nov 21 14:50:14 2011
@@ -107,17 +107,12 @@ public class Index implements WHIndex
// The algorithm here simply involves finding the right spot and adding a new node at that point.
// We should also rebalance the tree at that point, but that's going to be implemented in phase II.
- // First, create the new node
- long newNodeID = allocateNextIndexNode();
- // Set the rowID pointer for the new node, and visa versa.
- setIndexNodeTableRow(newNodeID,rowID);
-
- addNodeInto(newNodeID,new IndexRootKey(indexName),rowID);
+ addNodeInto(rowID,new IndexRootKey(indexName));
}
/** Method to add a given node into a subtree where we start only with a parent key.
*/
- protected void addNodeInto(long newNodeID, WHKey parentKey, long rowID)
+ protected void addNodeInto(long rowID, WHKey parentKey)
throws WHException
{
// Keep going until we've found the insertion point
@@ -125,11 +120,11 @@ public class Index implements WHIndex
while (true)
{
// Pick up the current node from the parent
- long currentNodeID = readIndexParentChild(parentKey);
- if (currentNodeID == -1L)
+ long currentRowID = readIndexParentChild(parentKey);
+ if (currentRowID == -1L)
{
// Our new node is the root node; set the root node accordingly
- setIndexParentChild(parentKey,newNodeID);
+ setIndexParentChild(parentKey,rowID);
return;
}
@@ -143,28 +138,26 @@ public class Index implements WHIndex
}
}
- // We evaluate against the row described by the current node ID, which means we need to fetch it
- long nodeRowID = readIndexNodeTableRow(currentNodeID);
// Loop through the index columns
boolean newNodeFound = false;
for (int i = 0 ; i < columnNames.length; i++)
{
String currentColumn = columnNames[i];
// Get the value from the row, so we can fire the comparator
- WHValue currentValue = table.getValue(nodeRowID,currentColumn);
+ WHValue currentValue = table.getValue(currentRowID,currentColumn);
int comparatorResult = comparators[i].compare(currentValue,newRowIndexValues[i]);
// Based on the result, decide which way to go
- long nextNodeID;
+ long nextRowID;
switch (comparatorResult)
{
case WHComparator.RESULT_LESS:
// Descend the lesser tree for this column.
- parentKey = new IndexNodeLesserKey(indexName,currentNodeID,currentColumn);
+ parentKey = new IndexNodeLesserKey(indexName,currentRowID,currentColumn);
newNodeFound = true;
break;
case WHComparator.RESULT_GREATER:
// Descend the greater tree for this column.
- parentKey = new IndexNodeGreaterKey(indexName,currentNodeID,currentColumn);
+ parentKey = new IndexNodeGreaterKey(indexName,currentRowID,currentColumn);
newNodeFound = true;
break;
case WHComparator.RESULT_EQUALS:
@@ -195,19 +188,19 @@ public class Index implements WHIndex
// We insert the new node at the beginning of the chain so we don't have to scan it, obviously...
// First, get the old ref, if there is one.
- long currentEqualsNode = readIndexNodeEqualsNode(currentNodeID);
+ long currentEqualsRowID = readIndexNodeEqualsNode(currentRowID);
// Move the old pointer to the new position
- if (currentEqualsNode != -1L)
+ if (currentEqualsRowID != -1L)
{
// Delete the old one
- deleteIndexNodeEqualsNode(currentNodeID);
+ deleteIndexNodeEqualsNode(currentRowID);
// Move the pointer to the child of the node we just created
- setIndexNodeEqualsNode(newNodeID,currentEqualsNode);
+ setIndexNodeEqualsNode(rowID,currentEqualsRowID);
}
// Now, set the new ref.
- setIndexNodeEqualsNode(currentNodeID,newNodeID);
+ setIndexNodeEqualsNode(currentRowID,rowID);
return;
}
@@ -221,10 +214,8 @@ public class Index implements WHIndex
// The strategy for deletion is to use the back pointers to locate everything we need and then locally adjust the
// tree.
- // First, find the nodeID corresponding to the rowID we're deleting
- long deleteNodeID = readTableRowIndexNode(rowID);
- // Also find its parent
- WHKey parentKey = readIndexNodeParentKey(deleteNodeID);
+ // Find its parent
+ WHKey parentKey = readIndexNodeParentKey(rowID);
// There are a number of standard situations we look for which maintain the invariant, before we
// resort to more expensive operations. These are listed below.
@@ -239,32 +230,30 @@ public class Index implements WHIndex
// of these child nodes must be inserted into the node that is being promoted as if it were a new node.
// Look for an 'equals' child
- long equalsChild = readIndexNodeEqualsNode(deleteNodeID);
+ long equalsChild = readIndexNodeEqualsNode(rowID);
if (equalsChild != -1L)
{
// Case (1) (as described above). Promote the child.
- deleteIndexNodeEqualsNode(deleteNodeID);
+ deleteIndexNodeEqualsNode(rowID);
deleteIndexParentChild(parentKey);
setIndexParentChild(parentKey,equalsChild);
// Now, transfer the delete node's lesser/greater children to the equalsChild.
for (int i = 0 ; i < columnNames.length ; i++)
{
String currentColumn = columnNames[i];
- long lesserChild = readIndexNodeLesserNode(deleteNodeID,currentColumn);
+ long lesserChild = readIndexNodeLesserNode(rowID,currentColumn);
if (lesserChild != -1L)
{
- deleteIndexNodeLesserNode(deleteNodeID,currentColumn);
+ deleteIndexNodeLesserNode(rowID,currentColumn);
setIndexNodeLesserNode(equalsChild,currentColumn,lesserChild);
}
- long greaterChild = readIndexNodeGreaterNode(deleteNodeID,currentColumn);
+ long greaterChild = readIndexNodeGreaterNode(rowID,currentColumn);
if (greaterChild != -1L)
{
- deleteIndexNodeGreaterNode(deleteNodeID,currentColumn);
+ deleteIndexNodeGreaterNode(rowID,currentColumn);
setIndexNodeGreaterNode(equalsChild,currentColumn,greaterChild);
}
}
- // Now remove the index reference to the rowID, and we're done
- deleteIndexNodeTableRow(deleteNodeID);
return;
}
@@ -281,18 +270,18 @@ public class Index implements WHIndex
for (int i = 0 ; i < columnNames.length ; i++)
{
String currentColumn = columnNames[i];
- promotionCandidate = readIndexNodeLesserNode(deleteNodeID,currentColumn);
+ promotionCandidate = readIndexNodeLesserNode(rowID,currentColumn);
if (promotionCandidate != -1L)
{
// We found our promotion candidate!
- deleteIndexNodeLesserNode(deleteNodeID,currentColumn);
+ deleteIndexNodeLesserNode(rowID,currentColumn);
break;
}
- promotionCandidate = readIndexNodeGreaterNode(deleteNodeID,currentColumn);
+ promotionCandidate = readIndexNodeGreaterNode(rowID,currentColumn);
if (promotionCandidate != -1L)
{
// Candidate found
- deleteIndexNodeGreaterNode(deleteNodeID,currentColumn);
+ deleteIndexNodeGreaterNode(rowID,currentColumn);
break;
}
}
@@ -305,27 +294,24 @@ public class Index implements WHIndex
for (int i = 0 ; i < columnNames.length ; i++)
{
String currentColumn = columnNames[i];
- long lesserChild = readIndexNodeLesserNode(deleteNodeID,currentColumn);
+ long lesserChild = readIndexNodeLesserNode(rowID,currentColumn);
if (lesserChild != -1L)
{
// Peel it away from the deleteNodeID
- deleteIndexNodeLesserNode(deleteNodeID,currentColumn);
+ deleteIndexNodeLesserNode(rowID,currentColumn);
// Now insert this node into promotionCandidate via parentKey
- addNodeInto(lesserChild,parentKey,readIndexNodeTableRow(lesserChild));
+ addNodeInto(lesserChild,parentKey);
}
- long greaterChild = readIndexNodeGreaterNode(deleteNodeID,currentColumn);
+ long greaterChild = readIndexNodeGreaterNode(rowID,currentColumn);
if (greaterChild != -1L)
{
// Delete the reference from the deletion node
- deleteIndexNodeGreaterNode(deleteNodeID,currentColumn);
+ deleteIndexNodeGreaterNode(rowID,currentColumn);
// Now insert this node into promotionCandidate via parentKey
- addNodeInto(greaterChild,parentKey,readIndexNodeTableRow(greaterChild));
+ addNodeInto(greaterChild,parentKey);
}
}
}
-
- // Delete the row reference, to complete the node destruction.
- deleteIndexNodeTableRow(deleteNodeID);
}
/** Initialize an entire index.
@@ -365,8 +351,6 @@ public class Index implements WHIndex
// Delete the child.
// First, unlink from the parent.
deleteIndexParentChild(key);
- // Delete the link to the table row.
- deleteIndexNodeTableRow(child);
// Recursively clean up all child links.
deleteSubtree(new IndexNodeEqualsKey(indexName,child));
for (int i = 0 ; i < columnNames.length ; i++)
@@ -378,95 +362,35 @@ public class Index implements WHIndex
}
// Protected methods
-
- /** Allocate the next index node number.
- */
- protected long allocateNextIndexNode()
- throws WHException
- {
- IndexNodeIDFactoryKey tlk = new IndexNodeIDFactoryKey(indexName);
- LongValue tlv = (LongValue)ts.get(tlk);
- if (tlv == null)
- throw new WHDeadlockException();
- long rval = tlv.getValue();
- ts.put(tlk,new LongValue(rval+1L));
- return rval;
- }
-
-
- /** Get the table row for an index node.
- */
- protected long readIndexNodeTableRow(long nodeID)
- throws WHException
- {
- LongValue rowID = (LongValue)ts.get(new IndexNodeRowRefKey(indexName,nodeID));
- if (rowID == null)
- throw new WHDeadlockException();
- return rowID.getValue();
- }
-
- /** Get the index node for a table row.
- */
- protected long readTableRowIndexNode(long rowID)
- throws WHException
- {
- LongValue nodeID = (LongValue)ts.get(new IndexRowNodeRefKey(indexName,rowID));
- if (nodeID == null)
- throw new WHDeadlockException();
- return nodeID.getValue();
- }
-
- /** Set the table row for an index node, and visa versa. Presumes that no such reference already exists.
- */
- protected void setIndexNodeTableRow(long nodeID, long rowID)
- throws WHException
- {
- // Sets both forward and back pointers!!
- ts.put(new IndexNodeRowRefKey(indexName,nodeID),new LongValue(rowID));
- ts.put(new IndexRowNodeRefKey(indexName,rowID),new LongValue(nodeID));
- }
-
- /** Delete the table row for an index node. Presumes that there is a non-null reference.
- */
- protected void deleteIndexNodeTableRow(long nodeID)
- throws WHException
- {
- IndexNodeRowRefKey key = new IndexNodeRowRefKey(indexName,nodeID);
- LongValue rowIDRef = (LongValue)ts.get(key);
- if (rowIDRef == null)
- throw new WHDeadlockException();
- ts.put(key,null);
- ts.put(new IndexRowNodeRefKey(indexName,rowIDRef.getValue()),null);
- }
/** Get the lesser child reference for an index node.
*/
- protected long readIndexNodeLesserNode(long nodeID, String columnName)
+ protected long readIndexNodeLesserNode(long rowID, String columnName)
throws WHException
{
- LongValue outNodeID = (LongValue)ts.get(new IndexNodeLesserKey(indexName,nodeID,columnName));
- if (outNodeID == null)
+ LongValue outRowID = (LongValue)ts.get(new IndexNodeLesserKey(indexName,rowID,columnName));
+ if (outRowID == null)
return -1L;
- return outNodeID.getValue();
+ return outRowID.getValue();
}
/** Set the lesser child reference for an index node. Presumes that no such reference already exists.
*/
- protected void setIndexNodeLesserNode(long nodeID, String columnName, long refNodeID)
+ protected void setIndexNodeLesserNode(long rowID, String columnName, long refRowID)
throws WHException
{
- IndexNodeLesserKey key = new IndexNodeLesserKey(indexName,nodeID,columnName);
- IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refNodeID);
- ts.put(key,new LongValue(refNodeID));
+ IndexNodeLesserKey key = new IndexNodeLesserKey(indexName,rowID,columnName);
+ IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID);
+ ts.put(key,new LongValue(refRowID));
ts.put(parentKey,key);
}
/** Delete the lesser child reference for an index node. Presumes that the reference exists.
*/
- protected void deleteIndexNodeLesserNode(long nodeID, String columnName)
+ protected void deleteIndexNodeLesserNode(long rowID, String columnName)
throws WHException
{
- IndexNodeLesserKey key = new IndexNodeLesserKey(indexName,nodeID,columnName);
+ IndexNodeLesserKey key = new IndexNodeLesserKey(indexName,rowID,columnName);
LongValue childReference = (LongValue)ts.get(key);
if (childReference == null)
throw new WHDeadlockException();
@@ -477,32 +401,32 @@ public class Index implements WHIndex
/** Get the greater child reference for an index node.
*/
- protected long readIndexNodeGreaterNode(long nodeID, String columnName)
+ protected long readIndexNodeGreaterNode(long rowID, String columnName)
throws WHException
{
- LongValue outNodeID = (LongValue)ts.get(new IndexNodeGreaterKey(indexName,nodeID,columnName));
- if (outNodeID == null)
+ LongValue outRowID = (LongValue)ts.get(new IndexNodeGreaterKey(indexName,rowID,columnName));
+ if (outRowID == null)
return -1L;
- return outNodeID.getValue();
+ return outRowID.getValue();
}
/** Set the greater child reference for an index node. Presumes that the reference is currently empty.
*/
- protected void setIndexNodeGreaterNode(long nodeID, String columnName, long refNodeID)
+ protected void setIndexNodeGreaterNode(long rowID, String columnName, long refRowID)
throws WHException
{
- IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexName,nodeID,columnName);
- IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refNodeID);
- ts.put(key,new LongValue(refNodeID));
+ IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexName,rowID,columnName);
+ IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID);
+ ts.put(key,new LongValue(refRowID));
ts.put(parentKey,key);
}
/** Delete the greater child reference for an index node. Presumes that the reference exists.
*/
- protected void deleteIndexNodeGreaterNode(long nodeID, String columnName)
+ protected void deleteIndexNodeGreaterNode(long rowID, String columnName)
throws WHException
{
- IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexName,nodeID,columnName);
+ IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexName,rowID,columnName);
LongValue childReference = (LongValue)ts.get(key);
if (childReference == null)
throw new WHDeadlockException();
@@ -513,32 +437,32 @@ public class Index implements WHIndex
/** Get the equals child reference for an index node.
*/
- protected long readIndexNodeEqualsNode(long nodeID)
+ protected long readIndexNodeEqualsNode(long rowID)
throws WHException
{
- LongValue outNodeID = (LongValue)ts.get(new IndexNodeEqualsKey(indexName,nodeID));
- if (outNodeID == null)
+ LongValue outRowID = (LongValue)ts.get(new IndexNodeEqualsKey(indexName,rowID));
+ if (outRowID == null)
return -1L;
- return outNodeID.getValue();
+ return outRowID.getValue();
}
/** Set the equals child reference for an index node. Presumes that a reference doesn't yet exist.
*/
- protected void setIndexNodeEqualsNode(long nodeID, long refNodeID)
+ protected void setIndexNodeEqualsNode(long rowID, long refRowID)
throws WHException
{
- IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexName,nodeID);
- IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refNodeID);
- ts.put(key,new LongValue(refNodeID));
+ IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexName,rowID);
+ IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID);
+ ts.put(key,new LongValue(refRowID));
ts.put(parentKey,key);
}
/** Delete the equals child reference for an index node. Presumes that the reference exists.
*/
- protected void deleteIndexNodeEqualsNode(long nodeID)
+ protected void deleteIndexNodeEqualsNode(long rowID)
throws WHException
{
- IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexName,nodeID);
+ IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexName,rowID);
LongValue childReference = (LongValue)ts.get(key);
if (childReference == null)
throw new WHDeadlockException();
@@ -549,10 +473,10 @@ public class Index implements WHIndex
/** Get the parent reference for an index node.
*/
- protected WHKey readIndexNodeParentKey(long nodeID)
+ protected WHKey readIndexNodeParentKey(long rowID)
throws WHException
{
- WHKey rval = (WHKey)ts.get(new IndexNodeParentKey(indexName,nodeID));
+ WHKey rval = (WHKey)ts.get(new IndexNodeParentKey(indexName,rowID));
if (rval == null)
throw new WHDeadlockException();
return rval;
@@ -571,11 +495,11 @@ public class Index implements WHIndex
/** Set an index parent's child node. Presumes this child is not set yet.
*/
- protected void setIndexParentChild(WHKey parentKey, long nodeID)
+ protected void setIndexParentChild(WHKey parentKey, long rowID)
throws WHException
{
- ts.put(parentKey,new LongValue(nodeID));
- ts.put(new IndexNodeParentKey(indexName,nodeID),parentKey);
+ ts.put(parentKey,new LongValue(rowID));
+ ts.put(new IndexNodeParentKey(indexName,rowID),parentKey);
}
/** Remove an index parent's child node reference. Presumes that this child exists.
@@ -596,20 +520,20 @@ public class Index implements WHIndex
protected long readIndexRootNode()
throws WHException
{
- LongValue outNodeID = (LongValue)ts.get(new IndexRootKey(indexName));
- if (outNodeID == null)
+ LongValue outRowID = (LongValue)ts.get(new IndexRootKey(indexName));
+ if (outRowID == null)
return -1L;
- return outNodeID.getValue();
+ return outRowID.getValue();
}
/** Set the root pointer for an index. Presumes the root pointer does not currently exist.
*/
- protected void setIndexRootNode(long rootNodeID)
+ protected void setIndexRootNode(long rootRowID)
throws WHException
{
IndexRootKey key = new IndexRootKey(indexName);
- IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,rootNodeID);
- ts.put(key,new LongValue(rootNodeID));
+ IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,rootRowID);
+ ts.put(key,new LongValue(rootRowID));
ts.put(parentKey,key);
}
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexAccessor.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexAccessor.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexAccessor.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexAccessor.java Mon Nov 21 14:50:14 2011
@@ -57,9 +57,9 @@ public class IndexAccessor implements WH
this.indexColumns = index.getColumnNames();
this.comparators = index.getComparators();
this.indexCriteria = indexCriteria;
- long rootNodeID = index.readIndexRootNode();
- if (rootNodeID != -1L)
- queue.pushNeedsAnalysis(rootNodeID);
+ long rootRowID = index.readIndexRootNode();
+ if (rootRowID != -1L)
+ queue.pushNeedsAnalysis(rootRowID);
}
/** Are there any more rows?
@@ -96,17 +96,17 @@ public class IndexAccessor implements WH
if (node.getAction() == ACTION_DEREFERENCE)
{
- nextRowID = index.readIndexNodeTableRow(node.getNodeID());
+ nextRowID = node.getRowID();
return nextRowID;
}
if (node.getAction() == ACTION_CHASE_EQUALS)
{
// We can skip all analysis, and just chase the equals chain.
- long nodeID = node.getNodeID();
- queue.pushNeedsDereference(nodeID);
+ long rowID = node.getRowID();
+ queue.pushNeedsDereference(rowID);
// Now find the next node in the equals chain.
- long nextEqualsNode = index.readIndexNodeEqualsNode(nodeID);
+ long nextEqualsNode = index.readIndexNodeEqualsNode(rowID);
if (nextEqualsNode != -1L)
{
// Because it's equals chain, we know that it is unnecessary to evaluate its fields, so note that when
@@ -124,7 +124,7 @@ public class IndexAccessor implements WH
// We can only add at the beginning of the queue, so we must be careful to push
// nodes in backwards order!!
- handleColumn(node.getNodeID(),0);
+ handleColumn(node.getRowID(),0);
// Back around until we have a node, or until we hit the end
}
@@ -132,15 +132,15 @@ public class IndexAccessor implements WH
/** Handle a single column with the correct ordering of nodes on the queue.
*/
- protected void handleColumn(long nodeID, int columnIndex)
+ protected void handleColumn(long rowID, int columnIndex)
throws WHException
{
if (columnIndex == indexColumns.length)
{
// We hit the end, which means we've got a match.
- queue.pushNeedsDereference(nodeID);
+ queue.pushNeedsDereference(rowID);
// Now find the next node in the equals chain.
- long nextEqualsNode = index.readIndexNodeEqualsNode(nodeID);
+ long nextEqualsNode = index.readIndexNodeEqualsNode(rowID);
if (nextEqualsNode != -1L)
{
// Because it's equals chain, we know that it is unnecessary to evaluate its fields, so note that when
@@ -152,8 +152,6 @@ public class IndexAccessor implements WH
// Evaluate this column
String currentColumn = indexColumns[columnIndex];
- // Get the table row
- long rowID = index.readIndexNodeTableRow(nodeID);
// Get the column value
WHValue columnValue = index.getTable().getValue(rowID,currentColumn);
@@ -168,22 +166,22 @@ public class IndexAccessor implements WH
if ((criteria & IndexCriteria.SIGNAL_GREATER) != 0)
{
// Dereference the greater child for this column and push that node for analysis
- long childNodeID = index.readIndexNodeGreaterNode(nodeID,currentColumn);
- if (childNodeID != -1L)
- queue.pushNeedsAnalysis(childNodeID);
+ long childRowID = index.readIndexNodeGreaterNode(rowID,currentColumn);
+ if (childRowID != -1L)
+ queue.pushNeedsAnalysis(childRowID);
}
if ((criteria & IndexCriteria.SIGNAL_EQUALS) != 0)
{
// We want to continue on to the next column, or if we're at the end, we take the
// row ID.
- handleColumn(nodeID,columnIndex+1);
+ handleColumn(rowID,columnIndex+1);
}
if ((criteria & IndexCriteria.SIGNAL_LESSER) != 0)
{
// Dereference the lesser child for this column and push that node for analysis
- long childNodeID = index.readIndexNodeLesserNode(nodeID,currentColumn);
- if (childNodeID != -1L)
- queue.pushNeedsAnalysis(childNodeID);
+ long childRowID = index.readIndexNodeLesserNode(rowID,currentColumn);
+ if (childRowID != -1L)
+ queue.pushNeedsAnalysis(childRowID);
}
}
@@ -204,19 +202,19 @@ public class IndexAccessor implements WH
{
}
- public void pushNeedsAnalysis(long nodeID)
+ public void pushNeedsAnalysis(long rowID)
{
- nodeList.add(new Node(nodeID,ACTION_FULL_ANALYSIS));
+ nodeList.add(new Node(rowID,ACTION_FULL_ANALYSIS));
}
- public void pushChaseEquals(long nodeID)
+ public void pushChaseEquals(long rowID)
{
- nodeList.add(new Node(nodeID,ACTION_CHASE_EQUALS));
+ nodeList.add(new Node(rowID,ACTION_CHASE_EQUALS));
}
- public void pushNeedsDereference(long nodeID)
+ public void pushNeedsDereference(long rowID)
{
- nodeList.add(new Node(nodeID,ACTION_DEREFERENCE));
+ nodeList.add(new Node(rowID,ACTION_DEREFERENCE));
}
public Node pop()
@@ -230,21 +228,21 @@ public class IndexAccessor implements WH
/** A node in the queue */
protected static class Node
{
- protected long nodeID;
+ protected long rowID;
protected int action;
/** Constructor */
- public Node(long nodeID, int action)
+ public Node(long rowID, int action)
{
- this.nodeID = nodeID;
+ this.rowID = rowID;
this.action = action;
}
/** Get the node id.
*/
- public long getNodeID()
+ public long getRowID()
{
- return nodeID;
+ return rowID;
}
/** Get whether this node should be treated as needing dereference or needing analysis.
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeEqualsKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeEqualsKey.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeEqualsKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeEqualsKey.java Mon Nov 21 14:50:14 2011
@@ -26,20 +26,20 @@ import org.apache.warthog.common.*;
public class IndexNodeEqualsKey implements WHKey
{
protected String indexName;
- protected long nodeID;
+ protected long rowID;
/** Constructor */
- public IndexNodeEqualsKey(String indexName, long nodeID)
+ public IndexNodeEqualsKey(String indexName, long rowID)
{
this.indexName = indexName;
- this.nodeID = nodeID;
+ this.rowID = rowID;
}
public IndexNodeEqualsKey(byte[] data)
{
BufferPointer bp = new BufferPointer(data);
this.indexName = StringKey.readObject(bp);
- this.nodeID = LongKey.readObject(bp);
+ this.rowID = LongKey.readObject(bp);
}
public byte[] serializeObject()
@@ -48,20 +48,20 @@ public class IndexNodeEqualsKey implemen
LongKey.sizeObject()];
BufferPointer bp = new BufferPointer(rval);
StringKey.writeObject(bp,indexName);
- LongKey.writeObject(bp,nodeID);
+ LongKey.writeObject(bp,rowID);
return rval;
}
public long getHashCode()
{
- return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(nodeID);
+ return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(rowID);
}
public boolean isEquals(WHKey o)
{
IndexNodeEqualsKey key = (IndexNodeEqualsKey)o;
return key.indexName.equals(indexName) &&
- key.nodeID == nodeID;
+ key.rowID == rowID;
}
}
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeGreaterKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeGreaterKey.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeGreaterKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeGreaterKey.java Mon Nov 21 14:50:14 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
public class IndexNodeGreaterKey extends IndexNodeKey
{
/** Constructor */
- public IndexNodeGreaterKey(String indexName, long nodeID, String columnName)
+ public IndexNodeGreaterKey(String indexName, long rowID, String columnName)
{
- super(indexName,nodeID,columnName);
+ super(indexName,rowID,columnName);
}
public IndexNodeGreaterKey(byte[] data)
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeKey.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeKey.java Mon Nov 21 14:50:14 2011
@@ -26,14 +26,14 @@ import org.apache.warthog.common.*;
public class IndexNodeKey implements WHKey
{
protected String indexName;
- protected long nodeID;
+ protected long rowID;
protected String columnName;
/** Constructor */
- public IndexNodeKey(String indexName, long nodeID, String columnName)
+ public IndexNodeKey(String indexName, long rowID, String columnName)
{
this.indexName = indexName;
- this.nodeID = nodeID;
+ this.rowID = rowID;
this.columnName = columnName;
}
@@ -41,7 +41,7 @@ public class IndexNodeKey implements WHK
{
BufferPointer bp = new BufferPointer(data);
this.indexName = StringKey.readObject(bp);
- this.nodeID = LongKey.readObject(bp);
+ this.rowID = LongKey.readObject(bp);
this.columnName = StringKey.readObject(bp);
}
@@ -51,14 +51,14 @@ public class IndexNodeKey implements WHK
LongKey.sizeObject() + StringKey.sizeObject(columnName)];
BufferPointer bp = new BufferPointer(rval);
StringKey.writeObject(bp,indexName);
- LongKey.writeObject(bp,nodeID);
+ LongKey.writeObject(bp,rowID);
StringKey.writeObject(bp,columnName);
return rval;
}
public long getHashCode()
{
- return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(nodeID) +
+ return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(rowID) +
StringKey.calculateHashCode(columnName);
}
@@ -66,7 +66,7 @@ public class IndexNodeKey implements WHK
{
IndexNodeKey key = (IndexNodeKey)o;
return key.indexName.equals(indexName) &&
- key.nodeID == nodeID &&
+ key.rowID == rowID &&
key.columnName.equals(columnName);
}
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeLesserKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeLesserKey.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeLesserKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeLesserKey.java Mon Nov 21 14:50:14 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
public class IndexNodeLesserKey extends IndexNodeKey
{
/** Constructor */
- public IndexNodeLesserKey(String indexName, long nodeID, String columnName)
+ public IndexNodeLesserKey(String indexName, long rowID, String columnName)
{
- super(indexName,nodeID,columnName);
+ super(indexName,rowID,columnName);
}
public IndexNodeLesserKey(byte[] data)
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeParentKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeParentKey.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeParentKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeParentKey.java Mon Nov 21 14:50:14 2011
@@ -27,20 +27,20 @@ import org.apache.warthog.common.*;
public class IndexNodeParentKey implements WHKey
{
protected String indexName;
- protected long nodeID;
+ protected long rowID;
/** Constructor */
- public IndexNodeParentKey(String indexName, long nodeID)
+ public IndexNodeParentKey(String indexName, long rowID)
{
this.indexName = indexName;
- this.nodeID = nodeID;
+ this.rowID = rowID;
}
public IndexNodeParentKey(byte[] data)
{
BufferPointer bp = new BufferPointer(data);
this.indexName = StringKey.readObject(bp);
- this.nodeID = LongKey.readObject(bp);
+ this.rowID = LongKey.readObject(bp);
}
public byte[] serializeObject()
@@ -49,20 +49,20 @@ public class IndexNodeParentKey implemen
LongKey.sizeObject()];
BufferPointer bp = new BufferPointer(rval);
StringKey.writeObject(bp,indexName);
- LongKey.writeObject(bp,nodeID);
+ LongKey.writeObject(bp,rowID);
return rval;
}
public long getHashCode()
{
- return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(nodeID);
+ return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(rowID);
}
public boolean isEquals(WHKey o)
{
IndexNodeParentKey key = (IndexNodeParentKey)o;
return key.indexName.equals(indexName) &&
- key.nodeID == nodeID;
+ key.rowID == rowID;
}
}
Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableStore.java?rev=1204526&r1=1204525&r2=1204526&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableStore.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableStore.java Mon Nov 21 14:50:14 2011
@@ -166,8 +166,6 @@ public class TableStore implements WHTab
tiv = new StringArray(newIndexList);
currentTransaction.put(tik,tiv);
indexesPerTable.remove(t.getName());
- IndexNodeIDFactoryKey tlk = new IndexNodeIDFactoryKey(name);
- currentTransaction.put(tlk,new LongValue(0L));
i.initialize();
return i;
}
@@ -309,7 +307,6 @@ public class TableStore implements WHTab
// Clean out the index definition and other associated keys, and blow away cached copies
indexes.remove(i.getName());
currentTransaction.put(new IndexKey(i.getName()),null);
- currentTransaction.put(new IndexNodeIDFactoryKey(i.getName()),null);
}
/** Find a table definition given its name.