maheshk114 commented on a change in pull request #541: HIVE-21197 : Hive 
Replication can add duplicate data during migration to a target with 
hive.strict.managed.tables enabled
URL: https://github.com/apache/hive/pull/541#discussion_r259622210
 
 

 ##########
 File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactor.java
 ##########
 @@ -1536,6 +1536,62 @@ public void testCompactionInfoHashCode() {
     Assert.assertEquals("The hash codes must be equal", 
compactionInfo.hashCode(), compactionInfo1.hashCode());
   }
 
+  @Test
+  public void testDisableCompactionDuringReplLoad() throws Exception {
+    String tblName = "discomp";
+    String database = "discomp_db";
+    executeStatementOnDriver("drop database if exists " + database + " 
cascade", driver);
+    executeStatementOnDriver("create database " + database, driver);
+    executeStatementOnDriver("CREATE TABLE " + database + "." + tblName + "(a 
INT, b STRING) " +
+            " PARTITIONED BY(ds string)" +
+            " CLUSTERED BY(a) INTO 2 BUCKETS" + //currently ACID requires 
table to be bucketed
+            " STORED AS ORC TBLPROPERTIES ('transactional'='true')", driver);
+    executeStatementOnDriver("insert into " + database + "." + tblName + " 
partition (ds) values (1, 'fred', " +
+            "'today'), (2, 'wilma', 'yesterday')", driver);
+
+    executeStatementOnDriver("ALTER TABLE " + database + "." + tblName +
+            " SET TBLPROPERTIES ( 'hive.repl.first.inc.pending' = 'true')", 
driver);
+    List<ShowCompactResponseElement> compacts = getCompactionList();
+    Assert.assertEquals(0, compacts.size());
+
+    executeStatementOnDriver("alter database " + database +
+            " set dbproperties ('hive.repl.first.inc.pending' = 'true')", 
driver);
+    executeStatementOnDriver("ALTER TABLE " + database + "." + tblName +
+            " SET TBLPROPERTIES ( 'hive.repl.first.inc.pending' = 'false')", 
driver);
+    compacts = getCompactionList();
+    Assert.assertEquals(0, compacts.size());
+
+    executeStatementOnDriver("alter database " + database +
+            " set dbproperties ('hive.repl.first.inc.pending' = 'false')", 
driver);
+    executeStatementOnDriver("ALTER TABLE " + database + "." + tblName +
 
 Review comment:
   table level is taken care of now

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to