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

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java
 ##########
 @@ -120,18 +121,18 @@ private boolean handleForTableLevelReplication(Context 
withinContext, String tbl
   }
 
   // Return true, if event needs to be dumped, else return false.
-  private boolean handleForTableLevelReplicationForRename(Context 
withinContext, String oldName, String newName) {
+  private boolean renameHandlerForTableLevelReplication(Context withinContext, 
String oldName, String newName) {
     // If the table is renamed after being added to the list of tables to be 
bootstrapped, then remove it from the
     // list of tables to be bootstrapped.
-    boolean oldTableIsPresent = 
withinContext.removeFromListOfTablesForBootstrap(oldName);
+    boolean oldTableInBootstrapList = 
withinContext.removeFromListOfTablesForBootstrap(oldName);
 
     ReplScope oldPolicy = withinContext.oldReplScope == null ? 
withinContext.replScope : withinContext.oldReplScope;
     if (ReplUtils.tableIncludedInReplScope(oldPolicy, oldName)) {
       // If old table satisfies the filter, but the new table does not, then 
the old table should be dropped.
       // This should be done, only if the old table is not in the list of 
tables to be bootstrapped which is a multi
       // rename case. In case of multi rename, only the first rename should do 
the drop.
       if (!ReplUtils.tableIncludedInReplScope(withinContext.replScope, 
newName)) {
-        if (oldTableIsPresent) {
+        if (oldTableInBootstrapList) {
           // If the old table was present in the list of tables to be 
bootstrapped, then just ignore the event.
           return false;
         } else {
 
 Review comment:
   there is no issue if C doesn't match new policy. As drop is idempotent. But 
the real issue is when C match new policy. The rename event will get dumped and 
that will cause data loss as B is not present at target. I have modified the 
code to avoid all these complexity. Now if old table does not satisfy the old 
policy then dump drop event(although that is also not required). If new policy 
matches new name then add it to the bootstrap. So now for rename with replace 
policy its always bootstrap. Thats will make the code simple and as replace and 
rename are not very frequently executed operations, it should be fine.

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