ShreelekhyaG commented on a change in pull request #4251:
URL: https://github.com/apache/carbondata/pull/4251#discussion_r818615008



##########
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:
       as it's inside the sync block, no need to check again for null. removed 
the check.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to