Permalink
Browse files

Mixed a minor bug in RebalanceUtils + Admin Client unit test for fetc…

…hing read-only store partitions
  • Loading branch information...
1 parent ca9f374 commit 7857afaf706c9ad7ef09fe93d148c4537f47dd56 @rsumbaly rsumbaly committed with afeinberg Jan 9, 2011
@@ -18,6 +18,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import java.io.EOFException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -27,6 +28,7 @@
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -60,6 +62,8 @@
import voldemort.store.StoreDefinition;
import voldemort.store.metadata.MetadataStore;
import voldemort.store.metadata.MetadataStore.VoldemortState;
+import voldemort.store.mysql.MysqlStorageConfiguration;
+import voldemort.store.readonly.ReadOnlyStorageConfiguration;
import voldemort.store.readonly.ReadOnlyUtils;
import voldemort.store.slop.Slop;
import voldemort.store.slop.Slop.Operation;
@@ -112,6 +116,9 @@
private static final long INITIAL_DELAY = 250; // Initial delay
private final AdminClientConfig adminClientConfig;
+ public final static List<String> restoreStoreEngineBlackList = Arrays.asList(MysqlStorageConfiguration.TYPE_NAME,
+ ReadOnlyStorageConfiguration.TYPE_NAME);
+
private Cluster currentCluster;
/**
@@ -529,8 +536,15 @@ public Thread newThread(Runnable r) {
List<StoreDefinition> storeDefList = getRemoteStoreDefList(nodeId).getValue();
Cluster cluster = getRemoteCluster(nodeId).getValue();
- List<StoreDefinition> writableStores = RebalanceUtils.getWritableStores(storeDefList);
-
+ List<StoreDefinition> writableStores = Lists.newArrayList();
+ for(StoreDefinition def: storeDefList) {
+ if(def.isView() || restoreStoreEngineBlackList.contains(def.getType())) {
+ logger.info("Ignoring store " + def.getName() + " for restoring");
+ } else {
+ writableStores.add(def);
+ }
+ }
+ System.out.println(writableStores);
for(StoreDefinition def: writableStores) {
restoreStoreFromReplication(nodeId, cluster, def, executors);
}
@@ -1645,7 +1659,16 @@ public void fetchPartitionFiles(int nodeId,
outputStream.flush();
while(true) {
- int size = inputStream.readInt();
+ int size = 0;
+
+ try {
+ size = inputStream.readInt();
+ } catch(EOFException e) {
+ logger.error("Received EOF Exception while fetching files", e);
+ close(sands.getSocket());
+ return;
+ }
+
if(size == -1) {
close(sands.getSocket());
break;
@@ -37,6 +37,7 @@
import voldemort.routing.RoutingStrategyType;
import voldemort.server.VoldemortConfig;
import voldemort.store.StoreDefinition;
+import voldemort.store.mysql.MysqlStorageConfiguration;
import voldemort.versioning.Occured;
import voldemort.versioning.VectorClock;
import voldemort.versioning.Versioned;
@@ -54,8 +55,7 @@
private static Logger logger = Logger.getLogger(RebalanceUtils.class);
- public final static List<String> rebalancingStoreEngineBlackList = Arrays.asList("mysql",
- "krati");
+ public final static List<String> rebalancingStoreEngineBlackList = Arrays.asList(MysqlStorageConfiguration.TYPE_NAME);
public static boolean containsNode(Cluster cluster, int nodeId) {
try {
@@ -391,7 +391,7 @@ public static AdminClient createTempAdminClient(VoldemortConfig voldemortConfig,
List<StoreDefinition> storeNameList = new ArrayList<StoreDefinition>(storeDefList.size());
for(StoreDefinition def: storeDefList) {
- if(!def.isView() && !rebalancingStoreEngineBlackList.contains(def.getName())) {
+ if(!def.isView() && !rebalancingStoreEngineBlackList.contains(def.getType())) {
storeNameList.add(def);
} else {
logger.debug("ignoring store " + def.getName() + " for rebalancing");

0 comments on commit 7857afa

Please sign in to comment.