hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1304702 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck: TableIntegrityErrorHandler.java TableIntegrityErrorHandlerImpl.java
Date Sat, 24 Mar 2012 03:58:22 GMT
Author: tedyu
Date: Sat Mar 24 03:58:22 2012
New Revision: 1304702

URL: http://svn.apache.org/viewvc?rev=1304702&view=rev
Log:
HBASE-5128 Addendum adds two new files Jon forgot to add

Added:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandler.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandlerImpl.java

Added: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandler.java?rev=1304702&view=auto
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandler.java
(added)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandler.java
Sat Mar 24 03:58:22 2012
@@ -0,0 +1,92 @@
+/**
+ * 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.util.hbck;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo;
+import org.apache.hadoop.hbase.util.HBaseFsck.TableInfo;
+
+/**
+ * This interface provides callbacks for handling particular table integrity
+ * invariant violations.  This could probably be boiled down to handling holes
+ * and handling overlaps but currently preserves the older more specific error
+ * condition codes.
+ */
+public interface TableIntegrityErrorHandler {
+
+  TableInfo getTableInfo();
+
+  /**
+   * Set the TableInfo used by all HRegionInfos fabricated by other callbacks
+   */
+  void setTableInfo(TableInfo ti);
+
+  /**
+   * Callback for handling case where a Table has a first region that does not
+   * have an empty start key.
+   *
+   * @param hi An HbckInfo of the second region in a table.  This should have
+   *    a non-empty startkey, and can be used to fabricate a first region that
+   *    has an empty start key.
+   */
+  void handleRegionStartKeyNotEmpty(HbckInfo hi) throws IOException;
+
+  /**
+   * Callback for handling a region that has the same start and end key.
+   *
+   * @param hi An HbckInfo for a degenerate key.
+   */
+  void handleDegenerateRegion(HbckInfo hi) throws IOException;
+
+  /**
+   * Callback for handling two regions that have the same start key.  This is
+   * a specific case of a region overlap.
+   * @param hi1 one of the overlapping HbckInfo 
+   * @param hi2 the other overlapping HbckInfo
+   */
+  void handleDuplicateStartKeys(HbckInfo hi1, HbckInfo hi2) throws IOException;
+
+  /**
+   * Callback for handling two reigons that overlap in some arbitrary way.
+   * This is a specific case of region overlap, and called for each possible
+   * pair. If two regions have the same start key, the handleDuplicateStartKeys
+   * method is called.
+   * @param hi1 one of the overlapping HbckInfo
+   * @param hi2 the other overlapping HbckInfo
+   */
+  void handleOverlapInRegionChain(HbckInfo hi1, HbckInfo hi2)
+      throws IOException;
+
+  /**
+   * Callback for handling a region hole between two keys.
+   * @param holeStartKey key at the beginning of the region hole
+   * @param holeEndKey key at the end of the region hole
+   
+   */
+  void handleHoleInRegionChain(byte[] holeStartKey, byte[] holeEndKey)
+      throws IOException;
+
+  /**
+   * Callback for handling an group of regions that overlap.
+   * @param overlap Collection of overlapping regions.
+   */
+  void handleOverlapGroup(Collection<HbckInfo> overlap) throws IOException;
+}

Added: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandlerImpl.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandlerImpl.java?rev=1304702&view=auto
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandlerImpl.java
(added)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/hbck/TableIntegrityErrorHandlerImpl.java
Sat Mar 24 03:58:22 2012
@@ -0,0 +1,96 @@
+/**
+ * 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.util.hbck;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo;
+import org.apache.hadoop.hbase.util.HBaseFsck.TableInfo;
+
+/**
+ * Simple implementation of TableIntegrityErrorHandler. Can be used as a base
+ * class.
+ */
+abstract public class TableIntegrityErrorHandlerImpl implements
+    TableIntegrityErrorHandler {
+  TableInfo ti;
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public TableInfo getTableInfo() {
+    return ti;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void setTableInfo(TableInfo ti2) {
+    this.ti = ti2;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void handleRegionStartKeyNotEmpty(HbckInfo hi) throws IOException {
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void handleDegenerateRegion(HbckInfo hi) throws IOException {
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void handleDuplicateStartKeys(HbckInfo hi1, HbckInfo hi2)
+      throws IOException {
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void handleOverlapInRegionChain(HbckInfo hi1, HbckInfo hi2)
+      throws IOException {
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void handleHoleInRegionChain(byte[] holeStart, byte[] holeEnd)
+      throws IOException {
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void handleOverlapGroup(Collection<HbckInfo> overlap)
+      throws IOException {
+  }
+
+}



Mime
View raw message