Index: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1465538) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -191,6 +191,7 @@ import org.apache.hadoop.hbase.regionserver.wal.HLogFactory; import org.apache.hadoop.hbase.regionserver.wal.HLogUtil; import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; +import org.apache.hadoop.hbase.replication.regionserver.SinkServiceUnavailableException; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.CompressionTest; @@ -3607,6 +3608,10 @@ if (entries != null && entries.length > 0) { replicationSinkHandler.replicateLogEntries(entries); } + } else { + LOG.warn("ReplicationSink service is not initialized. hbase.replication may not be configured correctly."); + throw new SinkServiceUnavailableException( + "ReplicationSink service was not initialized"); } return ReplicateWALEntryResponse.newBuilder().build(); } catch (IOException ie) { Index: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (revision 1465538) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (working copy) @@ -59,6 +59,7 @@ import org.apache.hadoop.hbase.regionserver.wal.HLogKey; import org.apache.hadoop.hbase.regionserver.wal.WALEdit; import org.apache.hadoop.hbase.replication.ReplicationZookeeper; +import org.apache.hadoop.hbase.replication.regionserver.SinkServiceUnavailableException; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.ipc.RemoteException; @@ -722,13 +723,23 @@ this.metrics.refreshAgeOfLastShippedOp(); if (ioe instanceof RemoteException) { ioe = ((RemoteException) ioe).unwrapRemoteException(); - LOG.warn("Can't replicate because of an error on the remote cluster: ", ioe); + boolean shouldSleep = false; + String msg = null; if (ioe instanceof TableNotFoundException) { - if (sleepForRetries("A table is missing in the peer cluster. " - + "Replication cannot proceed without losing data.", sleepMultiplier)) { - sleepMultiplier++; - } + shouldSleep = true; + msg = "A table is missing in the peer cluster. Replication cannot proceed without losing data."; + // Need not to print the error stack trace. + LOG.warn("Can't replicate because of a table is missing in the peer cluster."); + } else if (ioe instanceof SinkServiceUnavailableException) { + shouldSleep = true; + msg = "SinkService is unavailable."; + LOG.warn("Can't replicate because of SinkSevice is unavailable on the remote cluster."); + } else { + LOG.warn("Can't replicate because of an error on the remote cluster: ", ioe); } + if (shouldSleep && sleepForRetries(msg, sleepMultiplier)) { + sleepMultiplier++; + } } else { if (ioe instanceof SocketTimeoutException) { // This exception means we waited for more than 60s and nothing Index: hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/SinkServiceUnavailableException.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/SinkServiceUnavailableException.java (revision 0) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/SinkServiceUnavailableException.java (working copy) @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.replication.regionserver; + +import java.io.IOException; + +/** + * Thrown by a region server if it is sent a replication request but SinkService + * is not started yet. + */ +public class SinkServiceUnavailableException extends IOException { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = -2938938013388635709L; + + /** + * Default constructor + */ + public SinkServiceUnavailableException() { + super(); + } + + /** + * Constructor + * @param msg message + */ + public SinkServiceUnavailableException(String msg) { + super(msg); + } +}