sankarh commented on a change in pull request #581: HIVE-21529 : Bootstrap ACID 
tables as part of incremental dump.
URL: https://github.com/apache/hive/pull/581#discussion_r270926635
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
 ##########
 @@ -193,27 +226,39 @@ private Long incrementalDump(Path dumpRoot, DumpMetaData 
dmd, Path cmRoot, Hive
     dmd.setDump(DumpType.INCREMENTAL, work.eventFrom, lastReplId, cmRoot);
     dmd.write();
 
-    // If external tables are enabled for replication and
-    // - If bootstrap is enabled, then need to combine bootstrap dump of 
external tables.
-    // - If metadata-only dump is enabled, then shall skip dumping external 
tables data locations to
-    //   _external_tables_info file. If not metadata-only, then dump the data 
locations.
-    if (conf.getBoolVar(HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES)
-        && (!conf.getBoolVar(HiveConf.ConfVars.REPL_DUMP_METADATA_ONLY)
-        || conf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_EXTERNAL_TABLES))) 
{
+    // Examine all the tables if required.
+    if (shouldExamineTablesToDump()) {
       Path dbRoot = getBootstrapDbRoot(dumpRoot, dbName, true);
+
+      // If we are bootstrapping ACID tables, stop all the concurrent 
transactions and take a
+      // snapshot to dump those tables. Record the last event id in case we 
are performing
+      // bootstrap of ACID tables.
+      String validTxnList = null;
+      long bootstrapLastReplId = 0;
+      if (conf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_ACID_TABLES)) {
+        validTxnList = getValidTxnListForReplDump(hiveDb);
+        bootstrapLastReplId = 
hiveDb.getMSC().getCurrentNotificationEventId().getEventId();
 
 Review comment:
   There is a very corner case  where this logic can be problem even for full 
bootstrap.
   Driver.java: L663
           if ((queryState.getHiveOperation() != null)
                   && 
queryState.getHiveOperation().equals(HiveOperation.REPLDUMP)) {
             setLastReplIdForDump(queryState.getConf());
           }
           openTransaction();
   Here we capture last repl ID just before opening txn from REPL DUMP 
execution thread (let's say T1)
   If a concurrent thread (let's say T2) opens a txn after getting last repl ID 
but before openTransaction() in T1. Let's say T2 writes in to the ACID table.
   In this case, REPL DUMP would wait for T2 to commit txn before dumping ACID 
table. Now, the snapshot of bootstrap dumped table includes the data written by 
Thread T2. But, those events will be part of subsequent incremental dump.
   When we apply these OpenTxn, allocateWriteId and commitTxn events, it may 
create duplicate data. 
   Need some idempotent logic in replica side to handle this. 
   Please check if my theory make sense.

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