[NO ISSUE][STO] Fix Metadata Datasets Check

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

Details:
- Correct metadata datasets checks by including
  only datasets with ids >= 0.

Change-Id: Ie9cd10376194ee242fd3bdf9e72f364bc3782225
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2431
Reviewed-by: Michael Blow <mblow@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/MetadataIndexImmutableProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/MetadataIndexImmutableProperties.java
index 2d6bb17..2876e11 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/MetadataIndexImmutableProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/MetadataIndexImmutableProperties.java
@@ -52,6 +52,6 @@
     }
 
     public static boolean isMetadataDataset(int datasetId) {
-        return datasetId < FIRST_AVAILABLE_USER_DATASET_ID;
+        return datasetId >= 0 && datasetId < FIRST_AVAILABLE_USER_DATASET_ID;
     }
 }
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java
index 5733a60..2b97fe7 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java
@@ -24,6 +24,6 @@
 
     @Override
     public boolean isMatch(int datasetId) {
-        return datasetId < MetadataIndexImmutableProperties.FIRST_AVAILABLE_USER_DATASET_ID && datasetId >= 0;
+        return MetadataIndexImmutableProperties.isMetadataDataset(datasetId);
     }
 }