ashutosh-bapat commented on a change in pull request #613: HIVE-20967
URL: https://github.com/apache/hive/pull/613#discussion_r281923900
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
##########
@@ -805,22 +811,89 @@ public Partition alterPartition(RawStore msdb, Warehouse
wh, String catName, Str
return oldParts;
}
- private void checkTableTypeConversion(Database db, Table oldTbl, Table
newTbl)
+ // Validate changes to partition's location to protect against errors on
migration during
+ // replication
+ private void blockPartitionLocationChangesOnReplSource(Database db, Table
tbl,
+ EnvironmentContext ec)
+ throws InvalidOperationException {
+ // If the database is not replication source, nothing to do
+ if (!ReplChangeManager.isSourceOfReplication(db)) {
+ return;
+ }
+
+ // For now validate only the changes when strict managed tables is false.
That's when there's
+ // scope for migration during replication, at least for now.
+ if
(conf.getBoolean(MetastoreConf.ConfVars.STRICT_MANAGED_TABLES.getHiveName(),
false)) {
+ return;
+ }
+
+ // Do not allow changing location of a managed table as as alter event
doesn't capture the
+ // new files list. So, it may cause data inconsistency.
+ boolean isChangingLocation = false;
+ if (ec.isSetProperties()) {
+ String alterType = ec.getProperties().get(ALTER_TABLE_OPERATION_TYPE);
+ if (alterType != null && alterType.equalsIgnoreCase(ALTERLOCATION)) {
Review comment:
Done.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]