View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.regionserver;
20  
21  import java.io.IOException;
22  import java.util.Map;
23  import java.util.concurrent.ConcurrentMap;
24  
25  import org.apache.hadoop.classification.InterfaceAudience;
26  import org.apache.hadoop.fs.FileSystem;
27  import org.apache.hadoop.hbase.HRegionInfo;
28  import org.apache.hadoop.hbase.catalog.CatalogTracker;
29  import org.apache.hadoop.hbase.executor.ExecutorService;
30  import org.apache.hadoop.hbase.ipc.RpcServerInterface;
31  import org.apache.hadoop.hbase.master.TableLockManager;
32  import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
33  import org.apache.hadoop.hbase.regionserver.wal.HLog;
34  import org.apache.zookeeper.KeeperException;
35  
36  /**
37   * Services provided by {@link HRegionServer}
38   */
39  @InterfaceAudience.Private
40  public interface RegionServerServices
41      extends OnlineRegions, FavoredNodesForRegion {
42    /**
43     * @return True if this regionserver is stopping.
44     */
45    boolean isStopping();
46  
47    /** @return the HLog for a particular region. Pass null for getting the
48     * default (common) WAL */
49    HLog getWAL(HRegionInfo regionInfo) throws IOException;
50  
51    /**
52     * @return Implementation of {@link CompactionRequestor} or null.
53     */
54    CompactionRequestor getCompactionRequester();
55  
56    /**
57     * @return Implementation of {@link FlushRequester} or null.
58     */
59    FlushRequester getFlushRequester();
60  
61    /**
62     * @return the RegionServerAccounting for this Region Server
63     */
64    RegionServerAccounting getRegionServerAccounting();
65  
66    /**
67     * @return RegionServer's instance of {@link TableLockManager}
68     */
69    TableLockManager getTableLockManager();
70  
71    /**
72     * Tasks to perform after region open to complete deploy of region on
73     * regionserver
74     *
75     * @param r Region to open.
76     * @param ct Instance of {@link CatalogTracker}
77     * @throws KeeperException
78     * @throws IOException
79     */
80    void postOpenDeployTasks(final HRegion r, final CatalogTracker ct)
81    throws KeeperException, IOException;
82  
83    /**
84     * Notify master that a handler requests to change a region state
85     */
86    boolean reportRegionStateTransition(TransitionCode code, long openSeqNum, HRegionInfo... hris);
87  
88    /**
89     * Notify master that a handler requests to change a region state
90     */
91    boolean reportRegionStateTransition(TransitionCode code, HRegionInfo... hris);
92  
93    /**
94     * Returns a reference to the region server's RPC server
95     */
96    RpcServerInterface getRpcServer();
97  
98    /**
99     * Get the regions that are currently being opened or closed in the RS
100    * @return map of regions in transition in this RS
101    */
102   ConcurrentMap<byte[], Boolean> getRegionsInTransitionInRS();
103 
104   /**
105    * @return Return the FileSystem object used by the regionserver
106    */
107   FileSystem getFileSystem();
108 
109   /**
110    * @return The RegionServer's "Leases" service
111    */
112   Leases getLeases();
113 
114   /**
115    * @return hbase executor service
116    */
117   ExecutorService getExecutorService();
118 
119   /**
120    * @return The RegionServer's CatalogTracker
121    */
122   CatalogTracker getCatalogTracker();
123 
124   /**
125    * @return set of recovering regions on the hosting region server
126    */
127   Map<String, HRegion> getRecoveringRegions();
128 
129   /**
130    * Only required for "old" log replay; if it's removed, remove this.
131    * @return The RegionServer's NonceManager
132    */
133   public ServerNonceManager getNonceManager();
134 }