You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/06/24 06:56:01 UTC

[GitHub] [hbase] infraio commented on a change in pull request #1943: HBASE-24609 Move MetaTableAccessor out of hbase-client

infraio commented on a change in pull request #1943:
URL: https://github.com/apache/hbase/pull/1943#discussion_r444682937



##########
File path: hbase-client/src/main/java/org/apache/hadoop/hbase/CatalogFamilyFormat.java
##########
@@ -0,0 +1,349 @@
+/**
+ * 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;
+
+import edu.umd.cs.findbugs.annotations.Nullable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.SortedMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.RegionInfoBuilder;
+import org.apache.hadoop.hbase.client.RegionReplicaUtil;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Helper class for generating/parsing
+ * {@value org.apache.hadoop.hbase.HConstants#CATALOG_FAMILY_STR} family cells in meta table.
+ * <p/>
+ * The cells in catalog family are:
+ *
+ * <pre>
+ * For each table range ('Region'), there is a single row, formatted as:
+ * &lt;tableName&gt;,&lt;startKey&gt;,&lt;regionId&gt;,&lt;encodedRegionName&gt;.
+ * This row is the serialized regionName of the default region replica.
+ * Columns are:
+ * info:regioninfo         => contains serialized HRI for the default region replica
+ * info:server             => contains hostname:port (in string form) for the server hosting
+ *                            the default regionInfo replica
+ * info:server_&lt;replicaId&gt => contains hostname:port (in string form) for the server hosting
+ *                                 the regionInfo replica with replicaId
+ * info:serverstartcode    => contains server start code (in binary long form) for the server
+ *                            hosting the default regionInfo replica
+ * info:serverstartcode_&lt;replicaId&gt => contains server start code (in binary long form) for
+ *                                          the server hosting the regionInfo replica with
+ *                                          replicaId
+ * info:seqnumDuringOpen   => contains seqNum (in binary long form) for the region at the time
+ *                            the server opened the region with default replicaId
+ * info:seqnumDuringOpen_&lt;replicaId&gt => contains seqNum (in binary long form) for the region
+ *                                           at the time the server opened the region with
+ *                                           replicaId
+ * info:splitA             => contains a serialized HRI for the first daughter region if the
+ *                            region is split
+ * info:splitB             => contains a serialized HRI for the second daughter region if the
+ *                            region is split
+ * info:merge*             => contains a serialized HRI for a merge parent region. There will be two
+ *                            or more of these columns in a row. A row that has these columns is
+ *                            undergoing a merge and is the result of the merge. Columns listed
+ *                            in marge* columns are the parents of this merged region. Example
+ *                            columns: info:merge0001, info:merge0002. You make also see 'mergeA',
+ *                            and 'mergeB'. This is old form replaced by the new format that allows
+ *                            for more than two parents to be merged at a time.
+ * </pre>
+ */
+@InterfaceAudience.Private
+public class CatalogFamilyFormat {
+
+  private static final Logger LOG = LoggerFactory.getLogger(CatalogFamilyFormat.class);
+
+  /** A regex for parsing server columns from meta. See above javadoc for meta layout */
+  private static final Pattern SERVER_COLUMN_PATTERN =
+    Pattern.compile("^server(_[0-9a-fA-F]{4})?$");

Review comment:
       replica_id is a integer? So it should only have [0-9]? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org