This is an automated email from the ASF dual-hosted git repository. mhubail pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push: new 07da3b9 [NO ISSUE][MTD] Restrict Metadata Catalog Update to Synonym Dataset 07da3b9 is described below commit 07da3b9c84e3d7853535e1ce270eb73acf1d694c Author: Murtadha Hubail <mhub...@apache.org> AuthorDate: Sun Apr 5 20:14:32 2020 +0300 [NO ISSUE][MTD] Restrict Metadata Catalog Update to Synonym Dataset - Only allow Metadata.Synonym datasets to be added to an existing cluster. This is done to detect the case when another metadata dataset that is expected to be there but is not found. Change-Id: I142d2537816cc302ef9e02e7faf18af03cb72350 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/5604 Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Murtadha Hubail <mhub...@apache.org> Reviewed-by: Dmitry Lychagin <dmitry.lycha...@couchbase.com> --- .../org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java index c3926a4..69fc396 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java @@ -361,6 +361,9 @@ public class MetadataBootstrap { } else { resource = localResourceRepository.get(file.getRelativePath()); createMetadataDataset = resource == null; + if (createMetadataDataset) { + ensureCatalogUpgradability(index); + } } if (createMetadataDataset) { final double bloomFilterFalsePositiveRate = @@ -489,4 +492,10 @@ public class MetadataBootstrap { MetadataBootstrap.isNewUniverse = isNewUniverse; } + private static void ensureCatalogUpgradability(IMetadataIndex index) { + if (index != MetadataPrimaryIndexes.SYNONYM_DATASET) { + throw new IllegalStateException( + "attempt to create metadata index " + index.getIndexName() + ". Index should already exist"); + } + } }