You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "funcbro (via GitHub)" <gi...@apache.org> on 2026/05/19 15:57:21 UTC

Re: [I] Using rewrite_table_path iceberg procedure on a backup [iceberg]

funcbro commented on issue #14606:
URL: https://github.com/apache/iceberg/issues/14606#issuecomment-4489592405

   Finally found time to check if the mentioned solution is possible - no it is not.
   Example:
   
   * the original table was stored in: `/tmp/_source_bucket`
   * the backup was copied to: `/tmp/_backup_bucket`
   * the new target is: `/tmp/_target_bucket`
   
   ```
       String metadataFileLocation = "/tmp/_backup_bucket/simpleTable/metadata/xyz.metadata.json";
       HadoopFileIO fileIO = new HadoopFileIO(sparkSession.sparkContext().hadoopConfiguration());
   
       StaticTableOperations tableOps = new StaticTableOperations(metadataFileLocation, fileIO);
       Table table = new BaseTable(tableOps, "simpleTable");
       Result result = SparkActions.get()
               .rewriteTablePath(table)
               .rewriteLocationPrefix("/tmp/_source_bucket", "/tmp/_target_bucket")
               .execute();
   ```
   results in 
   ```
   java.lang.IllegalArgumentException: Path /tmp/_backup_bucket/simpleTable/metadata/xyz.metadata.json does not start with /tmp/_source_bucket/
   
   	at org.apache.iceberg.RewriteTablePathUtil.relativize(RewriteTablePathUtil.java:686)
   ```
   
   Obviously, changing the prefix might get us through the initial metadat validation check, but cannot work, because the prefix does not match the one used in the metadata and manifests:
   ```
               .rewriteLocationPrefix("/tmp/_backup_bucket", "/tmp/_target_bucket")
   ```
   results in 
   ```
   java.lang.IllegalArgumentException: Path /tmp/_source_bucket/simpleTable/metadata/snap-{uuid}.avro does not start with /tmp/_source_bucket/
   
   	at org.apache.iceberg.RewriteTablePathUtil.relativize(RewriteTablePathUtil.java:686)
   ```
   
   Any other options/ideas?


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org