private Database getSourceDbMetadata() throws IOException, SemanticException {
    Path dbMetadata = new Path(work.dumpDirectory, EximUtil.METADATA_PATH_NAME);
    BootstrapEventsIterator itr = new BootstrapEventsIterator(dbMetadata.toString(), work.dbNameToLoadIn,
            true, conf, work.getMetricCollector());
    if (!itr.hasNext()) {
      throw new SemanticException("Unable to find source db metadata in " + dbMetadata.toString());
    }
    BootstrapEvent next = itr.next();
    if (!next.eventType().equals(BootstrapEvent.EventType.Database)) {
      throw new SemanticException("Invalid eventType: " + next.eventType() + " encountered while fetching " +
              "source db metadata from " + dbMetadata.toString());
    }
    return ((DatabaseEvent) next).dbInMetadata(work.dbNameToLoadIn);
  }
There was a database update done before and we want to make sure we update the last repl
id on this database as we are now going to switch to processing a new database.
This has to be last task in the graph since if there are intermediate tasks and the last.repl.id
is a root level task then in the execution phase the root level tasks will get executed first,
however if any of the child tasks of the bootstrap load failed then even though the bootstrap has failed
the last repl status of the target database will return a valid value, which will not represent
the state of the database.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplLoadTask.java