Aggarwal-Raghav commented on PR #6608:
URL: https://github.com/apache/hive/pull/6608#issuecomment-5020623169

   @dengzhhu653 / @deniskuzZ , to maintain the older behaviour and the fix I 
propose MSCK_PATH_VALIDATION to be used. If user  has value set to 
"ignore/skip" in beeline session, it should continue otherwise it will throw 
exception. Let me know if that's acceptable. 
   ```
   diff --git 
i/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java
 
w/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java
   index 11dc51b827..1b04fdc55a 100644
   --- 
i/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java
   +++ 
w/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreChecker.java
   @@ -460,8 +460,15 @@ void findUnknownPartitions(Table table, Set<Path> 
missingPartDirs,
          // Check if partition already exists. No need to check for those 
partition which are present in db
          // but no in fs as msck will override the partition location in db
          if (result.getCorrectPartitions().contains(pr)) {
   -        String msg = "The partition '" + pr.toString() + "' already exists 
for table" + table.getTableName();
   -        throw new MetastoreException(msg);
   +        if ("throw".equals(MetastoreConf.getVar(conf, 
MetastoreConf.ConfVars.MSCK_PATH_VALIDATION))) {
   +          throw new MetastoreException(
   +              String.format("The partition '%s' already exists for table 
%s", pr, table.getTableName()));
   +        }
   +
   +        if (LOG.isDebugEnabled()) {
   +          LOG.debug("The partition '{}' already exists in metastore for 
table {}", pr, table.getTableName());
   +        }
   +        continue;
          } else if (result.getPartitionsNotInMs().contains(pr)) {
            String msg = "Found two paths for same partition '" + pr.toString() 
+ "' for table " + table.getTableName();
            throw new MetastoreException(msg);
   
   ```


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to