pvary commented on a change in pull request #2323:
URL: https://github.com/apache/hive/pull/2323#discussion_r640453187



##########
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:
       We the  goal is with `openTransaction()` and the `commitTransaction()` 
to allow embedding method calls and keeping / enforcing transactions around 
them.
   
   So if `listStorageDescriptorsWithCD()` is never called from 
non-transactional methods then adding `openTransaction()` and 
`commitTransaction()` is redundant. We wrap the calls into transactions if want 
to make sure to run the code in a transaction whenever it is called.
   
   Wrapping a read only query in a transaction does not really make sense. It 
is either good without a transaction, or it requires a transaction because of 
the wider context, and then it is the callers responsibility to handle the 
transaction open/close. **So you are right, we do not need the transaction for 
the select itself.**




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to