oleksiy-sayankin commented on a change in pull request #2323:
URL: https://github.com/apache/hive/pull/2323#discussion_r640351626
##########
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:
In my understanding transactions are usually used when one has CREATE,
UPDATE or DELETE statements and one wants to have the atomic behavior, that is,
either commit everything or commit nothing. Consider all queries we have here
1. Query for postgres
SELECT * FROM "SDS" "A0" WHERE "A0"."CD_ID" = $1 limit 1)
2. Query for all DBs except postgres
select count(1) from
org.apache.hadoop.hive.metastore.model.MStorageDescriptor where (this.cd ==
inCD)
3. Constraint deletion
pm.deletePersistentAll(mConstraintsList);
4. CD deletion
pm.deletePersistent(oldCD);
IMHO we need transaction only for items 3 and 4 and it should look this way:
1. SELECT * FROM "SDS" "A0" WHERE "A0"."CD_ID" = $1 limit 1)
2. select count(1) from
org.apache.hadoop.hive.metastore.model.MStorageDescriptor where (this.cd ==
inCD)
openTransaction()
3. pm.deletePersistentAll(mConstraintsList);
4. pm.deletePersistent(oldCD);
commitTransaction()
whilst the old implementation was
openTransaction()
1. select count(1) from
org.apache.hadoop.hive.metastore.model.MStorageDescriptor where (this.cd ==
inCD)
2. pm.deletePersistentAll(mConstraintsList);
3. pm.deletePersistent(oldCD);
commitTransaction()
which seems to me redundant. Make sense?
--
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]