@Override
  public List<Task<?>> handle(Context context)
      throws SemanticException {
    AlterDatabaseMessage msg = deserializer.getAlterDatabaseMessage(context.dmd.getPayload());
    String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName;

    try {
      Database oldDb = msg.getDbObjBefore();
      Database newDb = msg.getDbObjAfter();
      AbstractAlterDatabaseDesc alterDbDesc;

      if ((oldDb.getOwnerType() == newDb.getOwnerType())
            && oldDb.getOwnerName().equalsIgnoreCase(newDb.getOwnerName())) {
        // If owner information is unchanged, then DB properties would've changed
        Map<String, String> newDbProps = new HashMap<>();
        Map<String, String> dbProps = newDb.getParameters();

        for (Map.Entry<String, String> entry : dbProps.entrySet()) {
          newDbProps.put(entry.getKey(), entry.getValue());
        }
        alterDbDesc = new AlterDatabaseSetPropertiesDesc(actualDbName, newDbProps, context.eventOnlyReplicationSpec());
      } else {
        alterDbDesc = new AlterDatabaseSetOwnerDesc(actualDbName, new PrincipalDesc(newDb.getOwnerName(),
            newDb.getOwnerType()), context.eventOnlyReplicationSpec());
      }

      Task<DDLWork> alterDbTask = TaskFactory.get(new DDLWork(readEntitySet, writeEntitySet,
                       alterDbDesc, true, context.getDumpDirectory(), context.getMetricCollector()), context.hiveConf);
      context.log.debug("Added alter database task : {}:{}",
              alterDbTask.getId(), actualDbName);

      // Only database object is updated
      updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName,
              null, null);
      return Collections.singletonList(alterDbTask);
    } catch (Exception e) {
      throw (e instanceof SemanticException)
          ? (SemanticException) e
          : new SemanticException("Error reading message members", e);
    }
  }
AlterDatabaseHandler.
Handler at target warehouse for the EVENT_ALTER_DATABASE type of messages
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/AlterDatabaseHandler.java