Merge commit 'd71cb24eb7040875eaf9b70cc5311e87b24f149d' from release-0.9.4-pre-rc

Change-Id: I94cf63ce0207222a22585d2db6b4fe3b104027b5
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
index 7bb917f..702b6b4 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
@@ -124,6 +124,9 @@
                 // The target dataset for rebalance.
                 targetDataset = sourceDataset.getTargetDatasetForRebalance(nodeGroupName);
 
+                LOGGER.info("Rebalancing dataset {} from node group {} with nodes {} to node group {} with nodes {}",
+                        sourceDataset.getDatasetName(), sourceDataset.getNodeGroupName(), sourceNodes,
+                        targetDataset.getNodeGroupName(), targetNcNames);
                 // Rebalances the source dataset into the target dataset.
                 rebalance(sourceDataset, targetDataset, metadataProvider, hcc, datasetRebalanceCallback);
             } else {
@@ -158,6 +161,7 @@
             // the source dataset.
             runMetadataTransaction(metadataProvider, () -> dropSourceDataset(sourceDataset, metadataProvider, hcc));
         });
+        LOGGER.info("Dataset {} rebalance completed successfully", datasetName);
     }
 
     @FunctionalInterface
@@ -238,6 +242,8 @@
                 (ActiveNotificationHandler) appCtx.getActiveNotificationHandler();
         IMetadataLockManager lockManager = appCtx.getMetadataLockManager();
         lockManager.upgradeDatasetLockToWrite(metadataProvider.getLocks(), DatasetUtil.getFullyQualifiedName(source));
+        LOGGER.info("Updating dataset {} node group from {} to {}", source.getDatasetName(), source.getNodeGroupName(),
+                target.getNodeGroupName());
         try {
             // Updates the dataset entry in the metadata storage
             MetadataManager.INSTANCE.updateDataset(mdTxnCtx, target);
@@ -248,6 +254,7 @@
                 }
             }
             MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+            LOGGER.info("dataset {} node group updated to {}", target.getDatasetName(), target.getNodeGroupName());
         } finally {
             lockManager.downgradeDatasetLockToExclusiveModify(metadataProvider.getLocks(),
                     DatasetUtil.getFullyQualifiedName(target));
diff --git a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java
index 5033b55..a67b507 100644
--- a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java
+++ b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/RSSRecordReaderTest.java
@@ -18,14 +18,15 @@
  */
 package org.apache.asterix.external.input.record.reader;
 
-import com.rometools.rome.feed.synd.SyndEntry;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
 import org.apache.asterix.external.api.IRawRecord;
 import org.apache.asterix.external.input.record.reader.rss.RSSRecordReader;
 import org.junit.Assert;
 import org.junit.Test;
 
-import java.io.IOException;
-import java.net.MalformedURLException;
+import com.rometools.rome.feed.synd.SyndEntry;
 
 public class RSSRecordReaderTest {
     @Test
@@ -44,7 +45,6 @@
 
     private static final int NO_RECORDS = 10;
 
-    @Test
     public void fetchFromLoremWebsite() throws MalformedURLException {
         String dummyRssFeedURL = "http://lorem-rss.herokuapp.com/feed";
         RSSRecordReader rssRecordReader = new RSSRecordReader(dummyRssFeedURL);
@@ -59,7 +59,7 @@
         } catch (Exception e) {
             expectedException = e;
         }
-        Assert.assertEquals(cnt, NO_RECORDS);
+        Assert.assertEquals(NO_RECORDS, cnt);
         Assert.assertNull(expectedException);
     }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
index 7182204..73d6705 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
@@ -280,6 +280,7 @@
                 clusterActiveLocations.add(p.getActiveNodeId());
             }
         }
+        clusterActiveLocations.removeAll(pendingRemoval);
         clusterPartitionConstraint =
                 new AlgebricksAbsolutePartitionConstraint(clusterActiveLocations.toArray(new String[] {}));
     }