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

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

                Author: ASF GitHub Bot
            Created on: 18/Feb/21 10:52
            Start Date: 18/Feb/21 10:52
    Worklog Time Spent: 10m 
      Work Description: sankarh commented on a change in pull request #1610:
URL: https://github.com/apache/hive/pull/1610#discussion_r578260034



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##########
@@ -2674,28 +2554,19 @@ 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

Review comment:
       This check is done in several places. Shall add utility method for this.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/events/CreateTableEvent.java
##########
@@ -29,11 +30,14 @@
 
   private final Table table;
   private final boolean isReplicated;
+  private final SQLAllTableConstraints constraints;
 
-  public CreateTableEvent(Table table, boolean status, IHMSHandler handler, 
boolean isReplicated) {
+  public CreateTableEvent(Table table, boolean status, IHMSHandler handler, 
boolean isReplicated,
+      SQLAllTableConstraints constraints) {

Review comment:
       We have separate events for add individual constraints. I think, we need 
not keep it as part of create table event. 
   It adds additional overhead when transmit events for incremental 
replication. Also, takes additional storage in HMS.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/SharedCache.java
##########
@@ -2187,8 +2160,10 @@ public void addPrimaryKeysToCache(String catName, String 
dbName, String tblName,
       cacheLock.readLock().lock();
       String tblKey = CacheUtils.buildTableKey(catName, dbName, tblName);
       TableWrapper tblWrapper = tableCache.getIfPresent(tblKey);
-      if (tblWrapper != null) {
-        tblWrapper.cachePrimaryKeys(keys, false);
+      if ((tblWrapper != null) && tblWrapper.isConstraintsValid()) {
+        // Because lake of snapshot freshness validation.
+        // For now disabling cached constraint snapshot addition in parts by 
invalidating constraint snapshot.
+        tblWrapper.inValidateConstraints();

Review comment:
       invalidate is single word in this context.Change method name to 
invalidateConstraintsCache.




----------------------------------------------------------------
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: 554174)
    Time Spent: 4h 40m  (was: 4.5h)

> [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: 4h 40m
>  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