Skip to content

Commit 433bae3

Browse files
authored
HIVE-29648: Split ObjectStore into modular TableStore and PrivilegeStore (apache#6450)
1 parent 6ca06ca commit 433bae3

28 files changed

Lines changed: 9117 additions & 8130 deletions

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/AbstractTestAuthorizationApiAuthorizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ private void testFunction(FunctionInvoker mscFunctionInvoker) throws Exception {
8686
} catch (RuntimeException e) {
8787
// A hack to verify that authorization check passed. Exception can be thrown be cause
8888
// the functions are not being called with valid params.
89-
// verify that exception has come from ObjectStore code, which means that the
89+
// verify that exception has come from RawStore code, which means that the
9090
// authorization checks passed.
9191
String exStackString = ExceptionUtils.getStackTrace(e);
9292
assertTrue("Verifying this exception came after authorization check",
93-
exStackString.contains("org.apache.hadoop.hive.metastore.ObjectStore"));
93+
exStackString.contains("org.apache.hadoop.hive.metastore.RawStore"));
9494
// If its not an exception caused by auth check, ignore it
9595
}
9696
assertFalse("Authz Exception should have been thrown in remote mode", isRemoteMetastoreMode);

ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientAlterPartitionsTempTable.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,15 @@ private void assertPartitionRollback(List<Partition> oldParts, List<Partition> a
247247
fail("Exception should have been thrown.");
248248
}
249249

250+
@Override
251+
@Test(expected = MetaException.class)
252+
public void testRenamePartitionChangeTblName() throws Exception {
253+
super.testRenamePartitionChangeTblName();
254+
}
255+
256+
@Override
257+
@Test(expected = MetaException.class)
258+
public void testRenamePartitionChangeDbName() throws Exception {
259+
super.testRenamePartitionChangeDbName();
260+
}
250261
}

ql/src/test/queries/clientpositive/partitions_filter_default.q

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
--! qt:disabled:HIVE-25965
12

23
create table ptestfilter (a string) partitioned by (c int);
34
INSERT OVERWRITE TABLE ptestfilter PARTITION (c) select 'Col1', null;

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,6 +3253,11 @@ public Function get_function(String dbName, String funcName) throws TException {
32533253

32543254
@Override
32553255
public void update_table_params(List<TableParamsUpdate> updates) throws TException {
3256+
for (TableParamsUpdate update : updates) {
3257+
if (!update.isSetCat_name()) {
3258+
update.setCat_name(getDefaultCatalog(conf));
3259+
}
3260+
}
32563261
getMS().updateTableParams(updates);
32573262
}
32583263

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,18 @@ public Partition alterPartition(RawStore msdb, Warehouse wh, String catName, Str
639639
FileSystem destFs = null;
640640
boolean dataWasMoved = false;
641641
Database db;
642+
Partition check_part;
643+
try {
644+
check_part = msdb.getPartition(catName, dbname, name, new_part.getValues());
645+
} catch(NoSuchObjectException e) {
646+
// this means there is no existing partition
647+
check_part = null;
648+
}
649+
650+
if (check_part != null) {
651+
throw new AlreadyExistsException("Partition already exists:" + dbname + "." + name + "." +
652+
new_part.getValues());
653+
}
642654
try {
643655
msdb.openTransaction();
644656
Table tbl = msdb.getTable(catName, dbname, name, null);
@@ -655,19 +667,6 @@ public Partition alterPartition(RawStore msdb, Warehouse wh, String catName, Str
655667
"Unable to rename partition because old partition does not exist");
656668
}
657669

658-
Partition check_part;
659-
try {
660-
check_part = msdb.getPartition(catName, dbname, name, new_part.getValues());
661-
} catch(NoSuchObjectException e) {
662-
// this means there is no existing partition
663-
check_part = null;
664-
}
665-
666-
if (check_part != null) {
667-
throw new AlreadyExistsException("Partition already exists:" + dbname + "." + name + "." +
668-
new_part.getValues());
669-
}
670-
671670
// when renaming a partition, we should update
672671
// 1) partition SD Location
673672
// 2) partition column stats if there are any because of part_name field in HMS table PART_COL_STATS

0 commit comments

Comments
 (0)