Return-Path: X-Original-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-bigtop-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 BA2F276D2 for ; Thu, 29 Dec 2011 23:47:44 +0000 (UTC) Received: (qmail 49672 invoked by uid 500); 29 Dec 2011 23:47:44 -0000 Delivered-To: apmail-incubator-bigtop-commits-archive@incubator.apache.org Received: (qmail 49630 invoked by uid 500); 29 Dec 2011 23:47:44 -0000 Mailing-List: contact bigtop-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bigtop-dev@incubator.apache.org Delivered-To: mailing list bigtop-commits@incubator.apache.org Received: (qmail 49623 invoked by uid 99); 29 Dec 2011 23:47:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 23:47:44 +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; Thu, 29 Dec 2011 23:47:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 217DD238897D; Thu, 29 Dec 2011 23:47:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1225694 - /incubator/bigtop/trunk/bigtop-tests/test-artifacts/hbase/src/main/groovy/org/apache/bigtop/itest/hbase/system/TestLoadAndVerify.java Date: Thu, 29 Dec 2011 23:47:23 -0000 To: bigtop-commits@incubator.apache.org From: rvs@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111229234723.217DD238897D@eris.apache.org> Author: rvs Date: Thu Dec 29 23:47:22 2011 New Revision: 1225694 URL: http://svn.apache.org/viewvc?rev=1225694&view=rev Log: BIGTOP-321. Make TestLoadAndVerify parameterizable and runnable from command line (Jonathan Hsieh via rvs) Modified: incubator/bigtop/trunk/bigtop-tests/test-artifacts/hbase/src/main/groovy/org/apache/bigtop/itest/hbase/system/TestLoadAndVerify.java Modified: incubator/bigtop/trunk/bigtop-tests/test-artifacts/hbase/src/main/groovy/org/apache/bigtop/itest/hbase/system/TestLoadAndVerify.java URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/hbase/src/main/groovy/org/apache/bigtop/itest/hbase/system/TestLoadAndVerify.java?rev=1225694&r1=1225693&r2=1225694&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-tests/test-artifacts/hbase/src/main/groovy/org/apache/bigtop/itest/hbase/system/TestLoadAndVerify.java (original) +++ incubator/bigtop/trunk/bigtop-tests/test-artifacts/hbase/src/main/groovy/org/apache/bigtop/itest/hbase/system/TestLoadAndVerify.java Thu Dec 29 23:47:22 2011 @@ -308,24 +308,38 @@ public class TestLoadAndVerify extends // Only disable and drop if we succeeded to verify - otherwise it's useful // to leave it around for post-mortem - + deleteTable(admin, htd); + } + + private void deleteTable(HBaseAdmin admin, HTableDescriptor htd) + throws IOException, InterruptedException { // Use disableTestAsync because disable can take a long time to complete - admin.disableTableAsync(htd.getName()); System.out.print("Disabling table " + htd.getNameAsString() +" "); - while (admin.isTableEnabled(htd.getName())) { + admin.disableTableAsync(htd.getName()); + + long start = System.currentTimeMillis(); + // NOTE tables can be both admin.isTableEnabled=false and + // isTableDisabled=false, when disabling must use isTableDisabled! + while (!admin.isTableDisabled(htd.getName())) { System.out.print("."); - Thread.sleep(3000); + Thread.sleep(1000); } + long delta = System.currentTimeMillis() - start; + System.out.println(" " + delta +" ms"); + System.out.println("Deleting table " + htd.getNameAsString() +" "); admin.deleteTable(htd.getName()); } - + public void usage() { System.err.println(this.getClass().getSimpleName() + " [-Doptions] "); System.err.println(" Loads a table with row dependencies and verifies the dependency chains"); System.err.println("Options"); - System.err.println(" -Dloadmapper.table= Table to write/verify (default autogen)"); - System.err.println(" -Dloadmapper.backrefs= Number of backreferences per row (default 50)"); - System.err.println(" -Dloadmapper.num_to_write= Number of rows per mapper (default 100,000 per mapper)"); + System.err.println(" -Dloadmapper.table= Table to write/verify (default autogen)"); + System.err.println(" -Dloadmapper.backrefs= Number of backreferences per row (default 50)"); + System.err.println(" -Dloadmapper.num_to_write= Number of rows per mapper (default 100,000 per mapper)"); + System.err.println(" -Dloadmapper.deleteAfter= Delete after a successful verify (default true)"); + System.err.println(" -Dloadmapper.numPresplits= Number of presplit regions to start with (default 40)"); + } public int run(String argv[]) throws Exception { @@ -336,6 +350,8 @@ public class TestLoadAndVerify extends boolean doLoad = false; boolean doVerify = false; + boolean doDelete = getConf().getBoolean("loadmapper.deleteAfter",true); + int numPresplits = getConf().getInt("loadmapper.numPresplits", 40); if (argv[0].equals("load")) { doLoad = true; @@ -363,16 +379,17 @@ public class TestLoadAndVerify extends } TestLoadAndVerify verify = new TestLoadAndVerify(); - - if (doLoad) { - int numPreCreate = 40; - HBaseAdmin admin = new HBaseAdmin(getConf()); - admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), numPreCreate); + HBaseAdmin admin = new HBaseAdmin(getConf()); + if (doLoad) { + admin.createTable(htd, Bytes.toBytes(0L), Bytes.toBytes(-1L), numPresplits); verify.doLoad(getConf(), htd); } if (doVerify) { verify.doVerify(getConf(), htd); + if (doDelete) { + deleteTable(admin, htd); + } } return 0; }