Return-Path: Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: (qmail 15496 invoked from network); 21 Jan 2011 06:02:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jan 2011 06:02:12 -0000 Received: (qmail 28280 invoked by uid 500); 21 Jan 2011 06:02:12 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 28160 invoked by uid 500); 21 Jan 2011 06:02:10 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 28153 invoked by uid 99); 21 Jan 2011 06:02:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 06:02:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Fri, 21 Jan 2011 06:02:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3C33C2388999; Fri, 21 Jan 2011 06:01:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1061646 - /hbase/trunk/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTrackerOnCluster.java Date: Fri, 21 Jan 2011 06:01:48 -0000 To: commits@hbase.apache.org From: stack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110121060148.3C33C2388999@eris.apache.org> Author: stack Date: Fri Jan 21 06:01:47 2011 New Revision: 1061646 URL: http://svn.apache.org/viewvc?rev=1061646&view=rev Log: HBASE-3445 Master crashes on data that was moved from different host -- add in unit test Added: hbase/trunk/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTrackerOnCluster.java Added: hbase/trunk/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTrackerOnCluster.java URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTrackerOnCluster.java?rev=1061646&view=auto ============================================================================== --- hbase/trunk/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTrackerOnCluster.java (added) +++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTrackerOnCluster.java Fri Jan 21 06:01:47 2011 @@ -0,0 +1,63 @@ +/** + * Copyright 2011 The Apache Software Foundation + * + * 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.hadoop.hbase.catalog; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.Abortable; +import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HServerAddress; +import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; +import org.junit.Test; + +/** + * Do {@link CatalogTracker} tests on running cluster. + */ +public class TestCatalogTrackerOnCluster { + private static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); + private static final Log LOG = + LogFactory.getLog(TestCatalogTrackerOnCluster.class); + + /** + * @throws Exception + * @see https://issues.apache.org/jira/browse/HBASE-3445 + */ + @Test public void testBadOriginalRootLocation() throws Exception { + UTIL.getConfiguration().setInt("ipc.socket.timeout", 3000); + // Launch cluster so it does bootstrapping. + UTIL.startMiniCluster(); + // Shutdown hbase. + UTIL.shutdownMiniHBaseCluster(); + // Mess with the root location in the running zk. Set it to be nonsense. + ZooKeeperWatcher zookeeper = new ZooKeeperWatcher(UTIL.getConfiguration(), + "Bad Root Location Writer", new Abortable() { + @Override + public void abort(String why, Throwable e) { + LOG.error("Abort was called on 'bad root location writer'", e); + } + }); + HServerAddress nonsense = new HServerAddress("example.org:1234"); + RootLocationEditor.setRootLocation(zookeeper, nonsense); + // Bring back up the hbase cluster. See if it can deal with nonsense root + // location. + UTIL.startMiniHBaseCluster(1, 1); + UTIL.shutdownMiniCluster(); + } +}