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

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

                Author: ASF GitHub Bot
            Created on: 27/May/21 07:37
            Start Date: 27/May/21 07:37
    Worklog Time Spent: 10m 
      Work Description: pvary commented on a change in pull request #2323:
URL: https://github.com/apache/hive/pull/2323#discussion_r640364312



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -5269,6 +5293,32 @@ private void preDropStorageDescriptor(MStorageDescriptor 
msd) {
     removeUnusedColumnDescriptor(mcd);
   }
 
+  /**
+   * Get a list of storage descriptors that reference a particular Column 
Descriptor
+   * @param oldCD the column descriptor to get storage descriptors for
+   * @return a list of storage descriptors
+   */
+  private List<MStorageDescriptor> 
listStorageDescriptorsWithCD(MColumnDescriptor oldCD, Query query) {
+    boolean success = false;
+    List<MStorageDescriptor> sds = null;
+    try {
+      openTransaction();

Review comment:
       Transactions could be used also to prevent other queries modifying the 
data which was read by another transaction depending on the isolation level 
used (for SERIALIZABLE isolation level). [One good 
description](https://www.sqlservercentral.com/articles/isolation-levels-in-sql-server)
   
   If there are concurrent transactions that could be an issue:
   - T1 reads the data - decides that the CD is not used anymore
   - T2 inserts a new row
   - T1 drops the CD
   
   The previous version of the code read the data inside the transaction, we 
can change the behavior if we decide so, but that has to be a conscious 
decision.
   
   IMHO this is all theoretical since if I remember correctly the 
`openTransaction()` is called before this method call, so in our case the new 
`openTranscation()` call just increments a counter.




-- 
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: 602762)
    Time Spent: 1h  (was: 50m)

> Metastore: Drop partition performance downgrade with Postgres DB
> ----------------------------------------------------------------
>
>                 Key: HIVE-21075
>                 URL: https://issues.apache.org/jira/browse/HIVE-21075
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 3.0.0
>            Reporter: Yongzhi Chen
>            Assignee: Oleksiy Sayankin
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> In order to workaround oracle not supporting limit statement caused 
> performance issue, HIVE-9447 makes all the backend DB run select count(1) 
> from SDS where SDS.CD_ID=? to check if the specific CD_ID is referenced in 
> SDS table before drop a partition. This select count(1) statement does not 
> scale well in Postgres, and there is no index for CD_ID column in SDS table.
> For a SDS table with with 1.5 million rows, select count(1) has average 700ms 
> without index, while in 10-20ms with index. But the statement before 
> HIVE-9447( SELECT * FROM "SDS" "A0" WHERE "A0"."CD_ID" = $1 limit 1) uses 
> less than 10ms .



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

Reply via email to