Skip to content
Snippets Groups Projects
Commit e904571a authored by ik1g19's avatar ik1g19
Browse files

rebalance only occurs when at least one file is stored

parent 3588d09b
No related branches found
No related tags found
No related merge requests found
...@@ -496,10 +496,16 @@ public class Controller extends Server { ...@@ -496,10 +496,16 @@ public class Controller extends Server {
private void rebalanceOperation() { private void rebalanceOperation() {
if (rebalanceInProgess) rebalanceCounter++;
else {
threadIDOutput("Started Rebalance Operation"); threadIDOutput("Started Rebalance Operation");
if (rebalanceInProgess) {
rebalanceCounter++;
threadIDOutput("Rebalance already in progress, queued for later");
}
else if (fileIndex.size() == 0) {
threadIDOutput("Rebalance cancelled, no files currently stored");
}
else {
State currentSate = currentState(); State currentSate = currentState();
List<Change> changes = rebalance(currentSate); List<Change> changes = rebalance(currentSate);
...@@ -512,9 +518,7 @@ public class Controller extends Server { ...@@ -512,9 +518,7 @@ public class Controller extends Server {
public DStoreConnection registerDStore(Socket requestingSocket, String joinRequest) { public DStoreConnection registerDStore(Socket requestingSocket, String joinRequest) {
if (fileIndex.size() > 0) {
rebalanceOperation(); rebalanceOperation();
}
Socket dSock = requestingSocket; Socket dSock = requestingSocket;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment