[
https://issues.apache.org/jira/browse/HIVE-26036?focusedWorklogId=741000&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-741000
]
ASF GitHub Bot logged work on HIVE-26036:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 14/Mar/22 16:20
Start Date: 14/Mar/22 16:20
Worklog Time Spent: 10m
Work Description: wecharyu opened a new pull request #3104:
URL: https://github.com/apache/hive/pull/3104
### What changes were proposed in this pull request?
Some api in ObjectStore invoke `getMTable()` but not check that if the
returned value is null, which may cause the NPE, like `addPartitions()`,
`addPartition()`, `alterPartition()` et.
Such api described above will check that whether the table exists in
`HMSHandler` (first check), but if the table is dropped by other threads after
the first check, the NPE will happen.
**The simple idea is that we can check the table each time we get from
`getMTable()`.**
### Why are the changes needed?
To fix the NPE from `getMTable()` while others dropping this table.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Just add one test in `TestObjectStore`, can use the minimal test command:
```
mvn test
-Dtest=org.apache.hadoop.hive.metastore.TestObjectStore#testPartitionOps -pl
:hive-standalone-metastore-server
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 741000)
Remaining Estimate: 0h
Time Spent: 10m
> NPE caused by getMTable() in ObjectStore
> ----------------------------------------
>
> Key: HIVE-26036
> URL: https://issues.apache.org/jira/browse/HIVE-26036
> Project: Hive
> Issue Type: Bug
> Components: Hive
> Affects Versions: 3.1.2, 4.0.0
> Reporter: Yu Weiqiang
> Assignee: Yu Weiqiang
> Priority: Minor
> Attachments: NPE_From_getMTable.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> *Issue*
> Some api in ObjectStore invoke getMTable() but not check that if the returned
> value is null, which caused the NPE, like addPartitions(), addPartition(),
> alterPartition() et.
> *Reason*
> Such api described above will check that whether the table exists in
> HMSHandler (first check), but if the table is dropped by other threads after
> the first check, the NPE will happen.
> The simple idea is that we can check the table each time we get from
> getMTable().
> *Stack example*
> !NPE_From_getMTable.png!
--
This message was sent by Atlassian Jira
(v8.20.1#820001)