Source:
private int executeIncrementalLoad(DriverContext driverContext) { try { IncrementalLoadTasksBuilder builder = work.incrementalLoadTasksBuilder(); if (!builder.hasMoreWork() && !work.getPathsToCopyIterator().hasNext()) { if (work.hasBootstrapLoadTasks()) { LOG.debug("Current incremental dump have tables to be bootstrapped. Switching to bootstrap " + "mode after applying all events."); return executeBootStrapLoad(driverContext); } } List<Task<? extends Serializable>> childTasks = new ArrayList<>(); int parallelism = conf.getIntVar(HiveConf.ConfVars.EXECPARALLETHREADNUMBER); int maxTasks = conf.getIntVar(HiveConf.ConfVars.REPL_APPROX_MAX_LOAD_TASKS); int calculatedMaxNumOfTasks = 0, maxNumOfHDFSTasks = 0; if (maxTasks <= parallelism) { if (builder.hasMoreWork()) { calculatedMaxNumOfTasks = maxTasks; } else { maxNumOfHDFSTasks = maxTasks; } } else { calculatedMaxNumOfTasks = maxTasks - parallelism + 1; maxNumOfHDFSTasks = parallelism - 1; } TaskTracker trackerForReplIncremental = new TaskTracker(calculatedMaxNumOfTasks); Task<? extends Serializable> incrementalLoadTaskRoot = builder.build(driverContext, getHive(), LOG, work, trackerForReplIncremental); childTasks.add(incrementalLoadTaskRoot); TaskTracker trackerForCopy = new TaskTracker(maxNumOfHDFSTasks); childTasks .addAll(new ExternalTableCopyTaskBuilder(work, conf).tasks(trackerForCopy)); if (builder.hasMoreWork() || work.getPathsToCopyIterator().hasNext() || work.hasBootstrapLoadTasks()) { DAGTraversal.traverse(childTasks, new AddDependencyToLeaves(TaskFactory.get(work, conf))); } this.childTasks = childTasks; return 0; } catch (Exception e) { LOG.error("failed replication", e); setException(e); return 1; } }

Target:
private int executeIncrementalLoad(DriverContext driverContext) { try { IncrementalLoadTasksBuilder builder = work.incrementalLoadTasksBuilder(); if (!builder.hasMoreWork() && !work.getPathsToCopyIterator().hasNext()) { if (work.hasBootstrapLoadTasks()) { LOG.debug("Current incremental dump have tables to be bootstrapped. Switching to bootstrap " + "mode after applying all events."); return executeBootStrapLoad(driverContext); } } List<Task<? extends Serializable>> childTasks = new ArrayList<>(); int parallelism = conf.getIntVar(HiveConf.ConfVars.EXECPARALLETHREADNUMBER); int maxTasks = conf.getIntVar(HiveConf.ConfVars.REPL_APPROX_MAX_LOAD_TASKS); int calculatedMaxNumOfTasks = 0, maxNumOfHDFSTasks = 0; if (maxTasks <= parallelism) { if (builder.hasMoreWork()) { calculatedMaxNumOfTasks = maxTasks; } else { maxNumOfHDFSTasks = maxTasks; } } else { calculatedMaxNumOfTasks = maxTasks - parallelism + 1; maxNumOfHDFSTasks = parallelism - 1; } TaskTracker trackerForReplIncremental = new TaskTracker(calculatedMaxNumOfTasks); Task<? extends Serializable> incrementalLoadTaskRoot = builder.build(driverContext, getHive(), LOG, trackerForReplIncremental); childTasks.add(incrementalLoadTaskRoot); TaskTracker trackerForCopy = new TaskTracker(maxNumOfHDFSTasks); childTasks.addAll(new ExternalTableCopyTaskBuilder(work, conf).tasks(trackerForCopy)); if (builder.hasMoreWork() || work.getPathsToCopyIterator().hasNext() || work.hasBootstrapLoadTasks()) { DAGTraversal.traverse(childTasks, new AddDependencyToLeaves(TaskFactory.get(work, conf))); } this.childTasks = childTasks; return 0; } catch (Exception e) { LOG.error("failed replication", e); setException(e); return 1; } }