hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [19/50] hbase-site git commit: Published site at .
Date Fri, 01 Dec 2017 15:18:34 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a5c4dca3/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.html b/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.html
index ec01907..d9aea0b 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.html
@@ -591,58 +591,110 @@
 <span class="sourceLineNo">583</span>            + servers + " , Tables : " +
tables + " =&gt; " +  targetGroup);<a name="line.583"></a>
 <span class="sourceLineNo">584</span>  }<a name="line.584"></a>
 <span class="sourceLineNo">585</span><a name="line.585"></a>
-<span class="sourceLineNo">586</span>  private Map&lt;String, RegionState&gt;
rsGroupGetRegionsInTransition(String groupName)<a name="line.586"></a>
-<span class="sourceLineNo">587</span>      throws IOException {<a name="line.587"></a>
-<span class="sourceLineNo">588</span>    Map&lt;String, RegionState&gt;
rit = Maps.newTreeMap();<a name="line.588"></a>
-<span class="sourceLineNo">589</span>    AssignmentManager am = master.getAssignmentManager();<a
name="line.589"></a>
-<span class="sourceLineNo">590</span>    for(TableName tableName : getRSGroupInfo(groupName).getTables())
{<a name="line.590"></a>
-<span class="sourceLineNo">591</span>      for(RegionInfo regionInfo: am.getRegionStates().getRegionsOfTable(tableName))
{<a name="line.591"></a>
-<span class="sourceLineNo">592</span>        RegionState state = am.getRegionStates().getRegionTransitionState(regionInfo);<a
name="line.592"></a>
-<span class="sourceLineNo">593</span>        if(state != null) {<a name="line.593"></a>
-<span class="sourceLineNo">594</span>          rit.put(regionInfo.getEncodedName(),
state);<a name="line.594"></a>
-<span class="sourceLineNo">595</span>        }<a name="line.595"></a>
-<span class="sourceLineNo">596</span>      }<a name="line.596"></a>
-<span class="sourceLineNo">597</span>    }<a name="line.597"></a>
-<span class="sourceLineNo">598</span>    return rit;<a name="line.598"></a>
-<span class="sourceLineNo">599</span>  }<a name="line.599"></a>
-<span class="sourceLineNo">600</span><a name="line.600"></a>
-<span class="sourceLineNo">601</span>  private Map&lt;TableName, Map&lt;ServerName,
List&lt;RegionInfo&gt;&gt;&gt;<a name="line.601"></a>
-<span class="sourceLineNo">602</span>      getRSGroupAssignmentsByTable(String
groupName) throws IOException {<a name="line.602"></a>
-<span class="sourceLineNo">603</span>    Map&lt;TableName, Map&lt;ServerName,
List&lt;RegionInfo&gt;&gt;&gt; result = Maps.newHashMap();<a name="line.603"></a>
-<span class="sourceLineNo">604</span>    RSGroupInfo rsGroupInfo = getRSGroupInfo(groupName);<a
name="line.604"></a>
-<span class="sourceLineNo">605</span>    Map&lt;TableName, Map&lt;ServerName,
List&lt;RegionInfo&gt;&gt;&gt; assignments = Maps.newHashMap();<a name="line.605"></a>
-<span class="sourceLineNo">606</span>    for(Map.Entry&lt;RegionInfo, ServerName&gt;
entry:<a name="line.606"></a>
-<span class="sourceLineNo">607</span>        master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet())
{<a name="line.607"></a>
-<span class="sourceLineNo">608</span>      TableName currTable = entry.getKey().getTable();<a
name="line.608"></a>
-<span class="sourceLineNo">609</span>      ServerName currServer = entry.getValue();<a
name="line.609"></a>
-<span class="sourceLineNo">610</span>      RegionInfo currRegion = entry.getKey();<a
name="line.610"></a>
-<span class="sourceLineNo">611</span>      if (rsGroupInfo.getTables().contains(currTable))
{<a name="line.611"></a>
-<span class="sourceLineNo">612</span>        assignments.putIfAbsent(currTable,
new HashMap&lt;&gt;());<a name="line.612"></a>
-<span class="sourceLineNo">613</span>        assignments.get(currTable).putIfAbsent(currServer,
new ArrayList&lt;&gt;());<a name="line.613"></a>
-<span class="sourceLineNo">614</span>        assignments.get(currTable).get(currServer).add(currRegion);<a
name="line.614"></a>
-<span class="sourceLineNo">615</span>      }<a name="line.615"></a>
-<span class="sourceLineNo">616</span>    }<a name="line.616"></a>
-<span class="sourceLineNo">617</span><a name="line.617"></a>
-<span class="sourceLineNo">618</span>    Map&lt;ServerName, List&lt;RegionInfo&gt;&gt;
serverMap = Maps.newHashMap();<a name="line.618"></a>
-<span class="sourceLineNo">619</span>    for(ServerName serverName: master.getServerManager().getOnlineServers().keySet())
{<a name="line.619"></a>
-<span class="sourceLineNo">620</span>      if(rsGroupInfo.getServers().contains(serverName.getAddress()))
{<a name="line.620"></a>
-<span class="sourceLineNo">621</span>        serverMap.put(serverName, Collections.emptyList());<a
name="line.621"></a>
-<span class="sourceLineNo">622</span>      }<a name="line.622"></a>
-<span class="sourceLineNo">623</span>    }<a name="line.623"></a>
-<span class="sourceLineNo">624</span><a name="line.624"></a>
-<span class="sourceLineNo">625</span>    // add all tables that are members of
the group<a name="line.625"></a>
-<span class="sourceLineNo">626</span>    for(TableName tableName : rsGroupInfo.getTables())
{<a name="line.626"></a>
-<span class="sourceLineNo">627</span>      if(assignments.containsKey(tableName))
{<a name="line.627"></a>
-<span class="sourceLineNo">628</span>        result.put(tableName, new HashMap&lt;&gt;());<a
name="line.628"></a>
-<span class="sourceLineNo">629</span>        result.get(tableName).putAll(serverMap);<a
name="line.629"></a>
-<span class="sourceLineNo">630</span>        result.get(tableName).putAll(assignments.get(tableName));<a
name="line.630"></a>
-<span class="sourceLineNo">631</span>        LOG.debug("Adding assignments for
" + tableName + ": " + assignments.get(tableName));<a name="line.631"></a>
-<span class="sourceLineNo">632</span>      }<a name="line.632"></a>
-<span class="sourceLineNo">633</span>    }<a name="line.633"></a>
-<span class="sourceLineNo">634</span><a name="line.634"></a>
-<span class="sourceLineNo">635</span>    return result;<a name="line.635"></a>
-<span class="sourceLineNo">636</span>  }<a name="line.636"></a>
-<span class="sourceLineNo">637</span>}<a name="line.637"></a>
+<span class="sourceLineNo">586</span>  @Override<a name="line.586"></a>
+<span class="sourceLineNo">587</span>  public void removeServers(Set&lt;Address&gt;
servers) throws IOException {<a name="line.587"></a>
+<span class="sourceLineNo">588</span>    {<a name="line.588"></a>
+<span class="sourceLineNo">589</span>      if (servers == null || servers.isEmpty())
{<a name="line.589"></a>
+<span class="sourceLineNo">590</span>        throw new ConstraintException("The
set of servers to remove cannot be null or empty.");<a name="line.590"></a>
+<span class="sourceLineNo">591</span>      }<a name="line.591"></a>
+<span class="sourceLineNo">592</span>      // Hold a lock on the manager instance
while moving servers to prevent<a name="line.592"></a>
+<span class="sourceLineNo">593</span>      // another writer changing our state
while we are working.<a name="line.593"></a>
+<span class="sourceLineNo">594</span>      synchronized (rsGroupInfoManager)
{<a name="line.594"></a>
+<span class="sourceLineNo">595</span>        if (master.getMasterCoprocessorHost()
!= null) {<a name="line.595"></a>
+<span class="sourceLineNo">596</span>          master.getMasterCoprocessorHost().preRemoveServers(servers);<a
name="line.596"></a>
+<span class="sourceLineNo">597</span>        }<a name="line.597"></a>
+<span class="sourceLineNo">598</span>        //check the set of servers<a
name="line.598"></a>
+<span class="sourceLineNo">599</span>        checkForDeadOrOnlineServers(servers);<a
name="line.599"></a>
+<span class="sourceLineNo">600</span>        rsGroupInfoManager.removeServers(servers);<a
name="line.600"></a>
+<span class="sourceLineNo">601</span>        if (master.getMasterCoprocessorHost()
!= null) {<a name="line.601"></a>
+<span class="sourceLineNo">602</span>          master.getMasterCoprocessorHost().postRemoveServers(servers);<a
name="line.602"></a>
+<span class="sourceLineNo">603</span>        }<a name="line.603"></a>
+<span class="sourceLineNo">604</span>        LOG.info("Remove decommissioned
servers " + servers + " from rsgroup done.");<a name="line.604"></a>
+<span class="sourceLineNo">605</span>      }<a name="line.605"></a>
+<span class="sourceLineNo">606</span>    }<a name="line.606"></a>
+<span class="sourceLineNo">607</span>  }<a name="line.607"></a>
+<span class="sourceLineNo">608</span><a name="line.608"></a>
+<span class="sourceLineNo">609</span>  private Map&lt;String, RegionState&gt;
rsGroupGetRegionsInTransition(String groupName)<a name="line.609"></a>
+<span class="sourceLineNo">610</span>      throws IOException {<a name="line.610"></a>
+<span class="sourceLineNo">611</span>    Map&lt;String, RegionState&gt;
rit = Maps.newTreeMap();<a name="line.611"></a>
+<span class="sourceLineNo">612</span>    AssignmentManager am = master.getAssignmentManager();<a
name="line.612"></a>
+<span class="sourceLineNo">613</span>    for(TableName tableName : getRSGroupInfo(groupName).getTables())
{<a name="line.613"></a>
+<span class="sourceLineNo">614</span>      for(RegionInfo regionInfo: am.getRegionStates().getRegionsOfTable(tableName))
{<a name="line.614"></a>
+<span class="sourceLineNo">615</span>        RegionState state = am.getRegionStates().getRegionTransitionState(regionInfo);<a
name="line.615"></a>
+<span class="sourceLineNo">616</span>        if(state != null) {<a name="line.616"></a>
+<span class="sourceLineNo">617</span>          rit.put(regionInfo.getEncodedName(),
state);<a name="line.617"></a>
+<span class="sourceLineNo">618</span>        }<a name="line.618"></a>
+<span class="sourceLineNo">619</span>      }<a name="line.619"></a>
+<span class="sourceLineNo">620</span>    }<a name="line.620"></a>
+<span class="sourceLineNo">621</span>    return rit;<a name="line.621"></a>
+<span class="sourceLineNo">622</span>  }<a name="line.622"></a>
+<span class="sourceLineNo">623</span><a name="line.623"></a>
+<span class="sourceLineNo">624</span>  private Map&lt;TableName, Map&lt;ServerName,
List&lt;RegionInfo&gt;&gt;&gt;<a name="line.624"></a>
+<span class="sourceLineNo">625</span>      getRSGroupAssignmentsByTable(String
groupName) throws IOException {<a name="line.625"></a>
+<span class="sourceLineNo">626</span>    Map&lt;TableName, Map&lt;ServerName,
List&lt;RegionInfo&gt;&gt;&gt; result = Maps.newHashMap();<a name="line.626"></a>
+<span class="sourceLineNo">627</span>    RSGroupInfo rsGroupInfo = getRSGroupInfo(groupName);<a
name="line.627"></a>
+<span class="sourceLineNo">628</span>    Map&lt;TableName, Map&lt;ServerName,
List&lt;RegionInfo&gt;&gt;&gt; assignments = Maps.newHashMap();<a name="line.628"></a>
+<span class="sourceLineNo">629</span>    for(Map.Entry&lt;RegionInfo, ServerName&gt;
entry:<a name="line.629"></a>
+<span class="sourceLineNo">630</span>        master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet())
{<a name="line.630"></a>
+<span class="sourceLineNo">631</span>      TableName currTable = entry.getKey().getTable();<a
name="line.631"></a>
+<span class="sourceLineNo">632</span>      ServerName currServer = entry.getValue();<a
name="line.632"></a>
+<span class="sourceLineNo">633</span>      RegionInfo currRegion = entry.getKey();<a
name="line.633"></a>
+<span class="sourceLineNo">634</span>      if (rsGroupInfo.getTables().contains(currTable))
{<a name="line.634"></a>
+<span class="sourceLineNo">635</span>        assignments.putIfAbsent(currTable,
new HashMap&lt;&gt;());<a name="line.635"></a>
+<span class="sourceLineNo">636</span>        assignments.get(currTable).putIfAbsent(currServer,
new ArrayList&lt;&gt;());<a name="line.636"></a>
+<span class="sourceLineNo">637</span>        assignments.get(currTable).get(currServer).add(currRegion);<a
name="line.637"></a>
+<span class="sourceLineNo">638</span>      }<a name="line.638"></a>
+<span class="sourceLineNo">639</span>    }<a name="line.639"></a>
+<span class="sourceLineNo">640</span><a name="line.640"></a>
+<span class="sourceLineNo">641</span>    Map&lt;ServerName, List&lt;RegionInfo&gt;&gt;
serverMap = Maps.newHashMap();<a name="line.641"></a>
+<span class="sourceLineNo">642</span>    for(ServerName serverName: master.getServerManager().getOnlineServers().keySet())
{<a name="line.642"></a>
+<span class="sourceLineNo">643</span>      if(rsGroupInfo.getServers().contains(serverName.getAddress()))
{<a name="line.643"></a>
+<span class="sourceLineNo">644</span>        serverMap.put(serverName, Collections.emptyList());<a
name="line.644"></a>
+<span class="sourceLineNo">645</span>      }<a name="line.645"></a>
+<span class="sourceLineNo">646</span>    }<a name="line.646"></a>
+<span class="sourceLineNo">647</span><a name="line.647"></a>
+<span class="sourceLineNo">648</span>    // add all tables that are members of
the group<a name="line.648"></a>
+<span class="sourceLineNo">649</span>    for(TableName tableName : rsGroupInfo.getTables())
{<a name="line.649"></a>
+<span class="sourceLineNo">650</span>      if(assignments.containsKey(tableName))
{<a name="line.650"></a>
+<span class="sourceLineNo">651</span>        result.put(tableName, new HashMap&lt;&gt;());<a
name="line.651"></a>
+<span class="sourceLineNo">652</span>        result.get(tableName).putAll(serverMap);<a
name="line.652"></a>
+<span class="sourceLineNo">653</span>        result.get(tableName).putAll(assignments.get(tableName));<a
name="line.653"></a>
+<span class="sourceLineNo">654</span>        LOG.debug("Adding assignments for
" + tableName + ": " + assignments.get(tableName));<a name="line.654"></a>
+<span class="sourceLineNo">655</span>      }<a name="line.655"></a>
+<span class="sourceLineNo">656</span>    }<a name="line.656"></a>
+<span class="sourceLineNo">657</span><a name="line.657"></a>
+<span class="sourceLineNo">658</span>    return result;<a name="line.658"></a>
+<span class="sourceLineNo">659</span>  }<a name="line.659"></a>
+<span class="sourceLineNo">660</span><a name="line.660"></a>
+<span class="sourceLineNo">661</span>  /**<a name="line.661"></a>
+<span class="sourceLineNo">662</span>   * Check if the set of servers are belong
to dead servers list or online servers list.<a name="line.662"></a>
+<span class="sourceLineNo">663</span>   * @param servers servers to remove<a
name="line.663"></a>
+<span class="sourceLineNo">664</span>   */<a name="line.664"></a>
+<span class="sourceLineNo">665</span>  private void checkForDeadOrOnlineServers(Set&lt;Address&gt;
servers) throws ConstraintException {<a name="line.665"></a>
+<span class="sourceLineNo">666</span>    // This uglyness is because we only
have Address, not ServerName.<a name="line.666"></a>
+<span class="sourceLineNo">667</span>    Set&lt;Address&gt; onlineServers
= new HashSet&lt;&gt;();<a name="line.667"></a>
+<span class="sourceLineNo">668</span>    for(ServerName server: master.getServerManager().getOnlineServers().keySet())
{<a name="line.668"></a>
+<span class="sourceLineNo">669</span>      onlineServers.add(server.getAddress());<a
name="line.669"></a>
+<span class="sourceLineNo">670</span>    }<a name="line.670"></a>
+<span class="sourceLineNo">671</span><a name="line.671"></a>
+<span class="sourceLineNo">672</span>    Set&lt;Address&gt; deadServers
= new HashSet&lt;&gt;();<a name="line.672"></a>
+<span class="sourceLineNo">673</span>    for(ServerName server: master.getServerManager().getDeadServers().copyServerNames())
{<a name="line.673"></a>
+<span class="sourceLineNo">674</span>      deadServers.add(server.getAddress());<a
name="line.674"></a>
+<span class="sourceLineNo">675</span>    }<a name="line.675"></a>
+<span class="sourceLineNo">676</span><a name="line.676"></a>
+<span class="sourceLineNo">677</span>    for (Address address: servers) {<a
name="line.677"></a>
+<span class="sourceLineNo">678</span>      if (onlineServers.contains(address))
{<a name="line.678"></a>
+<span class="sourceLineNo">679</span>        throw new ConstraintException(<a
name="line.679"></a>
+<span class="sourceLineNo">680</span>            "Server " + address + " is an
online server, not allowed to remove.");<a name="line.680"></a>
+<span class="sourceLineNo">681</span>      }<a name="line.681"></a>
+<span class="sourceLineNo">682</span>      if (deadServers.contains(address))
{<a name="line.682"></a>
+<span class="sourceLineNo">683</span>        throw new ConstraintException(<a
name="line.683"></a>
+<span class="sourceLineNo">684</span>            "Server " + address + " is on
the dead servers list,"<a name="line.684"></a>
+<span class="sourceLineNo">685</span>                + " Maybe it will come back
again, not allowed to remove.");<a name="line.685"></a>
+<span class="sourceLineNo">686</span>      }<a name="line.686"></a>
+<span class="sourceLineNo">687</span>    }<a name="line.687"></a>
+<span class="sourceLineNo">688</span>  }<a name="line.688"></a>
+<span class="sourceLineNo">689</span>}<a name="line.689"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a5c4dca3/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.html b/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.html
index a5f6a1a..8f39ade 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.html
@@ -125,7 +125,13 @@
 <span class="sourceLineNo">117</span>   */<a name="line.117"></a>
 <span class="sourceLineNo">118</span>  void moveServersAndTables(Set&lt;Address&gt;
servers, Set&lt;TableName&gt; tables,<a name="line.118"></a>
 <span class="sourceLineNo">119</span>      String srcGroup, String dstGroup)
throws IOException;<a name="line.119"></a>
-<span class="sourceLineNo">120</span>}<a name="line.120"></a>
+<span class="sourceLineNo">120</span><a name="line.120"></a>
+<span class="sourceLineNo">121</span>  /**<a name="line.121"></a>
+<span class="sourceLineNo">122</span>   * Remove decommissioned servers from
rsgroup<a name="line.122"></a>
+<span class="sourceLineNo">123</span>   * @param servers set of servers to remove<a
name="line.123"></a>
+<span class="sourceLineNo">124</span>   */<a name="line.124"></a>
+<span class="sourceLineNo">125</span>  void removeServers(Set&lt;Address&gt;
servers) throws IOException;<a name="line.125"></a>
+<span class="sourceLineNo">126</span>}<a name="line.126"></a>
 
 
 


Mime
View raw message