HIVE: Exception: Partition Already Exists while ADDING a NEW Partition to an EXISTING Table
Hello all,
I am getting the below error when our application (Java) tries to execute an 'ADD partition' after 'DROP partition IF EXISTS' command in Hive:-
"""
Caused by: java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. AlreadyExistsException(message:Partition already exists: Partition(values:[xxxx, yyyy, zzzz-zz-zz, tttttttt], dbName:<db_name>, tableName:<tbl_name>
"""
Sequence of commands executed:-
Thread A: USE <db_name>
Thread B: ALTER TABLE <tbl_name> DROP IF EXISTS PARTITION(`i_id` ='xxxx', `c_id` ='yyyy', `dt` ='zzzz-zz-zz', `time` ='tttttttt') PURGE
Thread C: ALTER TABLE <tbl_name> ADD PARTITION(`i_id` ='xxxx', `c_id` ='yyyy', `dt` ='zzzz-zz-zz', `time` ='tttttttt')
Note:-
Cluster - 5 Mgr nodes (Hive deployed on 3 of them), 3 Utils and 30 DNs
There are no signs of any latency issues in ambari-server alerts/logs during the timeframe (+- 30 mins) when the above error/exception occurs.
It is an EXTERNAL hive table
This is a random occurrence (twice a week), associated with separate tables (not the same table everytime).
Would appreciate any Help to understand what might be causing this issue (Partition ALready Exists) and if I need to look into any other logs to find out the reason behind this.

