On June 11, 2015, 10:26 p.m., Aihua Xu wrote: > > Why do you think holding a Shared lock in user current database is a > > problem? it should not stop others from acquiring Shared locks on this > > table, right? > > Or are you expecting that others might want to acquire an Exclusive lock on > > the database to change it(e.g. rename)? I am not sure and also have not > > tested that in other DBMS like mysql, when a user is under a database, that > > database is allowed to be renamed or not.
I did some search on other databases and HIVE as well. Here is some thoughts. In Hive, when you use "use db1", actually you don't hold any lock to the database or anything. It's just a shorthand for "db1.tb1" instead of "tb1". Later, when you execute "select * from tb1" and another session happens to have renamed the database, then "select * from tb1" should fail. If you execute "select * from db3.tb3", then it will lock tb3 and db3 appropriately, not on db1. If "select * from tb1", then it's the same as "select * from db1.tb1" and it will lock db1 and tb1 appropriately. So seems that we don't need to lock the current db. - Aihua ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/35323/#review87640 ----------------------------------------------------------- On June 10, 2015, 9:08 p.m., Aihua Xu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/35323/ > ----------------------------------------------------------- > > (Updated June 10, 2015, 9:08 p.m.) > > > Review request for hive. > > > Repository: hive-git > > > Description > ------- > > HIVE-10972 DummyTxnManager always locks the current database in shared mode, > which is incorrect. > > > Diffs > ----- > > ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DummyTxnManager.java ea04415 > ql/src/java/org/apache/hadoop/hive/ql/lockmgr/HiveLockObject.java e75a90a > > ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java > 4f86dd9 > ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDummyTxnManager.java > 5abb729 > > Diff: https://reviews.apache.org/r/35323/diff/ > > > Testing > ------- > > > Thanks, > > Aihua Xu > >