hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1154063 - in /hadoop/common/branches/HDFS-1623/hadoop-common: ./ src/main/java/org/apache/hadoop/ha/
Date Fri, 05 Aug 2011 01:34:33 GMT
Author: suresh
Date: Fri Aug  5 01:34:32 2011
New Revision: 1154063

URL: http://svn.apache.org/viewvc?rev=1154063&view=rev
Log:
HADOOP-7455. HA: Introduce HA Service Protocol Interface. Contributed by Suresh Srinivas.


Added:
    hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/
    hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HAServiceProtocol.java
    hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HealthCheckFailedException.java
    hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/ServiceFailedException.java
Modified:
    hadoop/common/branches/HDFS-1623/hadoop-common/CHANGES.txt

Modified: hadoop/common/branches/HDFS-1623/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common/CHANGES.txt?rev=1154063&r1=1154062&r2=1154063&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-common/CHANGES.txt Fri Aug  5 01:34:32 2011
@@ -63,6 +63,8 @@ Trunk (unreleased changes)
     HADOOP-6385. dfs should support -rmdir (was HDFS-639). (Daryn Sharp
     via mattf)
 
+    HADOOP-7455. HA: Introduce HA Service Protocol Interface. (suresh)
+
   IMPROVEMENTS
 
     HADOOP-7042. Updates to test-patch.sh to include failed test names and

Added: hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HAServiceProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HAServiceProtocol.java?rev=1154063&view=auto
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HAServiceProtocol.java
(added)
+++ hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HAServiceProtocol.java
Fri Aug  5 01:34:32 2011
@@ -0,0 +1,72 @@
+/**
+ * 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.ha;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.ipc.VersionedProtocol;
+
+/**
+ * Protocol interface that provides High Availability related primitives to
+ * monitor and fail-over the service.
+ * 
+ * This interface could be used by HA frameworks to manage the service.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public interface HAServiceProtocol extends VersionedProtocol {
+  /**
+   * Initial version of the protocol
+   */
+  public static final long versionID = 1L;
+
+  /**
+   * Monitor the health of service. This periodically called by the HA
+   * frameworks to monitor the health of the service.
+   * 
+   * Service is expected to perform checks to ensure it is functional.
+   * If the service is not healthy due to failure or partial failure,
+   * it is expected to throw {@link HealthCheckFailedException}.
+   * The definition of service not healthy is left to the service.
+   * 
+   * Note that when health check of an Active service fails,
+   * failover to standby may be done.
+   * 
+   * @throws HealthCheckFailedException
+   *           if the health check of a service fails.
+   */
+  public void monitorHealth() throws HealthCheckFailedException;
+
+  /**
+   * Request service to transition to active state. No operation, if the
+   * service is already in active state.
+   * 
+   * @throws ServiceFailedException
+   *           if transition from standby to active fails.
+   */
+  public void transitionToActive() throws ServiceFailedException;
+
+  /**
+   * Request service to transition to standby state. No operation, if the
+   * service is already in standby state.
+   * 
+   * @throws ServiceFailedException
+   *           if transition from active to standby fails.
+   */
+  public void transitionToStandby() throws ServiceFailedException;
+}

Added: hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HealthCheckFailedException.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HealthCheckFailedException.java?rev=1154063&view=auto
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HealthCheckFailedException.java
(added)
+++ hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/HealthCheckFailedException.java
Fri Aug  5 01:34:32 2011
@@ -0,0 +1,55 @@
+/**
+ * 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.ha;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+/**
+ * Exception thrown to indicate that health check of a service
+ * failed.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public class HealthCheckFailedException extends Exception {
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Constructs exception with the specified detail message.
+   * @param  message the detail message (which is saved for later retrieval
+   *         by the {@link #getMessage()} method).
+   */
+  public HealthCheckFailedException(final String message) {
+    super(message);
+  }
+  
+  /**
+   * Constructs a new exception with the specified detail message and
+   * cause.
+   *
+   * @param  message the detail message (which is saved for later retrieval
+   *         by the {@link #getMessage()} method).
+   * @param  cause the cause (which is saved for later retrieval by the
+   *         {@link #getCause()} method).  (A <tt>null</tt> value is
+   *         permitted, and indicates that the cause is nonexistent or
+   *         unknown.)
+   */
+  public HealthCheckFailedException(String message, Throwable cause) {
+    super(message, cause);
+  }
+}

Added: hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/ServiceFailedException.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/ServiceFailedException.java?rev=1154063&view=auto
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/ServiceFailedException.java
(added)
+++ hadoop/common/branches/HDFS-1623/hadoop-common/src/main/java/org/apache/hadoop/ha/ServiceFailedException.java
Fri Aug  5 01:34:32 2011
@@ -0,0 +1,56 @@
+/**
+ * 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.ha;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+
+/**
+ * Exception thrown to indicate that an operation performed
+ * to modify the state of a service or application failed.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Evolving
+public class ServiceFailedException extends Exception {
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Constructs exception with the specified detail message.
+   * @param  message the detail message (which is saved for later retrieval
+   *         by the {@link #getMessage()} method).
+   */
+  public ServiceFailedException(final String message) {
+    super(message);
+  }
+  
+  /**
+   * Constructs a new exception with the specified detail message and
+   * cause.
+   *
+   * @param  message the detail message (which is saved for later retrieval
+   *         by the {@link #getMessage()} method).
+   * @param  cause the cause (which is saved for later retrieval by the
+   *         {@link #getCause()} method).  (A <tt>null</tt> value is
+   *         permitted, and indicates that the cause is nonexistent or
+   *         unknown.)
+   */
+  public ServiceFailedException(String message, Throwable cause) {
+      super(message, cause);
+  }
+}



Mime
View raw message