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