@Override
  public Database transformDatabase(Database db, List<String> processorCapabilities, String processorId) throws MetaException {
    if ((processorCapabilities != null && processorCapabilities.contains(MANAGERAWMETADATA)) ||
        !defaultCatalog.equalsIgnoreCase(db.getCatalogName())) {
      LOG.debug("Database belongs to non-default catalog, skipping translation");
      return db;
    }

    LOG.info("Starting translation for transformDatabase for processor " + processorId + " with " + processorCapabilities
        + " on database {} locationUri={} managedLocationUri={}", db.getName(), db.getLocationUri(), db.getManagedLocationUri());

    if (!isTenantBasedStorage) {
      // for legacy DBs, location could have been managed or external. So if it is pointing to managed location, set it as
      // managed location and return a new default external path for location
      Path locationPath = Path.getPathWithoutSchemeAndAuthority(new Path(db.getLocationUri()));
      Path whRootPath = Path.getPathWithoutSchemeAndAuthority(hmsHandler.getWh().getWhRoot());
      LOG.debug("Comparing DB and warehouse paths warehouse={} db.getLocationUri={}", whRootPath.toString(), locationPath.toString());
      if (FileUtils.isSubdirectory(whRootPath.toString(), locationPath.toString()) || locationPath.equals(whRootPath)) { // legacy path
        if (processorCapabilities != null && (processorCapabilities.contains(HIVEMANAGEDINSERTWRITE) ||
            processorCapabilities.contains(HIVEFULLACIDWRITE))) {
          LOG.debug("Processor has atleast one of ACID write capabilities, setting current locationUri " + db.getLocationUri() + " as managedLocationUri");
          db.setManagedLocationUri(new Path(db.getLocationUri()).toString());
        }
        Path extWhLocation = hmsHandler.getWh().getDefaultExternalDatabasePath(db.getName());
        LOG.info("Database's location is a managed location, setting to a new default path based on external warehouse path:" + extWhLocation.toString());
        db.setLocationUri(extWhLocation.toString());
      }
    }
    LOG.info("Transformer returning database:" + db.toString());
    return db;
  }
Alter location of the database depending on whether or not the processor has ACID capabilities.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDefaultTransformer.java