Permalink
Browse files

Changes to Hinted Handoff store definition + Remove deprecated remote…

… test
  • Loading branch information...
1 parent 0c7bcf8 commit 4f304863d4f121f0417e90dec6a2360244ea918e @rsumbaly rsumbaly committed with afeinberg Oct 14, 2010
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2008-2009 LinkedIn, Inc
-#
-# Licensed 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.
-#
-
-bin_dir=$(dirname $0)
-
-${bin_dir}/run-class.sh voldemort.performance.RemoteTest $@
@@ -91,7 +91,6 @@ public static void main(String[] args) throws Exception {
.setRequestFormatType(RequestFormatType.VOLDEMORT_V3);
if(options.has("client-zone-id")) {
- clientConfig.setEnablePipelineRoutedStore(true);
clientConfig.setClientZoneId((Integer) options.valueOf("client-zone-id"));
}
@@ -159,7 +159,7 @@ public AbstractStoreClientFactory(ClientConfig config) {
Map<Integer, NonblockingStore> nonblockingStores = Maps.newHashMap();
Map<Integer, Store<ByteArray, Slop, byte[]>> slopStores = null;
- if(config.isHintedHandoffEnabled() && storeDef.isHintedHandoffEnabled())
+ if(storeDef.hasHintedHandoffStrategyType())
slopStores = Maps.newHashMap();
for(Node node: cluster.getNodes()) {
@@ -63,8 +63,6 @@
private volatile boolean enablePipelineRoutedStore = true;
private volatile int clientZoneId = Zone.DEFAULT_ZONE_ID;
- private volatile boolean enableHintedHandoff = true;
-
private volatile String failureDetectorImplementation = FailureDetectorConfig.DEFAULT_IMPLEMENTATION_CLASS_NAME;
private volatile long failureDetectorBannagePeriod = FailureDetectorConfig.DEFAULT_BANNAGE_PERIOD;
private volatile int failureDetectorThreshold = FailureDetectorConfig.DEFAULT_THRESHOLD;
@@ -192,9 +190,6 @@ private void setProperties(Properties properties) {
if(props.containsKey(ENABLE_PIPELINE_ROUTED_STORE_PROPERTY))
this.setEnablePipelineRoutedStore(props.getBoolean(ENABLE_PIPELINE_ROUTED_STORE_PROPERTY));
- if(props.containsKey(ENABLE_HINTED_HANDOFF_PROPERTY))
- this.setEnableHintedHandoff(props.getBoolean(ENABLE_HINTED_HANDOFF_PROPERTY));
-
if(props.containsKey(CLIENT_ZONE_ID))
this.setClientZoneId(props.getInt(CLIENT_ZONE_ID));
@@ -525,15 +520,6 @@ public ClientConfig setEnablePipelineRoutedStore(boolean enablePipelineRoutedSto
return this;
}
- public boolean isHintedHandoffEnabled() {
- return enableHintedHandoff;
- }
-
- public ClientConfig setEnableHintedHandoff(boolean enableHintedHandoff) {
- this.enableHintedHandoff = enableHintedHandoff;
- return this;
- }
-
public String getFailureDetectorImplementation() {
return failureDetectorImplementation;
}
@@ -21,6 +21,7 @@
import voldemort.client.RoutingTier;
import voldemort.serialization.SerializerDefinition;
+import voldemort.store.slop.HintedHandoffStrategyType;
import voldemort.utils.Utils;
import com.google.common.base.Objects;
@@ -54,8 +55,7 @@
private final Integer zoneCountWrites;
private final String valueTransformation;
private final String serializerFactory;
- private final Boolean enableHintedHandoff;
- private final String hintedHandoffStrategyType;
+ private final HintedHandoffStrategyType hintedHandoffStrategyType;
private final Integer hintPrefListSize;
public StoreDefinition(String name,
@@ -78,8 +78,7 @@ public StoreDefinition(String name,
Integer retentionDays,
Integer retentionThrottleRate,
String factory,
- Boolean enableHintedHandoff,
- String hintedHandoffStrategyType,
+ HintedHandoffStrategyType hintedHandoffStrategyType,
Integer hintPrefListSize) {
this.name = Utils.notNull(name);
this.type = Utils.notNull(type);
@@ -101,7 +100,6 @@ public StoreDefinition(String name,
this.zoneCountReads = zoneCountReads;
this.zoneCountWrites = zoneCountWrites;
this.serializerFactory = factory;
- this.enableHintedHandoff = enableHintedHandoff;
this.hintedHandoffStrategyType = hintedHandoffStrategyType;
this.hintPrefListSize = hintPrefListSize;
checkParameterLegality();
@@ -267,15 +265,7 @@ public boolean hasZoneCountWrites() {
return zoneCountWrites != null;
}
- public boolean hasHintedHandoffEnabled() {
- return enableHintedHandoff != null;
- }
-
- public boolean isHintedHandoffEnabled() {
- return !hasHintedHandoffEnabled() || enableHintedHandoff;
- }
-
- public String getHintedHandoffStrategyType() {
+ public HintedHandoffStrategyType getHintedHandoffStrategyType() {
return hintedHandoffStrategyType;
}
@@ -332,7 +322,6 @@ else if(!(o.getClass() == StoreDefinition.class))
&& Objects.equal(getSerializerFactory() != null ? getSerializerFactory() : null,
def.getSerializerFactory() != null ? def.getSerializerFactory()
: null)
- && Objects.equal(isHintedHandoffEnabled(), def.isHintedHandoffEnabled())
&& Objects.equal(getHintedHandoffStrategyType(), def.getHintedHandoffStrategyType())
&& Objects.equal(getHintPrefListSize(), def.getHintPrefListSize());
}
@@ -361,7 +350,6 @@ public int hashCode() {
getRetentionDays(),
getRetentionScanThrottleRate(),
getSerializerFactory(),
- isHintedHandoffEnabled(),
hasHintedHandoffStrategyType() ? getHintedHandoffStrategyType()
: null,
hasHintPreflistSize() ? getHintPrefListSize() : null);
@@ -381,7 +369,6 @@ public String toString() {
+ ", throttle-rate = " + getRetentionScanThrottleRate() + ", zone-count-reads = "
+ getZoneCountReads() + ", zone-count-writes = " + getZoneCountWrites()
+ ", serializer factory = " + getSerializerFactory() + ")"
- + ", enable-hinted-handoff = " + isHintedHandoffEnabled()
+ ", hinted-handoff-strategy = " + getHintedHandoffStrategyType()
+ ", hint-preflist-size = " + getHintPrefListSize() + ")";
}
@@ -4,6 +4,7 @@
import voldemort.client.RoutingTier;
import voldemort.serialization.SerializerDefinition;
+import voldemort.store.slop.HintedHandoffStrategyType;
import voldemort.utils.Utils;
/**
@@ -34,8 +35,7 @@
private Integer zoneCountWrites;
private String view = null;
private String serializerFactory = null;
- private Boolean enableHintedHandoff = false;
- private String hintedHandoffStrategy = null;
+ private HintedHandoffStrategyType hintedHandoffStrategy = null;
private Integer hintPrefListSize = null;
public String getName() {
@@ -234,20 +234,11 @@ public StoreDefinitionBuilder setZoneCountWrites(Integer zoneCountWrites) {
return this;
}
- public Boolean isHintedHandoffEnabled() {
- return enableHintedHandoff;
- }
-
- public StoreDefinitionBuilder setEnableHintedHandoff(Boolean enableHintedHandoff) {
- this.enableHintedHandoff = enableHintedHandoff;
- return this;
- }
-
- public String getHintedHandoffStrategy() {
+ public HintedHandoffStrategyType getHintedHandoffStrategy() {
return hintedHandoffStrategy;
}
- public StoreDefinitionBuilder setHintedHandoffStrategy(String hintedHandoffStrategy) {
+ public StoreDefinitionBuilder setHintedHandoffStrategy(HintedHandoffStrategyType hintedHandoffStrategy) {
this.hintedHandoffStrategy = hintedHandoffStrategy;
return this;
}
@@ -282,7 +273,6 @@ public StoreDefinition build() {
this.getRetentionPeriodDays(),
this.getRetentionScanThrottleRate(),
this.getSerializerFactory(),
- this.isHintedHandoffEnabled(),
this.getHintedHandoffStrategy(),
this.getHintPrefListSize());
}
@@ -112,7 +112,7 @@ public PipelineRoutedStore(String name,
this.nonblockingStores = new ConcurrentHashMap<Integer, NonblockingStore>(nonblockingStores);
this.slopStores = slopStores;
- if(storeDef.isHintedHandoffEnabled()) {
+ if(storeDef.hasHintedHandoffStrategyType()) {
HintedHandoffStrategyFactory factory = new HintedHandoffStrategyFactory(zoneRoutingEnabled,
clientZone.getId());
this.handoffStrategy = factory.updateHintedHandoffStrategy(storeDef, cluster);
@@ -9,6 +9,7 @@
* {@link HintedHandoffStrategyType}.
*/
public class HintedHandoffStrategyFactory {
+
private final boolean enableZoneRouting;
private final int clientZoneId;
@@ -19,7 +20,9 @@ public HintedHandoffStrategyFactory(boolean enableZoneRouting, int clientZoneId)
public HintedHandoffStrategy updateHintedHandoffStrategy(StoreDefinition storeDef,
Cluster cluster) {
- if(HintedHandoffStrategyType.CONSISTENT_STRATEGY.equals(storeDef.getHintedHandoffStrategyType())) {
+ if(HintedHandoffStrategyType.CONSISTENT_STRATEGY.toDisplay()
+ .compareTo(storeDef.getHintedHandoffStrategyType()
+ .toDisplay()) == 0) {
Integer hintPrefListSize = storeDef.getHintPrefListSize();
if(null == hintPrefListSize) {
if(cluster.getNumberOfNodes() > 6)
@@ -31,10 +34,13 @@ public HintedHandoffStrategy updateHintedHandoffStrategy(StoreDefinition storeDe
hintPrefListSize,
enableZoneRouting,
clientZoneId);
- } else if(HintedHandoffStrategyType.TO_ALL_STRATEGY.equals(storeDef.getHintedHandoffStrategyType())) {
+ } else if(HintedHandoffStrategyType.TO_ALL_STRATEGY.toDisplay()
+ .compareTo(storeDef.getHintedHandoffStrategyType()
+ .toDisplay()) == 0) {
return new HandoffToAllStrategy(cluster, enableZoneRouting, clientZoneId);
} else {
- throw new VoldemortException("HintedHandoffStrategyType:" + storeDef.getHintedHandoffStrategyType()
+ throw new VoldemortException("HintedHandoffStrategyType:"
+ + storeDef.getHintedHandoffStrategyType()
+ " not handled by " + this.getClass());
}
}
@@ -1,20 +1,28 @@
package voldemort.store.slop;
/**
- * An enumeration of HintedHandoffStrategy type
+ * Enumerates different hinted handoff strategies.
+ *
+ *
*/
-public class HintedHandoffStrategyType {
+public enum HintedHandoffStrategyType {
+ CONSISTENT_STRATEGY("consistent-handoff"),
+ TO_ALL_STRATEGY("all-handoff");
- public static String CONSISTENT_STRATEGY = "consistent-handoff";
- public static String TO_ALL_STRATEGY = "all-handoff";
+ private final String text;
- private final String name;
+ private HintedHandoffStrategyType(String text) {
+ this.text = text;
+ }
- private HintedHandoffStrategyType(String name) {
- this.name = name;
+ public static HintedHandoffStrategyType fromDisplay(String type) {
+ for(HintedHandoffStrategyType t: HintedHandoffStrategyType.values())
+ if(t.toDisplay().compareTo(type) == 0)
+ return t;
+ return null;
}
- public String getName() {
- return name;
+ public String toDisplay() {
+ return text;
}
-}
+}
@@ -83,7 +83,6 @@
public final static String STORE_ZONE_REPLICATION_FACTOR_ELMT = "zone-replication-factor";
public final static String STORE_ZONE_COUNT_READS = "zone-count-reads";
public final static String STORE_ZONE_COUNT_WRITES = "zone-count-writes";
- public final static String HINTED_HANDOFF_ENABLE = "enable-hinted-handoff";
public final static String HINTED_HANDOFF_STRATEGY = "hinted-handoff-strategy";
public final static String HINT_PREFLIST_SIZE = "hint-preflist-size";
public final static String VIEW_ELMT = "view";
@@ -227,15 +226,10 @@ private StoreDefinition readStore(Element store) {
}
}
- String enableHintedHandoffStr = store.getChildText(HINTED_HANDOFF_ENABLE);
- boolean enableHintedHandoff = true;
- if(null != enableHintedHandoffStr)
- enableHintedHandoff = Boolean.parseBoolean(enableHintedHandoffStr);
-
- String hintedHandoffStrategy = null;
- if(enableHintedHandoff)
- hintedHandoffStrategy = (null != store.getChildText(HINTED_HANDOFF_STRATEGY)) ? store.getChildText(HINTED_HANDOFF_STRATEGY)
- : HintedHandoffStrategyType.TO_ALL_STRATEGY;
+ HintedHandoffStrategyType hintedHandoffStrategy = null;
+ if(store.getChildText(HINTED_HANDOFF_STRATEGY) != null)
+ hintedHandoffStrategy = HintedHandoffStrategyType.fromDisplay(store.getChildText(HINTED_HANDOFF_STRATEGY));
+
String hintPrefListSizeStr = store.getChildText(HINT_PREFLIST_SIZE);
Integer hintPrefListSize = (null != hintPrefListSizeStr) ? Integer.parseInt(hintPrefListSizeStr)
: null;
@@ -256,7 +250,6 @@ private StoreDefinition readStore(Element store) {
.setZoneReplicationFactor(zoneReplicationFactor)
.setZoneCountReads(zoneCountReads)
.setZoneCountWrites(zoneCountWrites)
- .setEnableHintedHandoff(enableHintedHandoff)
.setHintedHandoffStrategy(hintedHandoffStrategy)
.setHintPrefListSize(hintPrefListSize)
.build();
@@ -403,14 +396,11 @@ private Element storeToElement(StoreDefinition storeDefinition) {
if(storeDefinition.hasZoneCountWrites())
store.addContent(new Element(STORE_ZONE_COUNT_WRITES).setText(Integer.toString(storeDefinition.getZoneCountWrites())));
- if(storeDefinition.hasHintedHandoffEnabled()) {
- store.addContent(new Element(HINTED_HANDOFF_ENABLE).setText(Boolean.toString(storeDefinition.isHintedHandoffEnabled())));
-
- if(storeDefinition.hasHintedHandoffStrategyType())
- store.addContent(new Element(HINTED_HANDOFF_STRATEGY).setText(storeDefinition.getHintedHandoffStrategyType()));
- if(storeDefinition.hasHintPreflistSize())
- store.addContent(new Element(HINT_PREFLIST_SIZE).setText(Integer.toString(storeDefinition.getHintPrefListSize())));
- }
+ if(storeDefinition.hasHintedHandoffStrategyType())
+ store.addContent(new Element(HINTED_HANDOFF_STRATEGY).setText(storeDefinition.getHintedHandoffStrategyType()
+ .toDisplay()));
+ if(storeDefinition.hasHintPreflistSize())
+ store.addContent(new Element(HINT_PREFLIST_SIZE).setText(Integer.toString(storeDefinition.getHintPrefListSize())));
Element keySerializer = new Element(STORE_KEY_SERIALIZER_ELMT);
addSerializer(keySerializer, storeDefinition.getKeySerializer());
Oops, something went wrong.

0 comments on commit 4f30486

Please sign in to comment.