[ 
https://issues.apache.org/jira/browse/HIVE-24259?focusedWorklogId=549679&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-549679
 ]

ASF GitHub Bot logged work on HIVE-24259:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Feb/21 16:20
            Start Date: 08/Feb/21 16:20
    Worklog Time Spent: 10m 
      Work Description: adesh-rao commented on a change in pull request #1610:
URL: https://github.com/apache/hive/pull/1610#discussion_r572168261



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##########
@@ -1325,6 +1204,7 @@ private void validateTableType(Table tbl) {
     }
     validateTableType(tbl);
     sharedCache.addTableToCache(catName, dbName, tblName, tbl);
+    sharedCache.addTableConstraintsToCache(catName,dbName,tblName,new 
SQLAllTableConstraints());

Review comment:
       There is a separate api for createTableWithConstraints. 
   
   Is this api also used when table is created with constraints?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##########
@@ -2814,21 +2649,12 @@ long getPartsFound() {
     catName = StringUtils.normalizeIdentifier(catName);
     dbName = StringUtils.normalizeIdentifier(dbName);
     tblName = StringUtils.normalizeIdentifier(tblName);
-    if (!shouldCacheTable(catName, dbName, tblName) || (canUseEvents && 
rawStore.isActiveTransaction())) {
+    if (!shouldCacheTable(catName, dbName, tblName) || (canUseEvents && 
rawStore.isActiveTransaction()) || !sharedCache
+        .isTableConstraintValid(catName, dbName, tblName)) {
       return rawStore.getCheckConstraints(catName, dbName, tblName);
     }
+    return sharedCache.listCachedCheckConstraint(catName, dbName, tblName);

Review comment:
       below check was present earlier:
   
   ```
   if (CollectionUtils.isEmpty(keys)) { 
         return rawStore.getCheckConstraints(catName, dbName, tblName); 
   }
   ```
   
   Why is this removed? Is this check moved somewhere else?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/SharedCache.java
##########
@@ -418,12 +424,12 @@ private void updateMemberSize(MemberName mn, Integer 
size, SizeMode mode) {
       }
 
       switch (mode) {
-        case Delta:
-          this.memberObjectsSize[mn.ordinal()] += size;
-          break;
-        case Snapshot:
-          this.memberObjectsSize[mn.ordinal()] = size;
-          break;
+      case Delta:

Review comment:
       nit: need extra spaces before case?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 549679)
    Time Spent: 2.5h  (was: 2h 20m)

> [CachedStore] Optimise get constraints call by removing redundant table check 
> ------------------------------------------------------------------------------
>
>                 Key: HIVE-24259
>                 URL: https://issues.apache.org/jira/browse/HIVE-24259
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Ashish Sharma
>            Assignee: Ashish Sharma
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> Description -
> Problem - 
> 1. Redundant check if table is present or not
> 2. Currently in order to get all constraint form the cachedstore. 6 different 
> call is made with in the cached store. Which led to 6 different call to raw 
> store
>  
> DOD
> 1. Check only once if table exit in cached store.
> 2. Instead of calling individual constraint in cached store. Add a method 
> which return all constraint at once and if data is not consistent then fall 
> back to rawstore.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to