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 org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.fs.FileSystem;
23  import org.apache.hadoop.hbase.HRegionInfo;
24  import org.apache.hadoop.hbase.catalog.CatalogTracker;
25  import org.apache.hadoop.hbase.executor.ExecutorService;
26  import org.apache.hadoop.hbase.ipc.PriorityFunction;
27  import org.apache.hadoop.hbase.ipc.RpcServerInterface;
28  import org.apache.hadoop.hbase.master.TableLockManager;
29  import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionTransition.TransitionCode;
30  import org.apache.hadoop.hbase.regionserver.wal.HLog;
31  import org.apache.zookeeper.KeeperException;
32  
33  import java.io.IOException;
34  import java.util.Map;
35  import java.util.concurrent.ConcurrentMap;
36  
37  /**
38   * Services provided by {@link HRegionServer}
39   */
40  @InterfaceAudience.Private
41  public interface RegionServerServices
42      extends OnlineRegions, FavoredNodesForRegion, PriorityFunction {
43    /**
44     * @return True if this regionserver is stopping.
45     */
46    boolean isStopping();
47  
48    /** @return the HLog for a particular region. Pass null for getting the
49     * default (common) WAL */
50    HLog getWAL(HRegionInfo regionInfo) throws IOException;
51  
52    /**
53     * @return Implementation of {@link CompactionRequestor} or null.
54     */
55    CompactionRequestor getCompactionRequester();
56  
57    /**
58     * @return Implementation of {@link FlushRequester} or null.
59     */
60    FlushRequester getFlushRequester();
61  
62    /**
63     * @return the RegionServerAccounting for this Region Server
64     */
65    RegionServerAccounting getRegionServerAccounting();
66  
67    /**
68     * @return RegionServer's instance of {@link TableLockManager}
69     */
70    TableLockManager getTableLockManager();
71  
72    /**
73     * Tasks to perform after region open to complete deploy of region on
74     * regionserver
75     *
76     * @param r Region to open.
77     * @param ct Instance of {@link CatalogTracker}
78     * @throws KeeperException
79     * @throws IOException
80     */
81    void postOpenDeployTasks(final HRegion r, final CatalogTracker ct)
82    throws KeeperException, IOException;
83  
84    /**
85     * Notify master that a handler requests to change a region state
86     */
87    boolean reportRegionTransition(TransitionCode code, long openSeqNum, HRegionInfo... hris);
88  
89    /**
90     * Notify master that a handler requests to change a region state
91     */
92    boolean reportRegionTransition(TransitionCode code, HRegionInfo... hris);
93  
94    /**
95     * Returns a reference to the region server's RPC server
96     */
97    RpcServerInterface getRpcServer();
98  
99    /**
100    * Get the regions that are currently being opened or closed in the RS
101    * @return map of regions in transition in this RS
102    */
103   ConcurrentMap<byte[], Boolean> getRegionsInTransitionInRS();
104 
105   /**
106    * @return Return the FileSystem object used by the regionserver
107    */
108   FileSystem getFileSystem();
109 
110   /**
111    * @return The RegionServer's "Leases" service
112    */
113   Leases getLeases();
114 
115   /**
116    * @return hbase executor service
117    */
118   ExecutorService getExecutorService();
119 
120   /**
121    * @return The RegionServer's CatalogTracker
122    */
123   CatalogTracker getCatalogTracker();
124 
125   /**
126    * @return set of recovering regions on the hosting region server
127    */
128   Map<String, HRegion> getRecoveringRegions();
129 
130   /**
131    * Only required for "old" log replay; if it's removed, remove this.
132    * @return The RegionServer's NonceManager
133    */
134   public ServerNonceManager getNonceManager();
135 }