You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "lin zhang (Jira)" <ji...@apache.org> on 2024/03/21 06:19:00 UTC
[jira] [Updated] (HIVE-28141) Is there a problem with phantom reading of RR-level records in the HMS cluster environment?
[ https://issues.apache.org/jira/browse/HIVE-28141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
lin zhang updated HIVE-28141:
-----------------------------
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;
...
```
was:
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;
...
```
> Is there a problem with phantom reading of RR-level records in the HMS cluster environment?
> -------------------------------------------------------------------------------------------
>
> Key: HIVE-28141
> URL: https://issues.apache.org/jira/browse/HIVE-28141
> Project: Hive
> Issue Type: Bug
> Components: HiveServer2
> Affects Versions: 3.1.3
> Environment: CDH 6.3.2
> Reporter: lin zhang
> Priority: Minor
>
> 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;
> ...
> ```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)