Skip to content

Commit

Permalink
Fixed alter on new table when createArchive used.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstreev committed Nov 21, 2024
1 parent 1a94e81 commit 14a68ab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Writerside/topics/Release-Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ If there is something you'd like to see, add a new issue [here](https://github.c

The default behavior for Storage Migration 'strict' has changed from `true` to `false`. The intent behind the `strict` mode was to ensure `distcp` would fail when non-standard locations are used. The combination of `metastore_direct` and knowing the partition location details gives us a better chance on making these mappings work for `distcp`. When the scenario arises, we do **HIGHLY** recommend that you validate the plans created. The new default behavior will allow `distcp` to continue when non-standard locations are encountered, while throwing a warning. This will allow the migration to continue, but you should validate the results.

<warning>
You will need to reset the `strict` mode flag in you configuration yaml. It will be set to `true` if the configuration was created before this release. You will need to set it to `false` to maintain this new 'preferred' behavior.

```yaml
transfer:
storageMigration:
strict: false
```
</warning>
## 2.2.0.18.1
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>com.cloudera.utils.hadoop</groupId>
<artifactId>hms-mirror</artifactId>
<version>2.2.0.19.0</version>
<version>2.2.0.19.1</version>
<packaging>jar</packaging>

<name>hms-mirror</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,15 @@ public Boolean execute(TableMirror tableMirror) {
}
}

String addPartSql = MessageFormat.format(MirrorConf.ALTER_TABLE_ADD_PARTITION_LOCATION, let.getName(), partSpec, partLocation);
EnvironmentTable parts = null;
// If we've asked to create an archive, we need to adjust the location
// for the new table, which is the right table.
if (config.getTransfer().getStorageMigration().isCreateArchive()) {
parts = ret;
} else {
parts = let;
}
String addPartSql = MessageFormat.format(MirrorConf.ALTER_TABLE_ADD_PARTITION_LOCATION, parts.getName(), partSpec, partLocation);
String partSpecDesc = MessageFormat.format(MirrorConf.ALTER_TABLE_ADD_PARTITION_LOCATION_DESC, partSpec);
let.addSql(partSpecDesc, addPartSql);

Expand Down

0 comments on commit 14a68ab

Please sign in to comment.