[NO ISSUE][RT] Support External Datasets Rebalance

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Do not attempt to rebalance external datasets files
  on rebalance since they do not have files on local
  storage.
- Skip dropping external datasets files on rebalance
  since they have no files on local storage.

Change-Id: I71f50ade98c8b798225baf0cb34dd6e70a5e923e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7123
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
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 483987c..dff0b4a 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
@@ -19,6 +19,7 @@
 package org.apache.asterix.utils;
 
 import static org.apache.asterix.app.translator.QueryTranslator.abort;
+import static org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import static org.apache.hyracks.storage.am.common.dataflow.IndexDropOperatorDescriptor.DropOption;
 
 import java.rmi.RemoteException;
@@ -128,7 +129,9 @@
                         sourceDataset.getDatasetName(), sourceDataset.getNodeGroupName(), sourceNodes,
                         targetDataset.getNodeGroupName(), targetNcNames);
                 // Rebalances the source dataset into the target dataset.
-                rebalance(sourceDataset, targetDataset, metadataProvider, hcc, datasetRebalanceCallback);
+                if (sourceDataset.getDatasetType() != DatasetType.EXTERNAL) {
+                    rebalance(sourceDataset, targetDataset, metadataProvider, hcc, datasetRebalanceCallback);
+                }
             } else {
                 targetDataset = null;
                 // if this the last NC in the cluster, just drop the dataset
@@ -351,6 +354,9 @@
     // Drops dataset files of a given dataset.
     private static void dropDatasetFiles(Dataset dataset, MetadataProvider metadataProvider,
             IHyracksClientConnection hcc) throws Exception {
+        if (dataset.getDatasetType() == DatasetType.EXTERNAL) {
+            return;
+        }
         List<JobSpecification> jobs = new ArrayList<>();
         List<Index> indexes = metadataProvider.getDatasetIndexes(dataset.getDataverseName(), dataset.getDatasetName());
         for (Index index : indexes) {