View Javadoc

1   /**
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.ipc;
21  
22  import java.io.IOException;
23  
24  import org.apache.hadoop.hbase.HServerLoad;
25  import org.apache.hadoop.hbase.ServerName;
26  import org.apache.hadoop.hbase.security.KerberosInfo;
27  import org.apache.hadoop.io.MapWritable;
28  import org.apache.hadoop.hbase.ipc.VersionedProtocol;
29  
30  /**
31   * The Master publishes this Interface for RegionServers to register themselves
32   * on.
33   */
34  @KerberosInfo(
35      serverPrincipal = "hbase.master.kerberos.principal",
36      clientPrincipal = "hbase.regionserver.kerberos.principal")
37  public interface HMasterRegionInterface extends VersionedProtocol {
38    /**
39     * This Interfaces' version. Version changes when the Interface changes.
40     */
41    // All HBase Interfaces used derive from HBaseRPCProtocolVersion.  It
42    // maintained a single global version number on all HBase Interfaces.  This
43    // meant all HBase RPC was broke though only one of the three RPC Interfaces
44    // had changed.  This has since been undone.
45    public static final long VERSION = 29L;
46  
47    /**
48     * Called when a region server first starts.
49     * @param port Port number this regionserver is up on.
50     * @param serverStartcode This servers' startcode.
51     * @param serverCurrentTime The current time of the region server in ms
52     * @throws IOException e
53     * @return Configuration for the regionserver to use: e.g. filesystem,
54     * hbase rootdir, the hostname to use creating the RegionServer ServerName,
55     * etc.
56     */
57    public MapWritable regionServerStartup(final int port,
58      final long serverStartcode, final long serverCurrentTime)
59    throws IOException;
60  
61    /**
62     * @param sn {@link ServerName#getVersionedBytes()}
63     * @param hsl Server load.
64     * @throws IOException
65     */
66    public void regionServerReport(byte [] sn, HServerLoad hsl)
67    throws IOException;
68    
69    /**
70     * Called by a region server to report a fatal error that is causing
71     * it to abort.
72     * @param sn {@link ServerName#getVersionedBytes()}
73     * @param errorMessage informative text to expose in the master logs and UI
74     */
75    public void reportRSFatalError(byte [] sn, String errorMessage);
76  }