001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase; 019 020import org.apache.yetus.audience.InterfaceAudience; 021 022/** 023 * <p> 024 * There are two modes with catalog replica support. 025 * </p> 026 * <ol> 027 * <li>HEDGED_READ - Client sends requests to the primary region first, within a configured amount 028 * of time, if there is no response coming back, client sends requests to all replica regions and 029 * takes the first response.</li> 030 * <li>LOAD_BALANCE - Client sends requests to replica regions in a round-robin mode, if results 031 * from replica regions are stale, next time, client sends requests for these stale locations to the 032 * primary region. In this mode, scan requests are load balanced across all replica regions.</li> 033 * </ol> 034 */ 035@InterfaceAudience.Private 036public enum CatalogReplicaMode { 037 NONE { 038 @Override 039 public String toString() { 040 return "None"; 041 } 042 }, 043 HEDGED_READ { 044 @Override 045 public String toString() { 046 return "HedgedRead"; 047 } 048 }, 049 LOAD_BALANCE { 050 @Override 051 public String toString() { 052 return "LoadBalance"; 053 } 054 }; 055 056 public static CatalogReplicaMode fromString(final String value) { 057 for (CatalogReplicaMode mode : values()) { 058 if (mode.toString().equalsIgnoreCase(value)) { 059 return mode; 060 } 061 } 062 throw new IllegalArgumentException(); 063 } 064}