hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r942956 - in /hadoop/hbase/branches/0.20: ./ src/java/org/apache/hadoop/hbase/master/ src/java/org/apache/hadoop/hbase/regionserver/ src/test/org/apache/hadoop/hbase/master/
Date Tue, 11 May 2010 00:10:35 GMT
Author: jdcryans
Date: Tue May 11 00:10:35 2010
New Revision: 942956

URL: http://svn.apache.org/viewvc?rev=942956&view=rev
Log:
HBASE-2515  ChangeTableState considers split&&offline regions as being served
HBASE-2528  ServerManager.ServerMonitor isn't daemonized

Added:
    hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/master/TestMasterWithDisabling.java
Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=942956&r1=942955&r2=942956&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Tue May 11 00:10:35 2010
@@ -124,6 +124,7 @@ Release X.X.X - Unreleased
    HBASE-2521  no license headers in 5 files
    HBASE-2413  Master does not respect generation stamps, may result in meta
                getting permanently offlined
+   HBASE-2515  ChangeTableState considers split&&offline regions as being served
 
   IMPROVEMENTS
    HBASE-2180  Bad read performance from synchronizing hfile.fddatainputstream
@@ -192,6 +193,7 @@ Release X.X.X - Unreleased
    HBASE-2520  Cleanup arrays vs Lists of scanners (Todd Lipcon via Stack)
    HBASE-2518  Kill all the trailing whitespaces in the code base
                (Benoit Sigoure via Stack)
+   HBASE-2528  ServerManager.ServerMonitor isn't daemonized
 
   NEW FEATURES
    HBASE-2257  [stargate] multiuser mode

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=942956&r1=942955&r2=942956&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java
Tue May 11 00:10:35 2010
@@ -50,6 +50,7 @@ import org.apache.hadoop.hbase.client.Re
 import org.apache.hadoop.hbase.ipc.HRegionInterface;
 import org.apache.hadoop.hbase.master.RegionManager.RegionState;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Threads;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.Watcher.Event.EventType;
@@ -147,7 +148,9 @@ class ServerManager implements HConstant
     this.minimumServerCount = c.getInt("hbase.regions.server.count.min", 0);
     this.serverMonitorThread = new ServerMonitor(master.metaRescanInterval,
       master.shutdownRequested);
-    this.serverMonitorThread.start();
+    String n = Thread.currentThread().getName();
+    Threads.setDaemonThreadRunning(this.serverMonitorThread,
+      n + ".serverMonitor");
   }
 
   /**

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=942956&r1=942955&r2=942956&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
Tue May 11 00:10:35 2010
@@ -193,6 +193,8 @@ class CompactSplitThread extends Thread 
     Put put = new Put(oldRegionInfo.getRegionName());
     put.add(CATALOG_FAMILY, REGIONINFO_QUALIFIER,
         Writables.getBytes(oldRegionInfo));
+    put.add(CATALOG_FAMILY, SERVER_QUALIFIER, EMPTY_BYTE_ARRAY);
+    put.add(CATALOG_FAMILY, STARTCODE_QUALIFIER, EMPTY_BYTE_ARRAY);
     put.add(CATALOG_FAMILY, SPLITA_QUALIFIER,
         Writables.getBytes(newRegions[0].getRegionInfo()));
     put.add(CATALOG_FAMILY, SPLITB_QUALIFIER,

Added: hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/master/TestMasterWithDisabling.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/master/TestMasterWithDisabling.java?rev=942956&view=auto
==============================================================================
--- hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/master/TestMasterWithDisabling.java
(added)
+++ hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/master/TestMasterWithDisabling.java
Tue May 11 00:10:35 2010
@@ -0,0 +1,124 @@
+/**
+ * Copyright 2010 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.master;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HMsg;
+import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+/**
+ * Disabling is tricky. This class tests how the Master behaves during those
+ */
+public class TestMasterWithDisabling {
+
+  private static final Log LOG = LogFactory.getLog(TestMasterWithDisabling.class);
+  private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+  private static final byte[] TABLENAME = Bytes.toBytes("disabling");
+  private static final byte[] FAMILYNAME = Bytes.toBytes("fam");
+
+  @BeforeClass
+  public static void beforeAllTests() throws Exception {
+    // Start a cluster of two regionservers.
+    TEST_UTIL.startMiniCluster(2);
+  }
+
+  @AfterClass
+  public static void afterAllTests() throws IOException {
+    TEST_UTIL.shutdownMiniCluster();
+  }
+
+  @Test
+  public void testDisableBetweenSplit() throws IOException {
+    // Table that splits like crazy
+    HTableDescriptor htd = new HTableDescriptor(TABLENAME);
+    htd.setMaxFileSize(1024);
+    htd.setMemStoreFlushSize(1024);
+    HColumnDescriptor hcd = new HColumnDescriptor(FAMILYNAME);
+    htd.addFamily(hcd);
+    TEST_UTIL.getHBaseAdmin().createTable(htd);
+    HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
+    HBase2515Listener list = new HBase2515Listener(TEST_UTIL.getHBaseAdmin());
+    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
+    HMaster m = cluster.getMaster();
+    m.getRegionServerOperationQueue().
+      registerRegionServerOperationListener(list);
+    try {
+      TEST_UTIL.loadTable(t, FAMILYNAME);
+    } catch (IOException ex) {
+      // We disable the table during a split, we will end up here
+      LOG.info("Expected", ex);
+    }
+    // Check that there's no region in flight, HBASE-2515
+    assertEquals(0,cluster.getMaster().
+        getClusterStatus().getRegionsInTransition().size());
+  }
+
+  /**
+   * Simple listener that simulates a very long processing of a split. When
+   * we catch it, we first disable the table then let the processing go forward
+   */
+  static class HBase2515Listener implements RegionServerOperationListener {
+    HBaseAdmin admin;
+
+    public HBase2515Listener(HBaseAdmin admin) {
+      this.admin = admin;
+    }
+
+    @Override
+    public boolean process(HServerInfo serverInfo, HMsg incomingMsg) {
+      if (!incomingMsg.isType(HMsg.Type.MSG_REPORT_SPLIT_INCLUDES_DAUGHTERS)) {
+        return true;
+      }
+      try {
+        LOG.info("Disabling table");
+        admin.disableTable(TABLENAME);
+      } catch (IOException e) {
+        LOG.warn(e);
+        fail("Disable should always work");
+      }
+      return true;
+    }
+
+    @Override
+    public boolean process(RegionServerOperation op) throws IOException {
+      return true;
+    }
+
+    @Override
+    public void processed(RegionServerOperation op) {
+    }
+  }
+
+}



Mime
View raw message