incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1204390 - in /incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore: Index.java TableStore.java
Date Mon, 21 Nov 2011 08:10:31 GMT
Author: kwright
Date: Mon Nov 21 08:10:31 2011
New Revision: 1204390

URL: http://svn.apache.org/viewvc?rev=1204390&view=rev
Log:
When index is created, index the currently existing table rows!

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/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=1204390&r1=1204389&r2=1204390&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 08:10:31 2011
@@ -328,6 +328,23 @@ public class Index implements WHIndex
     deleteIndexNodeTableRow(deleteNodeID);
   }
   
+  /** Initialize an entire index.
+  * WARNING: This effectively requires the entire new index to fit in memory!
+  * Better create the index when the table is small, then...
+  */
+  protected void initialize()
+    throws WHException
+  {
+    // Create an accessor for the table
+    WHAccessor tableAccessor = table.buildAccessor();
+    while (tableAccessor.hasNext())
+    {
+      long rowID = tableAccessor.getNext();
+      // Add this row to the index.
+      addNewRow(rowID);
+    }
+  }
+  
   /** Remove an entire index.
   * WARNING: This effectively requires the entire index to fit in memory!
   * It's far better to remove a bit at a time, in separate transactions.

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=1204390&r1=1204389&r2=1204390&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 08:10:31 2011
@@ -166,6 +166,7 @@ public class TableStore implements WHTab
     indexesPerTable.remove(t.getName());
     IndexNodeIDFactoryKey tlk = new IndexNodeIDFactoryKey(name);
     currentTransaction.put(tlk,new LongValue(0L));
+    i.initialize();
     return i;
   }
     



Mime
View raw message