Repository: hbase
Updated Branches:
  refs/heads/hbase-6721 16f65badc -> fade887a3


http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
index 7a3b01f..05d2fb3 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
@@ -62,12 +62,15 @@ public class MasterCoprocessorHost
   static class MasterEnvironment extends CoprocessorHost.Environment
       implements MasterCoprocessorEnvironment {
     private MasterServices masterServices;
+    final boolean supportGroupCPs;
 
     public MasterEnvironment(final Class<?> implClass, final Coprocessor impl,
         final int priority, final int seq, final Configuration conf,
         final MasterServices services) {
       super(impl, priority, seq, conf);
       this.masterServices = services;
+      supportGroupCPs = !useLegacyMethod(impl.getClass(),
+          "preBalanceGroup", ObserverContext.class, String.class);
     }
 
     public MasterServices getMasterServices() {
@@ -1110,7 +1113,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.preMoveServers(ctx, servers, targetGroup);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.preMoveServers(ctx, servers, targetGroup);
+        }
       }
     });
   }
@@ -1121,7 +1126,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.postMoveServers(ctx, servers, targetGroup);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.postMoveServers(ctx, servers, targetGroup);
+        }
       }
     });
   }
@@ -1132,7 +1139,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.preMoveTables(ctx, tables, targetGroup);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.preMoveTables(ctx, tables, targetGroup);
+        }
       }
     });
   }
@@ -1143,7 +1152,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.postMoveTables(ctx, tables, targetGroup);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.postMoveTables(ctx, tables, targetGroup);
+        }
       }
     });
   }
@@ -1154,7 +1165,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.preAddGroup(ctx, name);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.preAddGroup(ctx, name);
+        }
       }
     });
   }
@@ -1165,7 +1178,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.postAddGroup(ctx, name);
+        if (((MasterEnvironment) ctx.getEnvironment()).supportGroupCPs) {
+          oserver.postAddGroup(ctx, name);
+        }
       }
     });
   }
@@ -1176,7 +1191,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.preRemoveGroup(ctx, name);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.preRemoveGroup(ctx, name);
+        }
       }
     });
   }
@@ -1187,7 +1204,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.postRemoveGroup(ctx, name);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.postRemoveGroup(ctx, name);
+        }
       }
     });
   }
@@ -1198,7 +1217,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.preBalanceGroup(ctx, name);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.preBalanceGroup(ctx, name);
+        }
       }
     });
   }
@@ -1209,7 +1230,9 @@ public class MasterCoprocessorHost
       @Override
       public void call(MasterObserver oserver,
           ObserverContext<MasterCoprocessorEnvironment> ctx) throws 
IOException {
-        oserver.postBalanceGroup(ctx, name, balanceRan);
+        if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) {
+          oserver.postBalanceGroup(ctx, name, balanceRan);
+        }
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
index 999da30..a7b94c9 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
@@ -1331,6 +1331,14 @@ public class MasterRpcServices extends RSRpcServices
       }
       Pair<HRegionInfo, ServerName> pair =
         MetaTableAccessor.getRegion(master.getConnection(), regionName);
+      if 
(Bytes.equals(HRegionInfo.FIRST_META_REGIONINFO.getRegionName(),regionName)) {
+        pair = new Pair<HRegionInfo, 
ServerName>(HRegionInfo.FIRST_META_REGIONINFO,
+            
master.getMetaTableLocator().getMetaRegionLocation(master.getZooKeeper()));
+      }
+      if (pair == null) {
+        throw new UnknownRegionException(Bytes.toString(regionName));
+      }
+
       if (pair == null) throw new 
UnknownRegionException(Bytes.toString(regionName));
       HRegionInfo hri = pair.getFirst();
       if (master.cpHost != null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroups.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroups.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroups.java
index aa7ef1f..673c48e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroups.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroups.java
@@ -19,6 +19,7 @@
  */
 package org.apache.hadoop.hbase.group;
 
+import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 import org.apache.commons.logging.Log;
@@ -34,6 +35,7 @@ import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.ServerManager;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos;
@@ -46,15 +48,20 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -62,8 +69,6 @@ import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.verify;
 
 @Category({MediumTests.class})
 public class TestGroups extends TestGroupsBase {
@@ -139,12 +144,12 @@ public class TestGroups extends TestGroupsBase {
     TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
-        LOG.info("Waiting for cleanup to finish "+groupAdmin.listGroups());
+        LOG.info("Waiting for cleanup to finish " + groupAdmin.listGroups());
         //Might be greater since moving servers back to default
         //is after starting a server
 
         return 
groupAdmin.getGroupInfo(GroupInfo.DEFAULT_GROUP).getServers().size()
-           == NUM_SLAVES_BASE;
+            == NUM_SLAVES_BASE;
       }
     });
   }
@@ -156,12 +161,37 @@ public class TestGroups extends TestGroupsBase {
     //verify it was loaded properly
     assertEquals("hadoop:name=Group,service=Group", 
it.next().getCanonicalName());
 
-    final MXBeanImpl info = MXBeanImpl.init(groupAdmin, master);
+    final AtomicReference<HostPort> deadServer = new 
AtomicReference<HostPort>(null);
+
+    //We use mocks to simulate offline servers to avoid
+    //the complexity and overhead of killing servers
+    MasterServices mockMaster = Mockito.mock(MasterServices.class);
+    final ServerManager mockServerManager = Mockito.mock(ServerManager.class);
+    Mockito.when(mockMaster.getServerManager()).thenReturn(mockServerManager);
+    Mockito.when(mockServerManager.getOnlineServersList()).then(new 
Answer<List<ServerName>>() {
+      @Override
+      public List<ServerName> answer(InvocationOnMock invocation) throws 
Throwable {
+        GroupInfo groupInfo = groupAdmin.getGroupInfo(GroupInfo.DEFAULT_GROUP);
+        List<ServerName> finalList = Lists.newArrayList();
+        HostPort lastServer = groupInfo.getServers().last();
+        for (ServerName server: 
master.getServerManager().getOnlineServersList()) {
+          if (!server.getHostPort().equals(lastServer)) {
+            finalList.add(server);
+          }
+        }
+        deadServer.set(lastServer);
+        return finalList;
+      }
+    });
+    MXBean info = new MXBeanImpl(groupAdmin, mockMaster);
+
     GroupInfo defaultGroup = groupAdmin.getGroupInfo(GroupInfo.DEFAULT_GROUP);
     assertEquals(2, info.getGroups().size());
     assertEquals(defaultGroup.getName(), info.getGroups().get(0).getName());
     assertEquals(defaultGroup.getServers(), 
Sets.newTreeSet(info.getGroups().get(0).getServers()));
-    assertEquals(defaultGroup.getServers(), 
Sets.newTreeSet(info.getServersByGroup().get(GroupInfo.DEFAULT_GROUP)));
+    assertEquals(defaultGroup.getServers().headSet(deadServer.get()),
+        
Sets.newTreeSet(info.getServersByGroup().get(GroupInfo.DEFAULT_GROUP)));
+
 
     GroupInfo barGroup = addGroup(groupAdmin, "bar", 3);
     TableName tableName1 = TableName.valueOf(tablePrefix+"_testJmx1");

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsBase.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsBase.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsBase.java
index f2834ce..ac53de5 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsBase.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsBase.java
@@ -272,7 +272,7 @@ public abstract class TestGroupsBase {
   }
 
   @Test
-  public void testTableMoveAndDrop() throws Exception {
+  public void testTableMoveTruncateAndDrop() throws Exception {
     LOG.info("testTableMove");
 
     final TableName tableName = TableName.valueOf(tablePrefix + 
"_testTableMoveAndDrop");
@@ -318,6 +318,12 @@ public abstract class TestGroupsBase {
       }
     });
 
+    //test truncate
+    admin.disableTable(tableName);
+    admin.truncateTable(tableName, true);
+    assertEquals(1, 
groupAdmin.getGroupInfo(newGroup.getName()).getTables().size());
+    assertEquals(tableName, 
groupAdmin.getGroupInfo(newGroup.getName()).getTables().first());
+
     //verify removed table is removed from group
     TEST_UTIL.deleteTable(tableName);
     assertEquals(0, 
groupAdmin.getGroupInfo(newGroup.getName()).getTables().size());

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsOfflineMode.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsOfflineMode.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsOfflineMode.java
new file mode 100644
index 0000000..d5da85d
--- /dev/null
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/group/TestGroupsOfflineMode.java
@@ -0,0 +1,181 @@
+/**
+ * Copyright 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.group;
+
+import com.google.common.collect.Sets;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.HBaseCluster;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.Waiter;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.master.ServerManager;
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+
+//This tests that GroupBasedBalancer will use data in zk
+//to do balancing during master startup
+//This does not test retain assignment
+@Category(MediumTests.class)
+public class TestGroupsOfflineMode {
+  private static final org.apache.commons.logging.Log LOG = 
LogFactory.getLog(TestGroupsOfflineMode.class);
+  private static HMaster master;
+  private static HBaseAdmin hbaseAdmin;
+  private static HBaseTestingUtility TEST_UTIL;
+  private static HBaseCluster cluster;
+  public final static long WAIT_TIMEOUT = 60000*5;
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    TEST_UTIL = new HBaseTestingUtility();
+    TEST_UTIL.getConfiguration().set(
+        HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
+        GroupBasedLoadBalancer.class.getName());
+    TEST_UTIL.getConfiguration().set(
+        ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART,
+        "1");
+    TEST_UTIL.startMiniCluster(2, 3);
+    cluster = TEST_UTIL.getHBaseCluster();
+    master = ((MiniHBaseCluster)cluster).getMaster();
+    master.balanceSwitch(false);
+    hbaseAdmin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+    //wait till the balancer is in online mode
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return master.isInitialized() &&
+            ((GroupBasedLoadBalancer) master.getLoadBalancer()).isOnline() &&
+            master.getServerManager().getOnlineServersList().size() >= 3;
+      }
+    });
+  }
+
+  @AfterClass
+  public static void tearDown() throws Exception {
+    TEST_UTIL.shutdownMiniCluster();
+  }
+
+  @Test
+  public void testOffline() throws Exception, InterruptedException {
+    //table should be after group table name
+    //so it gets assigned later
+    final TableName failoverTable = TableName.valueOf("testOffline");
+    TEST_UTIL.createTable(failoverTable, Bytes.toBytes("f"));
+
+    GroupAdminClient groupAdmin = new 
GroupAdminClient(TEST_UTIL.getConfiguration());
+
+    final HRegionServer killRS = 
((MiniHBaseCluster)cluster).getRegionServer(0);
+    final HRegionServer groupRS = 
((MiniHBaseCluster)cluster).getRegionServer(1);
+    final HRegionServer failoverRS = 
((MiniHBaseCluster)cluster).getRegionServer(2);
+
+    String newGroup =  "my_group";
+    groupAdmin.addGroup(newGroup);
+    if(master.getAssignmentManager().getRegionStates().getRegionAssignments()
+        .containsValue(failoverRS.getServerName())) {
+      for(HRegionInfo regionInfo: 
hbaseAdmin.getOnlineRegions(failoverRS.getServerName())) {
+        hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
+            Bytes.toBytes(failoverRS.getServerName().getServerName()));
+      }
+      LOG.info("Waiting for region unassignments on failover RS...");
+      TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+        @Override
+        public boolean evaluate() throws Exception {
+          return master.getServerManager().getLoad(failoverRS.getServerName())
+              .getRegionsLoad().size() > 0;
+        }
+      });
+    }
+
+    //move server to group and make sure all tables are assigned
+    
groupAdmin.moveServers(Sets.newHashSet(groupRS.getServerName().getHostPort()), 
newGroup);
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return groupRS.getNumberOfOnlineRegions() < 1 &&
+            
master.getAssignmentManager().getRegionStates().getRegionsInTransition().size() 
< 1;
+      }
+    });
+    //move table to group and wait
+    groupAdmin.moveTables(Sets.newHashSet(GroupInfoManager.GROUP_TABLE_NAME), 
newGroup);
+    LOG.info("Waiting for move table...");
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return groupRS.getNumberOfOnlineRegions() == 1;
+      }
+    });
+
+    groupRS.stop("die");
+    //race condition here
+    TEST_UTIL.getHBaseCluster().getMaster().stopMaster();
+    LOG.info("Waiting for offline mode...");
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return TEST_UTIL.getHBaseCluster().getMaster() != null &&
+            TEST_UTIL.getHBaseCluster().getMaster().isActiveMaster() &&
+            TEST_UTIL.getHBaseCluster().getMaster().isInitialized() &&
+            
TEST_UTIL.getHBaseCluster().getMaster().getServerManager().getOnlineServers().size()
+                <= 3;
+      }
+    });
+
+
+    GroupInfoManager groupMgr =
+        
((GroupBasedLoadBalancer)TEST_UTIL.getHBaseCluster().getMaster().getLoadBalancer())
+        .getGroupInfoManager();
+    //make sure balancer is in offline mode, since this is what we're testing
+    assertFalse(groupMgr.isOnline());
+    //verify the group affiliation that's loaded from ZK instead of tables
+    assertEquals(newGroup,
+        groupMgr.getGroupOfTable(GroupInfoManager.GROUP_TABLE_NAME));
+    assertEquals(GroupInfo.DEFAULT_GROUP, 
groupMgr.getGroupOfTable(failoverTable));
+
+    //kill final regionserver to see the failover happens for all tables
+    //except GROUP table since it's group does not have any online RS
+    killRS.stop("die");
+    master = TEST_UTIL.getHBaseCluster().getMaster();
+    LOG.info("Waiting for new table assignment...");
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return failoverRS.getOnlineRegions(failoverTable).size() >= 1;
+      }
+    });
+    assertEquals(0, 
failoverRS.getOnlineRegions(GroupInfoManager.GROUP_TABLE_NAME).size());
+
+    //need this for minicluster to shutdown cleanly
+    master.stopMaster();
+  }
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
index 405c5a9..d49a57e 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
@@ -2640,19 +2640,9 @@ public class TestAccessController extends SecureTestUtil 
{
         return null;
       }
     };
-    AccessTestAction action2 = new AccessTestAction() {
-      @Override
-      public Object run() throws Exception {
-        
ACCESS_CONTROLLER.postMoveServers(ObserverContext.createAndPrepare(CP_ENV, 
null),
-            null, null);
-        return null;
-      }
-    };
 
     verifyAllowed(action1, SUPERUSER, USER_ADMIN);
-    verifyAllowed(action2, SUPERUSER, USER_ADMIN);
     verifyDenied(action1, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
-    verifyDenied(action2, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
   }
 
   @Test
@@ -2665,19 +2655,9 @@ public class TestAccessController extends SecureTestUtil 
{
         return null;
       }
     };
-    AccessTestAction action2 = new AccessTestAction() {
-      @Override
-      public Object run() throws Exception {
-        
ACCESS_CONTROLLER.postMoveTables(ObserverContext.createAndPrepare(CP_ENV, null),
-            null, null);
-        return null;
-      }
-    };
 
     verifyAllowed(action1, SUPERUSER, USER_ADMIN);
-    verifyAllowed(action2, SUPERUSER, USER_ADMIN);
     verifyDenied(action1, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
-    verifyDenied(action2, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
   }
 
   @Test
@@ -2690,19 +2670,9 @@ public class TestAccessController extends SecureTestUtil 
{
         return null;
       }
     };
-    AccessTestAction action2 = new AccessTestAction() {
-      @Override
-      public Object run() throws Exception {
-        
ACCESS_CONTROLLER.postAddGroup(ObserverContext.createAndPrepare(CP_ENV, null),
-            null);
-        return null;
-      }
-    };
 
     verifyAllowed(action1, SUPERUSER, USER_ADMIN);
-    verifyAllowed(action2, SUPERUSER, USER_ADMIN);
     verifyDenied(action1, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
-    verifyDenied(action2, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
   }
 
   @Test
@@ -2715,19 +2685,9 @@ public class TestAccessController extends SecureTestUtil 
{
         return null;
       }
     };
-    AccessTestAction action2 = new AccessTestAction() {
-      @Override
-      public Object run() throws Exception {
-        
ACCESS_CONTROLLER.postRemoveGroup(ObserverContext.createAndPrepare(CP_ENV, 
null),
-            null);
-        return null;
-      }
-    };
 
     verifyAllowed(action1, SUPERUSER, USER_ADMIN);
-    verifyAllowed(action2, SUPERUSER, USER_ADMIN);
     verifyDenied(action1, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
-    verifyDenied(action2, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
   }
 
   @Test
@@ -2740,18 +2700,8 @@ public class TestAccessController extends SecureTestUtil 
{
         return null;
       }
     };
-    AccessTestAction action2 = new AccessTestAction() {
-      @Override
-      public Object run() throws Exception {
-        
ACCESS_CONTROLLER.postBalanceGroup(ObserverContext.createAndPrepare(CP_ENV, 
null),
-            null, false);
-        return null;
-      }
-    };
 
     verifyAllowed(action1, SUPERUSER, USER_ADMIN);
-    verifyAllowed(action2, SUPERUSER, USER_ADMIN);
     verifyDenied(action1, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
-    verifyDenied(action2, USER_CREATE, USER_RW, USER_RO, USER_NONE, 
USER_OWNER);
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-shell/src/main/ruby/hbase/admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb 
b/hbase-shell/src/main/ruby/hbase/admin.rb
index d6a05a7..8aa2983 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -415,26 +415,6 @@ module Hbase
 
       table_description = 
@admin.getTableDescriptor(TableName.valueOf(table_name))
 
-      #clone group
-      if(groups_available?(conf))
-       group_admin =  org.apache.hadoop.hbase.group.GroupAdminClient.new(@conf)
-       group_info = group_admin.getGroupInfoOfTable(table_name)
-        exp_group = group_info.getName
-        if(exp_group == "default")
-          exp_group = nil;
-        end
-        ns =
-            @admin.getNamespaceDescriptor(
-                
org.apache.hadoop.hbase.TableName.valueOf(table_name).getNamespaceAsString)
-        ns_group =
-          
ns.getValue(org.apache.hadoop.hbase.group.GroupInfo::NAMESPACEDESC_PROP_GROUP)
-        if(!exp_group.nil? && ns_group.nil?|| (ns_group != exp_group))
-          yield " - Preserving explicit group assignment to #{exp_group}" if 
block_given?
-          
table_description.setValue(org.apache.hadoop.hbase.group.GroupInfo::TABLEDESC_PROP_GROUP,
-          group_info.getName())
-        end
-      end
-
       yield 'Disabling table...' if block_given?
       disable(table_name)
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-shell/src/main/ruby/hbase/group_admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/group_admin.rb 
b/hbase-shell/src/main/ruby/hbase/group_admin.rb
index 4532031..bb4cefe 100644
--- a/hbase-shell/src/main/ruby/hbase/group_admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/group_admin.rb
@@ -51,9 +51,9 @@ module Hbase
       end
       group.getServers.each do |v|
         if block_given?
-          yield(v)
+          yield(v.toString)
         else
-          res += v
+          res += v.toString
         end
       end
       if block_given?

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-shell/src/main/ruby/shell.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell.rb 
b/hbase-shell/src/main/ruby/shell.rb
index 3cc1f06..561a1c1 100644
--- a/hbase-shell/src/main/ruby/shell.rb
+++ b/hbase-shell/src/main/ruby/shell.rb
@@ -434,7 +434,5 @@ Shell.load_command_group(
     move_group_tables
     get_server_group
     get_table_group
-    list_group_tables
-    list_group_server_transitions
   ]
 )

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-shell/src/main/ruby/shell/commands/list_group_server_transitions.rb
----------------------------------------------------------------------
diff --git 
a/hbase-shell/src/main/ruby/shell/commands/list_group_server_transitions.rb 
b/hbase-shell/src/main/ruby/shell/commands/list_group_server_transitions.rb
deleted file mode 100644
index 313873f..0000000
--- a/hbase-shell/src/main/ruby/shell/commands/list_group_server_transitions.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright 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.
-#
-
-#TODO make this command name sho
-module Shell
-  module Commands
-    class ListGroupServerTransitions < Command
-      def help
-        return <<-EOF
-List region servers in transition.
-
-Example:
-
-  hbase> list_group_server_transitions 'default'
-EOF
-      end
-      def command()
-        now = Time.now
-        formatter.header(["Server", "Destination"])
-        count = group_admin.listServersInTransition do |server, dest|
-          formatter.row([ server, dest ])
-        end
-        formatter.footer(now, count)
-      end
-    end
-  end
-end

http://git-wip-us.apache.org/repos/asf/hbase/blob/fade887a/hbase-shell/src/main/ruby/shell/commands/list_group_tables.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/list_group_tables.rb 
b/hbase-shell/src/main/ruby/shell/commands/list_group_tables.rb
deleted file mode 100644
index ae0862c..0000000
--- a/hbase-shell/src/main/ruby/shell/commands/list_group_tables.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright 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.
-#
-
-module Shell
-  module Commands
-    class ListGroupTables < Command
-      def help
-        return <<-EOF
-List member tables of a given region server group in hbase.
-
-Example:
-
-  hbase> list_group_tables 'default'
-EOF
-      end
-
-      def command(group_name)
-        now = Time.now
-        formatter.header([ "TABLES" ])
-        list = group_admin.listTablesOfGroup(group_name)
-        list.each do |table|
-          formatter.row([ table.toString ])
-        end
-        formatter.footer(now, list.size)
-      end
-    end
-  end
-end

Reply via email to