sankarh commented on a change in pull request #679: HIVE-21764 : REPL DUMP 
should detect and bootstrap any rename table events where old table was 
excluded but renamed table is included.
URL: https://github.com/apache/hive/pull/679#discussion_r296110148
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java
 ##########
 @@ -82,14 +90,49 @@ private Scenario 
scenarioType(org.apache.hadoop.hive.metastore.api.Table before,
     }
   }
 
+  // return true, if event needs to be dumped, else return false.
+  private boolean handleRenameDuringTableLevelReplication(Context 
withinContext) {
+    String oldName = before.getTableName();
+    String newName = after.getTableName();
+
+    if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, oldName)) {
+      // If old table satisfies the filter, but the new table does not, then 
the old table should be dropped.
+      if (!ReplUtils.tableIncludedInReplScope(withinContext.replScope, 
newName)) {
+        scenario = Scenario.DROP;
+        LOG.info("Table " + oldName + " will be dropped as the table is 
renamed to " + newName);
+        return true;
+      }
+
+      // If both old and new table satisfies the filter, then dump the rename 
event.
+      return true;
 
 Review comment:
   For case, out1 -> in1 -> in2, in2 should be part of bootstrap list but it 
won't as caller has removed in1 from the list and here we don't add in2 to it.

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