Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-28141

Is there a problem with phantom reading of RR-level records in the HMS cluster environment?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.1.3
    • None
    • HiveServer2
    • None
    • CDH 6.3.2

    Description

      This is a Q&A about HMS. The questions are as follows:

       

      Hive 3.0 introduces a metastore based on CachedStore. Is there a problem with phantom reading of RR-level records in the HMS cluster environment?

       

      According to the description on the official website, our CachedStore is synchronized once every minute by default. In a cluster of multiple HMSs, if the table partition is modified concurrently, the cache will be inconsistent (I saw that ValidWriteIdList will also have short-term inconsistencies). Will there be an ABA problem for the rows in the table? ? It can be seen that the transaction in the code is at RR level, but the corresponding read operation does not include a `for update` statement.

       

      For example, the function that modifies partitions, org.apache.hadoop.hive.metastore.RawStore#alterPartitions, will start a transaction, generate a directSql query partition (Mysql Locking Read is not used), and then modify mysql and mark the cache dirty. Suppose I have If transactions are written concurrently, will the metadata be messed up?

       

      ```
      private List<Long> getPartitionIdsViaSqlFilter(
      String catName, String dbName, String tblName, String sqlFilter,
      List<? extends Object> paramsForFilter, List<String> joinsForFilter, Integer max)
      throws MetaException {
      ...
      String queryText =
      "select " + PARTITIONS + ".\"PART_ID\" from " + PARTITIONS + ""
      + " inner join " + TBLS + " on " + PARTITIONS + ".\"TBL_ID\" = " + TBLS + ".\"TBL_ID\" "
      + " and " + TBLS + ".\"TBL_NAME\" = ? "
      + " inner join " + DBS + " on " + TBLS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\" "
      + " and " + DBS + ".\"NAME\" = ? "
      + join(joinsForFilter, ' ')
      + " where " + DBS + ".\"CTLG_NAME\" = ? "
      + (StringUtils.isBlank(sqlFilter) ? "" : (" and " + sqlFilter)) + orderForFilter;
      ...
      ```

      Attachments

        Activity

          People

            Unassigned Unassigned
            hellozepp lin zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: