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.HServerLoadWithSeqIds; 26 import org.apache.hadoop.hbase.ServerName; 27 import org.apache.hadoop.hbase.security.KerberosInfo; 28 import org.apache.hadoop.io.MapWritable; 29 import org.apache.hadoop.hbase.ipc.VersionedProtocol; 30 31 /** 32 * The Master publishes this Interface for RegionServers to register themselves 33 * on. 34 */ 35 @KerberosInfo( 36 serverPrincipal = "hbase.master.kerberos.principal", 37 clientPrincipal = "hbase.regionserver.kerberos.principal") 38 public interface HMasterRegionInterface extends VersionedProtocol { 39 /** 40 * This Interfaces' version. Version changes when the Interface changes. 41 */ 42 // All HBase Interfaces used derive from HBaseRPCProtocolVersion. It 43 // maintained a single global version number on all HBase Interfaces. This 44 // meant all HBase RPC was broke though only one of the three RPC Interfaces 45 // had changed. This has since been undone. 46 public static final long VERSION = 29L; 47 48 /** 49 * Called when a region server first starts. 50 * @param port Port number this regionserver is up on. 51 * @param serverStartcode This servers' startcode. 52 * @param serverCurrentTime The current time of the region server in ms 53 * @throws IOException e 54 * @return Configuration for the regionserver to use: e.g. filesystem, 55 * hbase rootdir, the hostname to use creating the RegionServer ServerName, 56 * etc. 57 */ 58 public MapWritable regionServerStartup(final int port, 59 final long serverStartcode, final long serverCurrentTime) 60 throws IOException; 61 62 /** 63 * @param sn {@link ServerName#getVersionedBytes()} 64 * @param hsl Server load. 65 * @throws IOException 66 */ 67 public void regionServerReport(byte [] sn, HServerLoad hsl) 68 throws IOException; 69 70 /** 71 * Called by a region server to report a fatal error that is causing 72 * it to abort. 73 * @param sn {@link ServerName#getVersionedBytes()} 74 * @param errorMessage informative text to expose in the master logs and UI 75 */ 76 public void reportRSFatalError(byte [] sn, String errorMessage); 77 78 /** 79 * @see HServerLoadWithSeqIds 80 * @param sn {@link ServerName#getVersionedBytes()} 81 * @param hsl Server load. 82 * @throws IOException 83 */ 84 public void regionServerReportWithSeqId(byte [] sn, HServerLoadWithSeqIds hsl) 85 throws IOException; 86 87 /** 88 * Gets the last complete sequence ID for a particular region. 89 * @throws IOException 90 */ 91 public long getLastFlushedSequenceId(byte [] regionName) throws IOException; 92 }