sankarh commented on a change in pull request #688: HIVE-21886 : REPL - With 
table list - Handle rename events during replace policy
URL: https://github.com/apache/hive/pull/688#discussion_r297682711
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java
 ##########
 @@ -118,13 +144,30 @@ private boolean handleForTableLevelReplication(Context 
withinContext) {
 
       // If the old table was in the list of tables to be bootstrapped which 
is a multi rename case, the old table
       // is removed from the list of tables to be bootstrapped and new one is 
added.
-      if (oldTableIsPresent) {
+      if (oldTableInBootstrapList) {
+        withinContext.addToListOfTablesForBootstrap(newName);
+        return false;
+      }
+
+      // All the subsequent events on this table newName are going to be 
skipped as the table is going to be
+      // bootstrapped by replace handler, so the rename is also skipped.
+      if (isSetForBootstrapByReplaceHandler(withinContext, newName)) {
+        // This addition is not actually required. But is added just to be in 
safer side.
         withinContext.addToListOfTablesForBootstrap(newName);
+
+        // If the old table satisfies the new policy and is not in the list of 
tables to be bootstrapped
+        // (as per previous check based on oldTableIsPresent), then drop it.
+        if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, 
oldName)) {
+          scenario = Scenario.DROP;
+          LOG.info("Table " + oldName + " will be dropped as the table " + 
newName + " will be bootstrapped.");
+          return true;
+        }
+        LOG.info("Table " + newName + " is set to be bootstrapped by replace 
policy handler.");
         return false;
       }
 
       // If both old and new table satisfies the filter and old table is 
present at target, then dump the rename event.
-      LOG.info("both old and new table satisfies the filter");
+      LOG.info("Both old " + oldName + " and new table " + newName + " 
satisfies the filter");
 
 Review comment:
   filter is not the right term. We can say, replication scope/policy. Pls 
check other places as well.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to