incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1207727 - in /incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog: common/ interfaces/ tablestore/
Date Tue, 29 Nov 2011 01:12:17 GMT
Author: kwright
Date: Tue Nov 29 01:12:13 2011
New Revision: 1207727

URL: http://svn.apache.org/viewvc?rev=1207727&view=rev
Log:
Use table and index identifiers instead of directly using names.  In theory this should allow performance improvements for hashing and comparison.

Added:
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java   (with props)
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java   (with props)
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java   (with props)
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java   (with props)
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java   (with props)
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java   (with props)
Modified:
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java
    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/IndexKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeColumnKey.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/IndexRootKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Table.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableColumnKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableHeadKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableIndexKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowIDFactoryKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowNextKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowPrevKey.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableStore.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableTailKey.java

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java?rev=1207727&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java Tue Nov 29 01:12:13 2011
@@ -0,0 +1,127 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.common;
+
+import org.apache.warthog.interfaces.*;
+
+/** Long array, serializable.
+*/
+public class LongArray implements WHValue
+{
+  long[] value;
+  
+  public LongArray(long[] value)
+  {
+    this.value = value;
+  }
+  
+  public LongArray()
+  {
+  }
+  
+  public LongArray(byte[] bytes)
+  {
+    value = readObject(new BufferPointer(bytes));
+  }
+  
+  public byte[] serializeObject()
+  {
+    byte[] rval = new byte[sizeObject(value.length)];
+    writeObject(new BufferPointer(rval),value);
+    return rval;
+  }
+  
+  public long[] getValue()
+  {
+    return value;
+  }
+
+  /** Check if equals (classes must already agree) */
+  public boolean isEquals(WHValue value)
+  {
+    long[] otherValue = ((LongArray)value).value;
+    return compareObject(this.value,otherValue);
+  }
+
+  public int hashCode()
+  {
+    int rval = 0;
+    for (int i = 0 ; i < value.length ; i++)
+    {
+      rval += (((int)value[i]) << 5) ^ (((int)value[i]) >> 3);
+    }
+    return rval;
+  }
+  
+  public boolean equals(Object o)
+  {
+    if (!(o instanceof LongArray))
+      return false;
+    LongArray sa = (LongArray)o;
+    if (sa.value.length != value.length)
+      return false;
+    for (int i = 0 ; i < value.length ; i++)
+    {
+      if (sa.value[i] != value[i])
+        return false;
+    }
+    return true;
+  }
+
+  public static long[] readObject(BufferPointer bp)
+  {
+    int size = IntegerValue.readObject(bp);
+    long[] rval = new long[size];
+    for (int i = 0 ; i < size ; i++)
+    {
+      rval[i] = LongValue.readObject(bp);
+    }
+    return rval;
+  }
+  
+  public static int sizeObject(int size)
+  {
+    return IntegerValue.sizeObject() + LongValue.sizeObject() * size;
+  }
+  
+  public static void writeObject(BufferPointer bp, long[] value)
+  {
+    IntegerValue.writeObject(bp,value.length);
+    for (int i = 0 ; i < value.length ; i++)
+    {
+      LongValue.writeObject(bp,value[i]);
+    }
+  }
+  
+  public static boolean compareObject(long[] value, long[] otherValue)
+  {
+    if (otherValue.length != value.length)
+      return false;
+    for (int i = 0 ; i < otherValue.length ; i++)
+    {
+      if (otherValue[i] != value[i])
+        return false;
+    }
+    return true;
+  }
+  
+}
+
+

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java Tue Nov 29 01:12:13 2011
@@ -24,11 +24,6 @@ package org.apache.warthog.interfaces;
 */
 public interface WHIndex extends WHRelationship
 {
-  /** Get the index name.
-  */
-  public String getName()
-    throws WHException;
-
   /** Get the relationship the index applies to.
   */
   public WHRelationship getRelationship()

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java Tue Nov 29 01:12:13 2011
@@ -25,11 +25,6 @@ package org.apache.warthog.interfaces;
 */
 public interface WHTable extends WHRelationship
 {
-  /** Get the table name.
-  */
-  public String getName()
-    throws WHException;
-
   /** Insert a row */
   public void insertRow(String[] columns, WHValue[] values)
     throws WHException;

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java?rev=1207727&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java Tue Nov 29 01:12:13 2011
@@ -0,0 +1,53 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.tablestore;
+
+import org.apache.warthog.interfaces.*;
+import org.apache.warthog.common.*;
+
+/** Key for accessing the general ID factory */
+public class GeneralIDFactoryKey implements WHKey
+{
+  /** Constructor */
+  public GeneralIDFactoryKey()
+  {
+  }
+    
+  public GeneralIDFactoryKey(byte[] data)
+  {
+  }
+
+  public byte[] serializeObject()
+  {
+    return new byte[0];
+  }
+  
+  /** Calculate the hash function. */
+  public long getHashCode()
+  {
+    return 15335L;
+  }
+
+  public boolean isEquals(WHValue value)
+  {
+    return true;
+  }
+
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/GeneralIDFactoryKey.java
------------------------------------------------------------------------------
    svn:keywords = Id

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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -56,20 +56,20 @@ public class Index implements WHIndex
 {
   protected TableStore ts;
   protected Table table;
-  protected String indexName;
+  protected LongValue indexID;
   protected String[] columnNames;
   protected WHComparator[] comparators;
   protected boolean unique;
   
   /** Constructor */
-  public Index(TableStore ts, Table table, String indexName, String[] columnNames, String[] comparatorClasses, boolean unique)
+  public Index(TableStore ts, LongValue indexID, Table table, String[] columnNames, String[] comparatorClasses, boolean unique)
     throws WHException
   {
     if (columnNames.length != comparatorClasses.length)
       throw new WHException("Number of index column names must match number of comparator classes");
     this.ts = ts;
     this.table = table;
-    this.indexName = indexName;
+    this.indexID = indexID;
     this.columnNames = columnNames;
     this.unique = unique;
     this.comparators = new WHComparator[comparatorClasses.length];
@@ -82,7 +82,7 @@ public class Index implements WHIndex
     }
     catch (Exception e)
     {
-      throw new WHException("Error instantiating comparator class for index '"+indexName+"': "+e.getMessage(),e);
+      throw new WHException("Error instantiating comparator class for index '"+new Long(indexID.getValue()).toString()+"': "+e.getMessage(),e);
     }
   }
   
@@ -137,16 +137,15 @@ public class Index implements WHIndex
       throw new WHException("Criteria count must match index column count");
     return new IndexAccessor(this,criteria);
   }
-  
-  /** Get the index name */
-  public String getName()
-    throws WHException
-  {
-    return indexName;
-  }
 
   // Below this line are methods that are not meant to be used for general purposes,
 
+  /** Get the index id */
+  protected LongValue getID()
+  {
+    return indexID;
+  }
+  
   protected Table getTable()
   {
     return table;
@@ -168,7 +167,7 @@ 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.
     
-    addNodeInto(rowID,new IndexRootKey(indexName));
+    addNodeInto(rowID,new IndexRootKey(indexID.getValue()));
   }
   
   /** Method to add a given node into a subtree where we start only with a parent key.
@@ -207,7 +206,7 @@ public class Index implements WHIndex
       {
         // Set the node in place
         setIndexParentChild(parentKey,columnName,rowID);
-        return new IndexNodeColumnKey(indexName,rowID.getValue(),columnName);
+        return new IndexNodeColumnKey(indexID.getValue(),rowID.getValue(),columnName);
       }
 
       //if (hitSoFar.contains(currentRowID))
@@ -225,11 +224,11 @@ public class Index implements WHIndex
       {
       case WHComparator.RESULT_LESS:
         // Descend the lesser tree for this column.
-        parentKey = new IndexNodeLesserKey(indexName,currentRowID.getValue(),columnName);
+        parentKey = new IndexNodeLesserKey(indexID.getValue(),currentRowID.getValue(),columnName);
         continue;
       case WHComparator.RESULT_GREATER:
         // Descend the greater tree for this column.
-        parentKey = new IndexNodeGreaterKey(indexName,currentRowID.getValue(),columnName);
+        parentKey = new IndexNodeGreaterKey(indexID.getValue(),currentRowID.getValue(),columnName);
         continue;
       case WHComparator.RESULT_EQUALS:
         // Insert here!  into the chain if need be...
@@ -241,7 +240,7 @@ public class Index implements WHIndex
       if (unique && columnIndex +1 == columnNames.length)
       {
         // Unique constraint violation
-        throw new WHUniqueConstraintViolationException("Row "+new Long(rowID.getValue()).toString()+" violates uniqueness constraint on index "+indexName);
+        throw new WHUniqueConstraintViolationException("Row "+new Long(rowID.getValue()).toString()+" violates uniqueness constraint on index "+new Long(indexID.getValue()).toString());
       }
       
       // We keep a linked list of identical nodes.  We can insert into that chain at any point.
@@ -262,7 +261,7 @@ public class Index implements WHIndex
       // Now, set the new ref.
       setIndexNodeEqualsNode(currentRowID,columnName,rowID);
       
-      return new IndexNodeColumnKey(indexName,currentRowID.getValue(),columnName);
+      return new IndexNodeColumnKey(indexID.getValue(),currentRowID.getValue(),columnName);
     }
   }
   
@@ -396,7 +395,7 @@ public class Index implements WHIndex
   protected void remove()
     throws WHException
   {
-    deleteBtree(new IndexRootKey(indexName),0);
+    deleteBtree(new IndexRootKey(indexID.getValue()),0);
   }
   
   /** Delete a single btree with specified column index.
@@ -418,11 +417,11 @@ public class Index implements WHIndex
     // First, unlink from the parent.
     deleteIndexParentChild(key,columnName);
     // Recursively clean up all child links.
-    deleteBtree(new IndexNodeEqualsKey(indexName,child.getValue(),columnName),indexColumn);
-    deleteBtree(new IndexNodeLesserKey(indexName,child.getValue(),columnName),indexColumn);
-    deleteBtree(new IndexNodeGreaterKey(indexName,child.getValue(),columnName),indexColumn);
+    deleteBtree(new IndexNodeEqualsKey(indexID.getValue(),child.getValue(),columnName),indexColumn);
+    deleteBtree(new IndexNodeLesserKey(indexID.getValue(),child.getValue(),columnName),indexColumn);
+    deleteBtree(new IndexNodeGreaterKey(indexID.getValue(),child.getValue(),columnName),indexColumn);
     // Move on to next column
-    deleteBtree(new IndexNodeColumnKey(indexName,child.getValue(),columnName),indexColumn+1);
+    deleteBtree(new IndexNodeColumnKey(indexID.getValue(),child.getValue(),columnName),indexColumn+1);
   }
   
   // Protected methods
@@ -433,7 +432,7 @@ public class Index implements WHIndex
   protected LongValue readIndexNodeColumnNode(LongValue rowID, String columnName)
     throws WHException
   {
-    return (LongValue)ts.get(new IndexNodeColumnKey(indexName,rowID.getValue(),columnName));
+    return (LongValue)ts.get(new IndexNodeColumnKey(indexID.getValue(),rowID.getValue(),columnName));
   }
   
   /** Set next column's root node for an index node.
@@ -441,8 +440,8 @@ public class Index implements WHIndex
   protected void setIndexNodeColumnNode(LongValue rowID, String columnName, LongValue refRowID)
     throws WHException
   {
-    IndexNodeColumnKey key = new IndexNodeColumnKey(indexName,rowID.getValue(),columnName);
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID.getValue(),columnName);
+    IndexNodeColumnKey key = new IndexNodeColumnKey(indexID.getValue(),rowID.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),refRowID.getValue(),columnName);
     ts.put(key,refRowID);
     ts.put(parentKey,key);
   }
@@ -452,11 +451,11 @@ public class Index implements WHIndex
   protected void deleteIndexNodeColumnNode(LongValue rowID, String columnName)
     throws WHException
   {
-    IndexNodeColumnKey key = new IndexNodeColumnKey(indexName,rowID.getValue(),columnName);
+    IndexNodeColumnKey key = new IndexNodeColumnKey(indexID.getValue(),rowID.getValue(),columnName);
     LongValue childReference = (LongValue)ts.get(key);
     if (childReference == null)
       throw new WHConcurrencyException();
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,childReference.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),childReference.getValue(),columnName);
     ts.put(key,null);
     ts.put(parentKey,null);
   }
@@ -466,7 +465,7 @@ public class Index implements WHIndex
   protected LongValue readIndexNodeLesserNode(LongValue rowID, String columnName)
     throws WHException
   {
-    return (LongValue)ts.get(new IndexNodeLesserKey(indexName,rowID.getValue(),columnName));
+    return (LongValue)ts.get(new IndexNodeLesserKey(indexID.getValue(),rowID.getValue(),columnName));
   }
 
   /** Set the lesser child reference for an index node.  Presumes that no such reference already exists.
@@ -474,8 +473,8 @@ public class Index implements WHIndex
   protected void setIndexNodeLesserNode(LongValue rowID, String columnName, LongValue refRowID)
     throws WHException
   {
-    IndexNodeLesserKey key = new IndexNodeLesserKey(indexName,rowID.getValue(),columnName);
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID.getValue(),columnName);
+    IndexNodeLesserKey key = new IndexNodeLesserKey(indexID.getValue(),rowID.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),refRowID.getValue(),columnName);
     ts.put(key,refRowID);
     ts.put(parentKey,key);
   }
@@ -485,11 +484,11 @@ public class Index implements WHIndex
   protected void deleteIndexNodeLesserNode(LongValue rowID, String columnName)
     throws WHException
   {
-    IndexNodeLesserKey key = new IndexNodeLesserKey(indexName,rowID.getValue(),columnName);
+    IndexNodeLesserKey key = new IndexNodeLesserKey(indexID.getValue(),rowID.getValue(),columnName);
     LongValue childReference = (LongValue)ts.get(key);
     if (childReference == null)
       throw new WHConcurrencyException();
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,childReference.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),childReference.getValue(),columnName);
     ts.put(key,null);
     ts.put(parentKey,null);
   }
@@ -499,7 +498,7 @@ public class Index implements WHIndex
   protected LongValue readIndexNodeGreaterNode(LongValue rowID, String columnName)
     throws WHException
   {
-    return (LongValue)ts.get(new IndexNodeGreaterKey(indexName,rowID.getValue(),columnName));
+    return (LongValue)ts.get(new IndexNodeGreaterKey(indexID.getValue(),rowID.getValue(),columnName));
   }
   
   /** Set the greater child reference for an index node.  Presumes that the reference is currently empty.
@@ -507,8 +506,8 @@ public class Index implements WHIndex
   protected void setIndexNodeGreaterNode(LongValue rowID, String columnName, LongValue refRowID)
     throws WHException
   {
-    IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexName,rowID.getValue(),columnName);
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID.getValue(),columnName);
+    IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexID.getValue(),rowID.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),refRowID.getValue(),columnName);
     ts.put(key,refRowID);
     ts.put(parentKey,key);
   }
@@ -518,11 +517,11 @@ public class Index implements WHIndex
   protected void deleteIndexNodeGreaterNode(LongValue rowID, String columnName)
     throws WHException
   {
-    IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexName,rowID.getValue(),columnName);
+    IndexNodeGreaterKey key = new IndexNodeGreaterKey(indexID.getValue(),rowID.getValue(),columnName);
     LongValue childReference = (LongValue)ts.get(key);
     if (childReference == null)
       throw new WHConcurrencyException();
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,childReference.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),childReference.getValue(),columnName);
     ts.put(key,null);
     ts.put(parentKey,null);
   }
@@ -532,7 +531,7 @@ public class Index implements WHIndex
   protected LongValue readIndexNodeEqualsNode(LongValue rowID, String columnName)
     throws WHException
   {
-    return (LongValue)ts.get(new IndexNodeEqualsKey(indexName,rowID.getValue(),columnName));
+    return (LongValue)ts.get(new IndexNodeEqualsKey(indexID.getValue(),rowID.getValue(),columnName));
   }
   
   /** Set the equals child reference for an index node.  Presumes that a reference doesn't yet exist.
@@ -540,8 +539,8 @@ public class Index implements WHIndex
   protected void setIndexNodeEqualsNode(LongValue rowID, String columnName, LongValue refRowID)
     throws WHException
   {
-    IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexName,rowID.getValue(),columnName);
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,refRowID.getValue(),columnName);
+    IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexID.getValue(),rowID.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),refRowID.getValue(),columnName);
     ts.put(key,refRowID);
     ts.put(parentKey,key);
   }
@@ -551,11 +550,11 @@ public class Index implements WHIndex
   protected void deleteIndexNodeEqualsNode(LongValue rowID, String columnName)
     throws WHException
   {
-    IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexName,rowID.getValue(),columnName);
+    IndexNodeEqualsKey key = new IndexNodeEqualsKey(indexID.getValue(),rowID.getValue(),columnName);
     LongValue childReference = (LongValue)ts.get(key);
     if (childReference == null)
       throw new WHConcurrencyException();
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,childReference.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),childReference.getValue(),columnName);
     ts.put(key,null);
     ts.put(parentKey,null);
   }
@@ -565,7 +564,7 @@ public class Index implements WHIndex
   protected WHKey readIndexNodeParentKey(LongValue rowID, String columnName)
     throws WHException
   {
-    WHKey rval = (WHKey)ts.get(new IndexNodeParentKey(indexName,rowID.getValue(),columnName));
+    WHKey rval = (WHKey)ts.get(new IndexNodeParentKey(indexID.getValue(),rowID.getValue(),columnName));
     if (rval == null)
       throw new WHConcurrencyException();
     return rval;
@@ -585,7 +584,7 @@ public class Index implements WHIndex
     throws WHException
   {
     ts.put(parentKey,rowID);
-    ts.put(new IndexNodeParentKey(indexName,rowID.getValue(),columnName),parentKey);
+    ts.put(new IndexNodeParentKey(indexID.getValue(),rowID.getValue(),columnName),parentKey);
   }
   
   /** Remove an index parent's child node reference.  Presumes that this child exists.
@@ -598,7 +597,7 @@ public class Index implements WHIndex
     if (childNodeRef == null)
       throw new WHConcurrencyException();
     ts.put(parentKey,null);
-    ts.put(new IndexNodeParentKey(indexName,childNodeRef.getValue(),columnName),null);
+    ts.put(new IndexNodeParentKey(indexID.getValue(),childNodeRef.getValue(),columnName),null);
   }
   
   /** Get the root pointer for an index.
@@ -606,7 +605,7 @@ public class Index implements WHIndex
   protected LongValue readIndexRootNode()
     throws WHException
   {
-    return (LongValue)ts.get(new IndexRootKey(indexName));
+    return (LongValue)ts.get(new IndexRootKey(indexID.getValue()));
   }
   
   /** Set the root pointer for an index.  Presumes the root pointer does not currently exist.
@@ -614,8 +613,8 @@ public class Index implements WHIndex
   protected void setIndexRootNode(LongValue rootRowID, String columnName)
     throws WHException
   {
-    IndexRootKey key = new IndexRootKey(indexName);
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,rootRowID.getValue(),columnName);
+    IndexRootKey key = new IndexRootKey(indexID.getValue());
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),rootRowID.getValue(),columnName);
     ts.put(key,rootRowID);
     ts.put(parentKey,key);
   }
@@ -625,11 +624,11 @@ public class Index implements WHIndex
   protected void deleteIndexRootNode(String columnName)
     throws WHException
   {
-    IndexRootKey key = new IndexRootKey(indexName);
+    IndexRootKey key = new IndexRootKey(indexID.getValue());
     LongValue childReference = (LongValue)ts.get(key);
     if (childReference == null)
       throw new WHConcurrencyException();
-    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexName,childReference.getValue(),columnName);
+    IndexNodeParentKey parentKey = new IndexNodeParentKey(indexID.getValue(),childReference.getValue(),columnName);
     ts.put(key,null);
     ts.put(parentKey,null);
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexKey.java Tue Nov 29 01:12:13 2011
@@ -23,12 +23,12 @@ import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
 /** Key for accessing an index definition */
-public class IndexKey extends StringKey
+public class IndexKey extends LongKey
 {
   /** Constructor */
-  public IndexKey(String name)
+  public IndexKey(long indexID)
   {
-    super(name);
+    super(indexID);
   }
     
   public IndexKey(byte[] data)

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java?rev=1207727&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java Tue Nov 29 01:12:13 2011
@@ -0,0 +1,38 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.tablestore;
+
+import org.apache.warthog.interfaces.*;
+import org.apache.warthog.common.*;
+
+/** Key for accessing an index identifier */
+public class IndexLookupKey extends StringKey
+{
+  /** Constructor */
+  public IndexLookupKey(String name)
+  {
+    super(name);
+  }
+    
+  public IndexLookupKey(byte[] data)
+  {
+    super(data);
+  }
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexLookupKey.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java?rev=1207727&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java Tue Nov 29 01:12:13 2011
@@ -0,0 +1,38 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.tablestore;
+
+import org.apache.warthog.interfaces.*;
+import org.apache.warthog.common.*;
+
+/** Key class for accessing index name given ID */
+public class IndexNameKey extends LongKey
+{
+  /** Constructor */
+  public IndexNameKey(long indexID)
+  {
+    super(indexID);
+  }
+    
+  public IndexNameKey(byte[] data)
+  {
+    super(data);
+  }
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNameKey.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeColumnKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeColumnKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeColumnKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexNodeColumnKey.java Tue Nov 29 01:12:13 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
 public class IndexNodeColumnKey extends IndexNodeKey
 {
   /** Constructor */
-  public IndexNodeColumnKey(String indexName, long rowID, String columnName)
+  public IndexNodeColumnKey(long indexID, long rowID, String columnName)
   {
-    super(indexName,rowID,columnName);
+    super(indexID,rowID,columnName);
   }
     
   public IndexNodeColumnKey(byte[] data)

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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
 public class IndexNodeEqualsKey extends IndexNodeKey
 {
   /** Constructor */
-  public IndexNodeEqualsKey(String indexName, long rowID, String columnName)
+  public IndexNodeEqualsKey(long indexID, long rowID, String columnName)
   {
-    super(indexName,rowID,columnName);
+    super(indexID,rowID,columnName);
   }
     
   public IndexNodeEqualsKey(byte[] data)

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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
 public class IndexNodeGreaterKey extends IndexNodeKey
 {
   /** Constructor */
-  public IndexNodeGreaterKey(String indexName, long rowID, String columnName)
+  public IndexNodeGreaterKey(long indexID, long rowID, String columnName)
   {
-    super(indexName,rowID,columnName);
+    super(indexID,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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -25,36 +25,36 @@ import org.apache.warthog.common.*;
 /** Base class for node lesser/greater keys */
 public class IndexNodeKey implements WHKey
 {
-  protected String indexName;
+  protected long indexID;
   protected long rowID;
   protected String columnName;
   
   protected long hashCodeValue;
     
   /** Constructor */
-  public IndexNodeKey(String indexName, long rowID, String columnName)
+  public IndexNodeKey(long indexID, long rowID, String columnName)
   {
-    this.indexName = indexName;
+    this.indexID = indexID;
     this.rowID = rowID;
     this.columnName = columnName;
-    hashCodeValue = calculateHashCode(indexName,rowID,columnName);
+    hashCodeValue = calculateHashCode(indexID,rowID,columnName);
   }
     
   public IndexNodeKey(byte[] data)
   {
     BufferPointer bp = new BufferPointer(data);
-    this.indexName = StringKey.readObject(bp);
+    this.indexID = LongKey.readObject(bp);
     this.rowID = LongKey.readObject(bp);
     this.columnName = StringKey.readObject(bp);
-    hashCodeValue = calculateHashCode(indexName,rowID,columnName);
+    hashCodeValue = calculateHashCode(indexID,rowID,columnName);
   }
 
   public byte[] serializeObject()
   {
-    byte[] rval = new byte[StringKey.sizeObject(indexName)+
+    byte[] rval = new byte[LongKey.sizeObject()+
       LongKey.sizeObject() + StringKey.sizeObject(columnName)];
     BufferPointer bp = new BufferPointer(rval);
-    StringKey.writeObject(bp,indexName);
+    LongKey.writeObject(bp,indexID);
     LongKey.writeObject(bp,rowID);
     StringKey.writeObject(bp,columnName);
     return rval;
@@ -65,16 +65,16 @@ public class IndexNodeKey implements WHK
     return hashCodeValue;
   }
   
-  public static long calculateHashCode(String indexName, long rowID, String columnName)
+  public static long calculateHashCode(long indexID, long rowID, String columnName)
   {
-    return StringKey.calculateHashCode(indexName) + LongKey.calculateHashCode(rowID) +
+    return LongKey.calculateHashCode(indexID) + LongKey.calculateHashCode(rowID) +
       StringKey.calculateHashCode(columnName);
   }
     
   public boolean isEquals(WHValue o)
   {
     IndexNodeKey key = (IndexNodeKey)o;
-    return key.indexName.equals(indexName) &&
+    return key.indexID == indexID &&
       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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
 public class IndexNodeLesserKey extends IndexNodeKey
 {
   /** Constructor */
-  public IndexNodeLesserKey(String indexName, long rowID, String columnName)
+  public IndexNodeLesserKey(long indexID, long rowID, String columnName)
   {
-    super(indexName,rowID,columnName);
+    super(indexID,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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -27,9 +27,9 @@ import org.apache.warthog.common.*;
 public class IndexNodeParentKey extends IndexNodeKey
 {
   /** Constructor */
-  public IndexNodeParentKey(String indexName, long rowID, String columnName)
+  public IndexNodeParentKey(long indexID, long rowID, String columnName)
   {
-    super(indexName,rowID,columnName);
+    super(indexID,rowID,columnName);
   }
     
   public IndexNodeParentKey(byte[] data)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexRootKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexRootKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexRootKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexRootKey.java Tue Nov 29 01:12:13 2011
@@ -23,12 +23,12 @@ import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
 /** Key for the btree root node link */
-public class IndexRootKey extends StringKey
+public class IndexRootKey extends LongKey
 {
   /** Constructor */
-  public IndexRootKey(String indexName)
+  public IndexRootKey(long indexID)
   {
-    super(indexName);
+    super(indexID);
   }
     
   public IndexRootKey(byte[] data)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java Tue Nov 29 01:12:13 2011
@@ -25,15 +25,15 @@ import org.apache.warthog.common.*;
 /** An index definition value */
 public class IndexValue implements WHValue
 {
-  protected String tableName;
+  protected long tableID;
   protected String[] columnNames;
   protected String[] comparatorClassNames;
   protected boolean unique;
     
   /** Constructor */
-  public IndexValue(String tableName, String[] columnNames, String[] comparatorClassNames, boolean unique)
+  public IndexValue(long tableID, String[] columnNames, String[] comparatorClassNames, boolean unique)
   {
-    this.tableName = tableName;
+    this.tableID = tableID;
     this.columnNames = columnNames;
     this.comparatorClassNames = comparatorClassNames;
     this.unique = unique;
@@ -42,7 +42,7 @@ public class IndexValue implements WHVal
   public IndexValue(byte[] data)
   {
     BufferPointer bp = new BufferPointer(data);
-    tableName = StringValue.readObject(bp);
+    tableID = LongValue.readObject(bp);
     columnNames = StringArray.readObject(bp);
     comparatorClassNames = StringArray.readObject(bp);
     unique = BooleanValue.readObject(bp);
@@ -50,12 +50,12 @@ public class IndexValue implements WHVal
     
   public byte[] serializeObject()
   {
-    byte[] rval = new byte[StringValue.sizeObject(tableName) +
+    byte[] rval = new byte[LongValue.sizeObject() +
       StringArray.sizeObject(columnNames) +
       StringArray.sizeObject(comparatorClassNames) +
       BooleanValue.sizeObject()];
     BufferPointer bp = new BufferPointer(rval);
-    StringValue.writeObject(bp,tableName);
+    LongValue.writeObject(bp,tableID);
     StringArray.writeObject(bp,columnNames);
     StringArray.writeObject(bp,comparatorClassNames);
     BooleanValue.writeObject(bp,unique);
@@ -66,17 +66,17 @@ public class IndexValue implements WHVal
   public boolean isEquals(WHValue value)
   {
     IndexValue other = (IndexValue)value;
-    return other.tableName.equals(this.tableName) &&
+    return other.tableID == this.tableID &&
       StringArray.compareObject(other.columnNames,this.columnNames) &&
       StringArray.compareObject(other.comparatorClassNames,this.comparatorClassNames) &&
       other.unique == this.unique;
   }
   
-  public String getTableName()
+  public long getTableID()
   {
-    return tableName;
+    return tableID;
   }
-    
+  
   public String[] getColumnNames()
   {
     return columnNames;

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Table.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Table.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Table.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/Table.java Tue Nov 29 01:12:13 2011
@@ -28,14 +28,14 @@ import java.util.*;
 public class Table implements WHTable
 {
   protected TableStore ts;
-  protected String tableName;
+  protected LongValue tableID;
   protected String[] columns;
   
   /** Constructor */
-  public Table(TableStore ts, String tableName, String[] columns)
+  public Table(TableStore ts, LongValue tableID, String[] columns)
   {
     this.ts = ts;
-    this.tableName = tableName;
+    this.tableID = tableID;
     this.columns = columns;
   }
   
@@ -54,15 +54,14 @@ public class Table implements WHTable
     if (columns.length != values.length)
       throw new WHException("Column count must agree with value count");
     // Allocate the row
-    LongValue rowID = ts.allocateNewTableRow(tableName);
-    //LongValue rowID = allocateNewTableRow();
+    LongValue rowID = ts.allocateNewTableRow(tableID);
     // Set the values
     for (int i = 0 ; i < columns.length ; i++)
     {
       setTableColumnValue(rowID,columns[i],values[i]);
     }
     // Add to all indices
-    ts.addIndexRow(tableName,rowID,null);
+    ts.addIndexRow(tableID,rowID,null);
     // Last, link in the row.  Do it last to reduce chances of collision.
     addTableRow(rowID);
   }
@@ -93,14 +92,14 @@ public class Table implements WHTable
       // currently do nothing to detect such conditions or attempt to stop them.
       
       // Delete the row from all indexes which can potentially intersect the changes
-      ts.deleteIndexRow(tableName,rowID,columnSet);
+      ts.deleteIndexRow(tableID,rowID,columnSet);
       // Change the values as specified
       for (int i = 0 ; i < columns.length ; i++)
       {
         setTableColumnValue(rowID,columns[i],values[i]);
       }
       // Add the row back to all indexes which can potentially intersect the changes
-      ts.addIndexRow(tableName,rowID,columnSet);
+      ts.addIndexRow(tableID,rowID,columnSet);
     }
   }
     
@@ -114,7 +113,7 @@ public class Table implements WHTable
     {
       LongValue rowID = (LongValue)fa.getNext();
       // Delete the row from all indexes
-      ts.deleteIndexRow(tableName,rowID,null);
+      ts.deleteIndexRow(tableID,rowID,null);
       // Delete all values
       for (int i = 0 ; i < columns.length ; i++)
       {
@@ -139,15 +138,14 @@ public class Table implements WHTable
     return new TableAccessor(this);
   }
 
-  /** Get name */
-  public String getName()
-    throws WHException
+  // Protected methods
+  
+  /** Get identifier */
+  protected LongValue getID()
   {
-    return tableName;
+    return tableID;
   }
   
-  // Protected methods
-  
   /** Remove all rows.
   * WARNING: This effectively causes the entire table to have to fit into memory!
   * It is better to delete rows piecemeal in separate transactions.
@@ -167,42 +165,36 @@ public class Table implements WHTable
   {
     if (ts.randomDecision())
     {
-      TableTailKey tailKey = new TableTailKey(tableName);
+      TableTailKey tailKey = new TableTailKey(tableID.getValue());
       LongValue tailValue = (LongValue)ts.get(tailKey);
       if (tailValue == null)
       {
         // First row.  Set the head.
-        TableHeadKey headKey = new TableHeadKey(tableName);
-        ts.put(headKey,rowID);
+        ts.put(new TableHeadKey(tableID.getValue()),rowID);
       }
       else
       {
         // Set the next pointer for last row.
-        TableRowNextKey nextKey = new TableRowNextKey(tableName,tailValue.getValue());
-        ts.put(nextKey,rowID);
-        TableRowPrevKey prevKey = new TableRowPrevKey(tableName,rowID.getValue());
-        ts.put(prevKey,tailValue);
+        ts.put(new TableRowNextKey(tableID.getValue(),tailValue.getValue()),rowID);
+        ts.put(new TableRowPrevKey(tableID.getValue(),rowID.getValue()),tailValue);
       }
       // Set the tail pointer to the new record
       ts.put(tailKey,rowID);
     }
     else
     {
-      TableHeadKey headKey = new TableHeadKey(tableName);
+      TableHeadKey headKey = new TableHeadKey(tableID.getValue());
       LongValue headValue = (LongValue)ts.get(headKey);
       if (headValue == null)
       {
         // First row.  Set the tail.
-        TableTailKey tailKey = new TableTailKey(tableName);
-        ts.put(tailKey,rowID);
+        ts.put(new TableTailKey(tableID.getValue()),rowID);
       }
       else
       {
         // Set the prev pointer for first row.
-        TableRowPrevKey prevKey = new TableRowPrevKey(tableName,headValue.getValue());
-        ts.put(prevKey,rowID);
-        TableRowNextKey nextKey = new TableRowNextKey(tableName,rowID.getValue());
-        ts.put(nextKey,headValue);
+        ts.put(new TableRowPrevKey(tableID.getValue(),headValue.getValue()),rowID);
+        ts.put(new TableRowNextKey(tableID.getValue(),rowID.getValue()),headValue);
       }
       // Set the tail pointer to the new record
       ts.put(headKey,rowID);
@@ -214,31 +206,25 @@ public class Table implements WHTable
   protected void removeTableRow(LongValue rowID)
     throws WHException
   {
-    TableRowPrevKey prevKey = new TableRowPrevKey(tableName,rowID.getValue());
-    TableRowNextKey nextKey = new TableRowNextKey(tableName,rowID.getValue());
-    LongValue prevValue = (LongValue)ts.get(prevKey);
-    LongValue nextValue = (LongValue)ts.get(nextKey);
+    LongValue prevValue = (LongValue)ts.get(new TableRowPrevKey(tableID.getValue(),rowID.getValue()));
+    LongValue nextValue = (LongValue)ts.get(new TableRowNextKey(tableID.getValue(),rowID.getValue()));
     // Fix up the previous pointer reference
     if (prevValue == null)
     {
-      TableHeadKey headKey = new TableHeadKey(tableName);
-      ts.put(headKey,nextValue);
+      ts.put(new TableHeadKey(tableID.getValue()),nextValue);
     }
     else
     {
-      TableRowNextKey prevNextKey = new TableRowNextKey(tableName,prevValue.getValue());
-      ts.put(prevNextKey,nextValue);
+      ts.put(new TableRowNextKey(tableID.getValue(),prevValue.getValue()),nextValue);
     }
     // Fix up the next pointer reference
     if (nextValue == null)
     {
-      TableTailKey tailKey = new TableTailKey(tableName);
-      ts.put(tailKey,prevValue);
+      ts.put(new TableTailKey(tableID.getValue()),prevValue);
     }
     else
     {
-      TableRowPrevKey nextPrevKey = new TableRowPrevKey(tableName,nextValue.getValue());
-      ts.put(nextPrevKey,prevValue);
+      ts.put(new TableRowPrevKey(tableID.getValue(),nextValue.getValue()),prevValue);
     }
   }
   
@@ -247,8 +233,7 @@ public class Table implements WHTable
   protected void setTableColumnValue(LongValue rowID, String columnName, WHValue value)
     throws WHException
   {
-    TableColumnKey key = new TableColumnKey(tableName,rowID.getValue(),columnName);
-    ts.put(key,value);
+    ts.put(new TableColumnKey(tableID.getValue(),rowID.getValue(),columnName),value);
   }
   
   /** Get a table column value.
@@ -256,8 +241,7 @@ public class Table implements WHTable
   protected WHValue getTableColumnValue(LongValue rowID, String columnName)
     throws WHException
   {
-    TableColumnKey key = new TableColumnKey(tableName,rowID.getValue(),columnName);
-    return ts.get(key);
+    return ts.get(new TableColumnKey(tableID.getValue(),rowID.getValue(),columnName));
   }
 
   
@@ -266,8 +250,7 @@ public class Table implements WHTable
   protected LongValue readFirstTableRowID()
     throws WHException
   {
-    TableHeadKey headKey = new TableHeadKey(tableName);
-    return (LongValue)ts.get(headKey);
+    return (LongValue)ts.get(new TableHeadKey(tableID.getValue()));
   }
   
   /** Reade the next table row ID.
@@ -276,22 +259,7 @@ public class Table implements WHTable
     throws WHException
   {
     // Read the row's next pointer
-    TableRowNextKey nextKey = new TableRowNextKey(tableName,currentRowID.getValue());
-    return (LongValue)ts.get(nextKey);
+    return (LongValue)ts.get(new TableRowNextKey(tableID.getValue(),currentRowID.getValue()));
   }
   
-  /** Allocate the next table row ID.
-  */
-  protected LongValue allocateNewTableRow()
-    throws WHException
-  {
-    TableRowIDFactoryKey tlk = new TableRowIDFactoryKey(tableName);
-    LongValue tlv = (LongValue)ts.get(tlk);
-    if (tlv == null)
-      throw new WHConcurrencyException();
-    ts.put(tlk,new LongValue(tlv.getValue()+1L));
-    return tlv;
-  }
-  
-
 }
\ No newline at end of file

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableColumnKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableColumnKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableColumnKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableColumnKey.java Tue Nov 29 01:12:13 2011
@@ -24,36 +24,36 @@ import org.apache.warthog.common.*;
 
 public class TableColumnKey implements WHKey
 {
-  protected String tableName;
+  protected long tableID;
   protected long rowID;
   protected String columnName;
     
   protected long hashCodeValue;
   
   /** Constructor */
-  public TableColumnKey(String tableName, long rowID, String columnName)
+  public TableColumnKey(long tableID, long rowID, String columnName)
   {
-    this.tableName = tableName;
+    this.tableID = tableID;
     this.rowID = rowID;
     this.columnName = columnName;
-    hashCodeValue = calculateHashCode(tableName,rowID,columnName);
+    hashCodeValue = calculateHashCode(tableID,rowID,columnName);
   }
     
   public TableColumnKey(byte[] data)
   {
     BufferPointer bp = new BufferPointer(data);
-    this.tableName = StringKey.readObject(bp);
+    this.tableID = LongKey.readObject(bp);
     this.rowID = LongKey.readObject(bp);
     this.columnName = StringKey.readObject(bp);
-    hashCodeValue = calculateHashCode(tableName,rowID,columnName);
+    hashCodeValue = calculateHashCode(tableID,rowID,columnName);
   }
 
   public byte[] serializeObject()
   {
-    byte[] rval = new byte[StringKey.sizeObject(tableName)+
+    byte[] rval = new byte[LongKey.sizeObject()+
       LongKey.sizeObject() + StringKey.sizeObject(columnName)];
     BufferPointer bp = new BufferPointer(rval);
-    StringKey.writeObject(bp,tableName);
+    LongKey.writeObject(bp,tableID);
     LongKey.writeObject(bp,rowID);
     StringKey.writeObject(bp,columnName);
     return rval;
@@ -64,16 +64,16 @@ public class TableColumnKey implements W
     return hashCodeValue;
   }
   
-  public static long calculateHashCode(String tableName, long rowID, String columnName)
+  public static long calculateHashCode(long tableID, long rowID, String columnName)
   {
-    return StringKey.calculateHashCode(tableName) + LongKey.calculateHashCode(rowID)
+    return LongKey.calculateHashCode(tableID) + LongKey.calculateHashCode(rowID)
       + StringKey.calculateHashCode(columnName);
   }
     
   public boolean isEquals(WHValue o)
   {
     TableColumnKey key = (TableColumnKey)o;
-    return key.tableName.equals(tableName) &&
+    return key.tableID == tableID &&
       key.rowID == rowID &&
       key.columnName.equals(columnName);
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableHeadKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableHeadKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableHeadKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableHeadKey.java Tue Nov 29 01:12:13 2011
@@ -22,12 +22,12 @@ package org.apache.warthog.tablestore;
 import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
-public class TableHeadKey extends StringKey
+public class TableHeadKey extends LongKey
 {
   /** Constructor */
-  public TableHeadKey(String name)
+  public TableHeadKey(long tableID)
   {
-    super(name);
+    super(tableID);
   }
     
   public TableHeadKey(byte[] data)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableIndexKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableIndexKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableIndexKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableIndexKey.java Tue Nov 29 01:12:13 2011
@@ -23,12 +23,12 @@ import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
 /** Key for accessing indexes that index a table */
-public class TableIndexKey extends StringKey
+public class TableIndexKey extends LongKey
 {
   /** Constructor */
-  public TableIndexKey(String name)
+  public TableIndexKey(long tableID)
   {
-    super(name);
+    super(tableID);
   }
     
   public TableIndexKey(byte[] data)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableKey.java Tue Nov 29 01:12:13 2011
@@ -22,13 +22,13 @@ package org.apache.warthog.tablestore;
 import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
-/** Key class for accessing table definition data */
-public class TableKey extends StringKey
+/** Key class for accessing table definition data given a table identifier */
+public class TableKey extends LongKey
 {
   /** Constructor */
-  public TableKey(String name)
+  public TableKey(long tableID)
   {
-    super(name);
+    super(tableID);
   }
     
   public TableKey(byte[] data)

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java?rev=1207727&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java Tue Nov 29 01:12:13 2011
@@ -0,0 +1,38 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.tablestore;
+
+import org.apache.warthog.interfaces.*;
+import org.apache.warthog.common.*;
+
+/** Key class for accessing table ID given table name */
+public class TableLookupKey extends StringKey
+{
+  /** Constructor */
+  public TableLookupKey(String name)
+  {
+    super(name);
+  }
+    
+  public TableLookupKey(byte[] data)
+  {
+    super(data);
+  }
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableLookupKey.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java?rev=1207727&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java Tue Nov 29 01:12:13 2011
@@ -0,0 +1,38 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.tablestore;
+
+import org.apache.warthog.interfaces.*;
+import org.apache.warthog.common.*;
+
+/** Key class for accessing table name given ID */
+public class TableNameKey extends LongKey
+{
+  /** Constructor */
+  public TableNameKey(long tableID)
+  {
+    super(tableID);
+  }
+    
+  public TableNameKey(byte[] data)
+  {
+    super(data);
+  }
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableNameKey.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowIDFactoryKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowIDFactoryKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowIDFactoryKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowIDFactoryKey.java Tue Nov 29 01:12:13 2011
@@ -23,12 +23,12 @@ import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
 /** Key for accessing each table's row ID factory */
-public class TableRowIDFactoryKey extends StringKey
+public class TableRowIDFactoryKey extends LongKey
 {
   /** Constructor */
-  public TableRowIDFactoryKey(String name)
+  public TableRowIDFactoryKey(long tableID)
   {
-    super(name);
+    super(tableID);
   }
     
   public TableRowIDFactoryKey(byte[] data)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowKey.java Tue Nov 29 01:12:13 2011
@@ -25,33 +25,33 @@ import org.apache.warthog.common.*;
 /** Base class for table row prev/next keys */
 public class TableRowKey implements WHKey
 {
-  protected String tableName;
+  protected long tableID;
   protected long rowID;
   
   protected long hashCodeValue;
   
   /** Constructor */
-  public TableRowKey(String tableName, long rowID)
+  public TableRowKey(long tableID, long rowID)
   {
-    this.tableName = tableName;
+    this.tableID = tableID;
     this.rowID = rowID;
-    hashCodeValue = calculateHashCode(tableName,rowID);
+    hashCodeValue = calculateHashCode(tableID,rowID);
   }
     
   public TableRowKey(byte[] data)
   {
     BufferPointer bp = new BufferPointer(data);
-    this.tableName = StringKey.readObject(bp);
+    this.tableID = LongKey.readObject(bp);
     this.rowID = LongKey.readObject(bp);
-    hashCodeValue = calculateHashCode(tableName,rowID);
+    hashCodeValue = calculateHashCode(tableID,rowID);
   }
 
   public byte[] serializeObject()
   {
-    byte[] rval = new byte[StringKey.sizeObject(tableName)+
+    byte[] rval = new byte[LongKey.sizeObject()+
       LongKey.sizeObject()];
     BufferPointer bp = new BufferPointer(rval);
-    StringKey.writeObject(bp,tableName);
+    LongKey.writeObject(bp,tableID);
     LongKey.writeObject(bp,rowID);
     return rval;
   }
@@ -61,15 +61,15 @@ public class TableRowKey implements WHKe
     return hashCodeValue;
   }
   
-  public static long calculateHashCode(String tableName, long rowID)
+  public static long calculateHashCode(long tableID, long rowID)
   {
-    return StringKey.calculateHashCode(tableName) + LongKey.calculateHashCode(rowID);
+    return LongKey.calculateHashCode(tableID) + LongKey.calculateHashCode(rowID);
   }
     
   public boolean isEquals(WHValue o)
   {
     TableRowKey key = (TableRowKey)o;
-    return key.tableName.equals(tableName) &&
+    return key.tableID == tableID &&
       key.rowID == rowID;
   }
 

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowNextKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowNextKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowNextKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowNextKey.java Tue Nov 29 01:12:13 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
 public class TableRowNextKey extends TableRowKey
 {
   /** Constructor */
-  public TableRowNextKey(String tableName, long rowID)
+  public TableRowNextKey(long tableID, long rowID)
   {
-    super(tableName,rowID);
+    super(tableID,rowID);
   }
     
   public TableRowNextKey(byte[] data)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowPrevKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowPrevKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowPrevKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableRowPrevKey.java Tue Nov 29 01:12:13 2011
@@ -26,9 +26,9 @@ import org.apache.warthog.common.*;
 public class TableRowPrevKey extends TableRowKey
 {
   /** Constructor */
-  public TableRowPrevKey(String tableName, long rowID)
+  public TableRowPrevKey(long tableID, long rowID)
   {
-    super(tableName,rowID);
+    super(tableID,rowID);
   }
     
   public TableRowPrevKey(byte[] data)

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=1207727&r1=1207726&r2=1207727&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 Tue Nov 29 01:12:13 2011
@@ -33,12 +33,12 @@ public class TableStore implements WHTab
   /** The current transaction, if any */
   protected WHTransaction currentTransaction = null;
   
-  /** Map of table name to table object, good for the current transaction */
-  protected Map<String,Table> tables = null;
-  /** Map of index name to index object, good for the current transaction */
-  protected Map<String,Index> indexes = null;
+  /** Map of string to table object, good for the current transaction */
+  protected Map<LongValue,Table> tables = null;
+  /** Map of string to index object, good for the current transaction */
+  protected Map<LongValue,Index> indexes = null;
   /** Map of table name to index set, good for the current transaction */
-  protected Map<String,Index[]> indexesPerTable = null;
+  protected Map<LongValue,Index[]> indexesPerTable = null;
   
   /** Random number generator for this table store instance */
   protected Random randomGenerator;
@@ -64,9 +64,9 @@ public class TableStore implements WHTab
     if (currentTransaction != null)
       throw new WHException("Already in a transaction");
     currentTransaction = transactionalStore.createTransaction();
-    tables = new HashMap<String,Table>();
-    indexes = new HashMap<String,Index>();
-    indexesPerTable = new HashMap<String,Index[]>();
+    tables = new HashMap<LongValue,Table>();
+    indexes = new HashMap<LongValue,Index>();
+    indexesPerTable = new HashMap<LongValue,Index[]>();
   }
   
   /** Commit a transaction */
@@ -93,6 +93,7 @@ public class TableStore implements WHTab
     currentTransaction = null;
     tables = null;
     indexes = null;
+    indexesPerTable = null;
   }
   
   /** Lookup table */
@@ -110,19 +111,15 @@ public class TableStore implements WHTab
   {
     if (currentTransaction == null)
       throw new WHException("Must be in a transaction");
-    Table t = findTable(name);
-    if (t != null)
+    if (currentTransaction.get(new TableLookupKey(name)) != null)
       throw new WHException("Table already exists");
-    TableKey tk = new TableKey(name);
-    StringArray tv = new StringArray(columnNames);
-    t = new Table(this,name,columnNames);
-    currentTransaction.put(tk,tv);
-    tables.put(name,t);
-    TableIndexKey tik = new TableIndexKey(name);
-    StringArray tiv = new StringArray(new String[0]);
-    currentTransaction.put(tik,tiv);
-    TableRowIDFactoryKey tlk = new TableRowIDFactoryKey(name);
-    currentTransaction.put(tlk,new LongValue(0L));
+    LongValue tableIDValue = allocateNewGeneralID();
+    setTableName(tableIDValue,name);
+    currentTransaction.put(new TableKey(tableIDValue.getValue()),new StringArray(columnNames));
+    Table t = new Table(this,tableIDValue,columnNames);
+    tables.put(tableIDValue,t);
+    currentTransaction.put(new TableIndexKey(tableIDValue.getValue()),new LongArray(new long[0]));
+    currentTransaction.put(new TableRowIDFactoryKey(tableIDValue.getValue()),new LongValue(0L));
     return t;
   }
   
@@ -155,28 +152,26 @@ public class TableStore implements WHTab
     if (currentTransaction == null)
       throw new WHException("Must be in a transaction");
     Table t = (Table)table;
-    Index i = findIndex(name);
-    if (i != null)
+    if (currentTransaction.get(new IndexLookupKey(name)) != null)
       throw new WHException("Index already exists");
-    IndexKey ik = new IndexKey(name);
-    IndexValue iv = new IndexValue(t.getName(),columnNames,comparatorClasses,unique);
-    i = new Index(this,t,name,columnNames,comparatorClasses,unique);
-    currentTransaction.put(ik,iv);
-    indexes.put(name,i);
-    TableIndexKey tik = new TableIndexKey(t.getName());
-    StringArray tiv = (StringArray)currentTransaction.get(tik);
+    LongValue indexID = allocateNewGeneralID();
+    setIndexName(indexID,name);
+    currentTransaction.put(new IndexKey(indexID.getValue()),new IndexValue(t.getID().getValue(),columnNames,comparatorClasses,unique));
+    Index i = new Index(this,indexID,t,columnNames,comparatorClasses,unique);
+    indexes.put(indexID,i);
+    TableIndexKey tik = new TableIndexKey(t.getID().getValue());
+    LongArray tiv = (LongArray)currentTransaction.get(tik);
     if (tiv == null)
       throw new WHConcurrencyException();
-    String[] indexList = tiv.getValue();
-    String[] newIndexList = new String[indexList.length + 1];
+    long[] indexList = tiv.getValue();
+    long[] newIndexList = new long[indexList.length + 1];
     for (int j = 0 ; j < indexList.length ; j++)
     {
       newIndexList[j] = indexList[j];
     }
-    newIndexList[indexList.length] = name;
-    tiv = new StringArray(newIndexList);
-    currentTransaction.put(tik,tiv);
-    indexesPerTable.remove(t.getName());
+    newIndexList[indexList.length] = indexID.getValue();
+    currentTransaction.put(tik,new LongArray(newIndexList));
+    indexesPerTable.remove(t.getID());
     i.initialize();
     return i;
   }
@@ -206,13 +201,13 @@ public class TableStore implements WHTab
   // Non-interface public methods
   
   /** Allocate a new row ID */
-  public LongValue allocateNewTableRow(String tableName)
+  public LongValue allocateNewTableRow(LongValue tableID)
     throws WHException
   {
     // We always do this in our own transaction to limit the deadlock potential,
     // and we retry until we get the ID.  We only throw a concurrency exception
     // if it seems clear that the table is gone.
-    TableRowIDFactoryKey tlk = new TableRowIDFactoryKey(tableName);
+    TableRowIDFactoryKey tlk = new TableRowIDFactoryKey(tableID.getValue());
 
     while (true)
     {
@@ -237,6 +232,37 @@ public class TableStore implements WHTab
     }
     throw new WHConcurrencyException();
   }
+
+  /** Allocate a new general ID */
+  public LongValue allocateNewGeneralID()
+    throws WHException
+  {
+    // We always do this in our own transaction to limit the deadlock potential,
+    // and we retry until we get the ID.
+    GeneralIDFactoryKey tlk = new GeneralIDFactoryKey();
+
+    while (true)
+    {
+      WHTransaction allocateTransaction = transactionalStore.createTransaction();
+      try
+      {
+        LongValue tlv = (LongValue)allocateTransaction.get(tlk);
+        if (tlv == null)
+          tlv = new LongValue(0L);
+        allocateTransaction.put(tlk,new LongValue(tlv.getValue()+1L));
+        allocateTransaction.commit();
+        return tlv;
+      }
+      catch (WHConcurrencyException e)
+      {
+        Thread.yield();
+      }
+      finally
+      {
+        allocateTransaction.abandon();
+      }
+    }
+  }
   
   /** Random boolean decision */
   public boolean randomDecision()
@@ -262,10 +288,10 @@ public class TableStore implements WHTab
   
   /** Delete a table row from all the indexes that are based on a table.
   */
-  public void deleteIndexRow(String tableName, LongValue rowID, Set<String> columns)
+  public void deleteIndexRow(LongValue tableID, LongValue rowID, Set<String> columns)
     throws WHException
   {
-    Index[] indexes = findIndexes(tableName);
+    Index[] indexes = findIndexes(tableID);
     for (int i = 0 ; i < indexes.length ; i++)
     {
       if (indexAffectedBy(indexes[i],columns))
@@ -275,10 +301,10 @@ public class TableStore implements WHTab
   
   /** Add a table row to all the indexes that are based on a table.
   */
-  public void addIndexRow(String tableName, LongValue rowID, Set<String> columns)
+  public void addIndexRow(LongValue tableID, LongValue rowID, Set<String> columns)
     throws WHException
   {
-    Index[] indexes = findIndexes(tableName);
+    Index[] indexes = findIndexes(tableID);
     for (int i = 0 ; i < indexes.length ; i++)
     {
       if (indexAffectedBy(indexes[i],columns))
@@ -307,7 +333,7 @@ public class TableStore implements WHTab
     throws WHException
   {
     // First, remove indexes associated with this table
-    Index[] indexes = findIndexes(t.getName());
+    Index[] indexes = findIndexes(t.getID());
     for (int i = 0 ; i < indexes.length ; i++)
     {
       deleteIndex(indexes[i]);
@@ -317,11 +343,11 @@ public class TableStore implements WHTab
     t.remove();
 
     // Delete the keys that belong to the table, and clean up cached values
-    tables.remove(t.getName());
-    indexesPerTable.remove(t.getName());
-    currentTransaction.put(new TableIndexKey(t.getName()),null);
-    currentTransaction.put(new TableKey(t.getName()),null);
-    currentTransaction.put(new TableRowIDFactoryKey(t.getName()),null);
+    tables.remove(t.getID());
+    indexesPerTable.remove(t.getID());
+    currentTransaction.put(new TableIndexKey(t.getID().getValue()),null);
+    currentTransaction.put(new TableRowIDFactoryKey(t.getID().getValue()),null);
+    removeTableName(t.getID());
   }
   
   /** Delete an index definition.
@@ -331,30 +357,30 @@ public class TableStore implements WHTab
   {
     // First, remove this index from the indexes stored for each table
     Table t = (Table)i.getTable();
-    Index[] indexList = findIndexes(t.getName());
+    Index[] indexList = findIndexes(t.getID());
     if (indexList.length == 0)
       throw new WHConcurrencyException();
-    String[] newIndexList = new String[indexList.length - 1];
+    long[] newIndexList = new long[indexList.length - 1];
     int k = 0;
     for (int j = 0 ; j < indexList.length ; j++)
     {
-      if (!indexList[j].getName().equals(i.getName()))
+      if (indexList[j].getID().getValue() != i.getID().getValue())
       {
-        newIndexList[k++] = indexList[j].getName();
+        newIndexList[k++] = indexList[j].getID().getValue();
         if (k == newIndexList.length)
           break;
       }
     }
     if (k != newIndexList.length)
       throw new WHConcurrencyException();
-    currentTransaction.put(new TableIndexKey(t.getName()),new StringArray(newIndexList));
-    indexesPerTable.remove(t.getName());
+    currentTransaction.put(new TableIndexKey(t.getID().getValue()),new LongArray(newIndexList));
+    indexesPerTable.remove(t.getID());
 
     i.remove();
 
     // 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);
+    indexes.remove(i.getID());
+    removeIndexName(i.getID());
   }
     
   /** Find a table definition given its name.
@@ -362,14 +388,23 @@ public class TableStore implements WHTab
   protected Table findTable(String name)
     throws WHException
   {
-    Table t = tables.get(name);
+    LongValue tid = (LongValue)currentTransaction.get(new TableLookupKey(name));
+    if (tid == null)
+      return null;
+    return findTable(tid);
+  }
+  
+  protected Table findTable(LongValue tid)
+    throws WHException
+  {
+    Table t = tables.get(tid);
     if (t != null)
       return t;
-    StringArray tv = (StringArray)currentTransaction.get(new TableKey(name));
+    StringArray tv = (StringArray)currentTransaction.get(new TableKey(tid.getValue()));
     if (tv == null)
-      return null;
-    t = new Table(this,name,tv.getValue());
-    tables.put(name,t);
+      throw new WHConcurrencyException();
+    t = new Table(this,tid,tv.getValue());
+    tables.put(tid,t);
     return t;
   }
   
@@ -378,45 +413,92 @@ public class TableStore implements WHTab
   protected Index findIndex(String name)
     throws WHException
   {
-    Index i = indexes.get(name);
+    LongValue indexID = (LongValue)currentTransaction.get(new IndexLookupKey(name));
+    if (indexID == null)
+      return null;
+    return findIndex(indexID);
+  }
+  
+  protected Index findIndex(LongValue indexID)
+    throws WHException
+  {
+    Index i = indexes.get(indexID);
     if (i != null)
       return i;
-    IndexValue indexValue = (IndexValue)currentTransaction.get(new IndexKey(name));
+    IndexValue indexValue = (IndexValue)currentTransaction.get(new IndexKey(indexID.getValue()));
     if (indexValue == null)
-      return null;
-    Table t = findTable(indexValue.getTableName());
+      throw new WHConcurrencyException();
+    Table t = findTable(new LongValue(indexValue.getTableID()));
     if (t == null)
       throw new WHConcurrencyException();
-    i = new Index(this,t,name,indexValue.getColumnNames(),indexValue.getComparatorClassNames(),
+    i = new Index(this,indexID,t,indexValue.getColumnNames(),indexValue.getComparatorClassNames(),
       indexValue.getUnique());
-    indexes.put(name,i);
+    indexes.put(indexID,i);
     return i;
   }
   
   /** Find a set of associated index definitions given a table name.
   */
-  protected Index[] findIndexes(String tableName)
+  protected Index[] findIndexes(LongValue tableID)
     throws WHException
   {
-    Index[] indexes = indexesPerTable.get(tableName);
+    Index[] indexes = indexesPerTable.get(tableID);
     if (indexes == null)
     {
-      TableIndexKey tik = new TableIndexKey(tableName);
-      StringArray tiv = (StringArray)currentTransaction.get(tik);
+      LongArray tiv = (LongArray)currentTransaction.get(new TableIndexKey(tableID.getValue()));
       if (tiv == null)
         throw new WHConcurrencyException();
-      String[] indexNames = tiv.getValue();
-      indexes = new Index[indexNames.length];
+      long[] indexIDs = tiv.getValue();
+      indexes = new Index[indexIDs.length];
       for (int i = 0; i < indexes.length ; i++)
       {
-        indexes[i] = findIndex(indexNames[i]);
+        indexes[i] = findIndex(new LongValue(indexIDs[i]));
         if (indexes[i] == null)
           throw new WHConcurrencyException();
       }
-      indexesPerTable.put(tableName,indexes);
+      indexesPerTable.put(tableID,indexes);
     }
     return indexes;
   }
   
+  /** Set a reference from table name to id and visa versa.  Presumes nothing has been set yet for this table ID. */
+  protected void setTableName(LongValue tableID, String tableName)
+    throws WHException
+  {
+    currentTransaction.put(new TableNameKey(tableID.getValue()),new StringValue(tableName));
+    currentTransaction.put(new TableLookupKey(tableName),tableID);
+  }
+  
+  /** Remove a table name reference.  Presumed to exist. */
+  protected void removeTableName(LongValue tableID)
+    throws WHException
+  {
+    TableNameKey tnk = new TableNameKey(tableID.getValue());
+    StringValue value = (StringValue)currentTransaction.get(tnk);
+    if (value == null)
+      throw new WHConcurrencyException();
+    currentTransaction.put(tnk,null);
+    currentTransaction.put(new TableLookupKey(value.getValue()),null);
+  }
 
+  /** Set a reference from index name to id and visa versa.  Presumes nothing has been set yet for this index ID. */
+  protected void setIndexName(LongValue indexID, String indexName)
+    throws WHException
+  {
+    currentTransaction.put(new IndexNameKey(indexID.getValue()),new StringValue(indexName));
+    currentTransaction.put(new IndexLookupKey(indexName),indexID);
+  }
+  
+  /** Remove an index name reference.  Presumed to exist. */
+  protected void removeIndexName(LongValue indexID)
+    throws WHException
+  {
+    IndexNameKey tnk = new IndexNameKey(indexID.getValue());
+    StringValue value = (StringValue)currentTransaction.get(tnk);
+    if (value == null)
+      throw new WHConcurrencyException();
+    currentTransaction.put(tnk,null);
+    currentTransaction.put(new IndexLookupKey(value.getValue()),null);
+  }
+  
 }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableTailKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableTailKey.java?rev=1207727&r1=1207726&r2=1207727&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableTailKey.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/TableTailKey.java Tue Nov 29 01:12:13 2011
@@ -22,12 +22,12 @@ package org.apache.warthog.tablestore;
 import org.apache.warthog.interfaces.*;
 import org.apache.warthog.common.*;
 
-public class TableTailKey extends StringKey
+public class TableTailKey extends LongKey
 {
   /** Constructor */
-  public TableTailKey(String name)
+  public TableTailKey(long tableID)
   {
-    super(name);
+    super(tableID);
   }
   
   public TableTailKey(byte[] data)



Mime
View raw message