Return-Path: X-Original-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0C1437B8E for ; Mon, 21 Nov 2011 08:10:57 +0000 (UTC) Received: (qmail 11328 invoked by uid 500); 21 Nov 2011 08:10:56 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 11284 invoked by uid 500); 21 Nov 2011 08:10:55 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 11275 invoked by uid 99); 21 Nov 2011 08:10:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Nov 2011 08:10:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Nov 2011 08:10:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DB3BA23888EA; Mon, 21 Nov 2011 08:10:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111121081031.DB3BA23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }