akashrn5 commented on a change in pull request #4251: URL: https://github.com/apache/carbondata/pull/4251#discussion_r818574780
########## File path: core/src/main/java/org/apache/carbondata/core/view/MVManager.java ########## @@ -181,32 +181,51 @@ public void deleteSchema(String databaseName, String viewName) throws IOExceptio */ public MVCatalog<?> getCatalog( MVCatalogFactory<?> catalogFactory, - boolean reload) throws IOException { + List<MVSchema> currSchemas) throws IOException { MVCatalog<?> catalog = this.catalog; - if (reload || catalog == null) { - synchronized (lock) { - catalog = this.catalog; - if (reload || catalog == null) { - catalog = catalogFactory.newCatalog(); - List<MVSchema> schemas = getSchemas(); - if (null == catalog) { - throw new RuntimeException("Internal Error."); + synchronized (lock) { + catalog = this.catalog; + if (catalog == null) { + catalog = catalogFactory.newCatalog(); + } + List<MVSchema> schemas = getSchemas(); + if (schemas.size() == currSchemas.size() && currSchemas.containsAll(schemas)) { + return catalog; + } + if (null == catalog) { Review comment: check for null catalog before returning catalog. Already a null check has happened right, is there any way that catalog becomes null parallely? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@carbondata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org