@Override public void addRSGroup(String name) throws IOException { rsGroupInfoManager.addRSGroup(new RSGroupInfo(name)); }
static RSGroupInfoManager getInstance(MasterServices master) throws IOException { RSGroupInfoManagerImpl instance = new RSGroupInfoManagerImpl(master); instance.init(); return instance; }
@Override public void preModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, NamespaceDescriptor currentNsDesc, NamespaceDescriptor newNsDesc) throws IOException { preCreateNamespace(ctx, newNsDesc); }
public void removeGroup(String groupName) throws IOException { RSGroupInfo groupInfo = rsGroupAdmin.getRSGroupInfo(groupName); rsGroupAdmin.moveTables(groupInfo.getTables(), RSGroupInfo.DEFAULT_GROUP); rsGroupAdmin.moveServers(groupInfo.getServers(), RSGroupInfo.DEFAULT_GROUP); rsGroupAdmin.removeRSGroup(groupName); }
@Test public void testGetRSGroupInfoOfTable() throws Exception { AccessTestAction action = () -> { rsGroupAdminEndpoint.checkPermission("getRSGroupInfoOfTable"); return null; }; validateAdminPermissions(action); }
@Override public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException { // We are reading across two Maps in the below with out synchronizing across // them; should be safe most of the time. String groupName = rsGroupInfoManager.getRSGroupOfTable(tableName); return groupName == null? null: rsGroupInfoManager.getRSGroup(groupName); }
public boolean isOnline() { if (this.rsGroupInfoManager == null) { return false; } return this.rsGroupInfoManager.isOnline(); }
@Override public List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName, List<RegionInfo>> clusterState) throws HBaseIOException { return balanceCluster(clusterState); }
@Override public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot, TableDescriptor desc) throws IOException { assignTableToGroup(desc); }
@Override public void removeRSGroup(String name) throws IOException { wrapped.removeRSGroup(name); verify(); }
@Override public void removeServers(Set<Address> servers) throws IOException { wrapped.removeServers(servers); verify(); }
@Override public void addRSGroup(String groupName) throws IOException { wrapped.addRSGroup(groupName); verify(); }
@Override public void moveServers(Set<Address> servers, String targetGroup) throws IOException { wrapped.moveServers(servers, targetGroup); verify(); }
@Override public void moveTables(Set<TableName> tables, String targetGroup) throws IOException { wrapped.moveTables(tables, targetGroup); verify(); }
@Override public void moveServersAndTables(Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException { wrapped.moveServersAndTables(servers, tables, targetGroup); verify(); }
private void validateAdminPermissions(AccessTestAction action) throws Exception { verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_GROUP_ADMIN); verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE); } }
@Test public void testAddRSGroup() throws Exception { AccessTestAction action = () -> { rsGroupAdminEndpoint.checkPermission("addRSGroup"); return null; }; validateAdminPermissions(action); }
@Test public void testRemoveRSGroup() throws Exception { AccessTestAction action = () -> { rsGroupAdminEndpoint.checkPermission("removeRSGroup"); return null; }; validateAdminPermissions(action); }
@Test public void testGetRSGroupInfoOfServer() throws Exception { AccessTestAction action = () -> { rsGroupAdminEndpoint.checkPermission("getRSGroupInfoOfServer"); return null; }; validateAdminPermissions(action); }
@Test public void testMoveServers() throws Exception { AccessTestAction action = () -> { rsGroupAdminEndpoint.checkPermission("moveServers"); return null; }; validateAdminPermissions(action); }