public void alterTableAndStatsInCache(String catName, String dbName, String tblName, long writeId,
      List<ColumnStatisticsObj> colStatsObjs, Map<String, String> newParams) {
    try {
      cacheLock.writeLock().lock();
      TableWrapper tblWrapper = tableCache.getIfPresent(CacheUtils.buildTableKey(catName, dbName, tblName));
      if (tblWrapper == null) {
        LOG.info("Table " + tblName + " is missing from cache. Cannot update table stats in cache");
        return;
      }
      Table newTable = tblWrapper.getTable();
      newTable.setWriteId(writeId);
      newTable.setParameters(newParams);
      //tblWrapper.updateTableObj(newTable, this);
      String newDbName = StringUtils.normalizeIdentifier(newTable.getDbName());
      String newTblName = StringUtils.normalizeIdentifier(newTable.getTableName());
      tblWrapper.updateTableColStats(colStatsObjs);
      tableCache.put(CacheUtils.buildTableKey(catName, newDbName, newTblName), tblWrapper);
      isTableCacheDirty.set(true);
    } finally {
      cacheLock.writeLock().unlock();
    }
  }
Replaces the old db object with the new one. This will add the new database to cache if it does
not exist.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/SharedCache.java