|
23 | 23 | import java.util.concurrent.atomic.AtomicReference; |
24 | 24 | import java.util.function.Function; |
25 | 25 | import java.util.function.Predicate; |
| 26 | +import org.apache.iceberg.BaseMetastoreOperations.CommitStatus; |
26 | 27 | import org.apache.iceberg.encryption.EncryptionManager; |
27 | 28 | import org.apache.iceberg.exceptions.AlreadyExistsException; |
28 | 29 | import org.apache.iceberg.exceptions.CommitFailedException; |
@@ -294,20 +295,39 @@ public long newSnapshotId() { |
294 | 295 | * were attempting to set. This is used as a last resort when we are dealing with exceptions that |
295 | 296 | * may indicate the commit has failed but are not proof that this is the case. Past locations must |
296 | 297 | * also be searched on the chance that a second committer was able to successfully commit on top |
297 | | - * of our commit. |
| 298 | + * of our commit. When the {@code newMetadataLocation} is not found, the method returns {@link |
| 299 | + * CommitStatus#UNKNOWN}. |
298 | 300 | * |
299 | 301 | * @param newMetadataLocation the path of the new commit file |
300 | 302 | * @param config metadata to use for configuration |
301 | | - * @return Commit Status of Success, Failure or Unknown |
| 303 | + * @return Commit Status of Success, Unknown |
302 | 304 | */ |
303 | 305 | protected CommitStatus checkCommitStatus(String newMetadataLocation, TableMetadata config) { |
304 | | - return CommitStatus.valueOf( |
305 | | - checkCommitStatus( |
306 | | - tableName(), |
307 | | - newMetadataLocation, |
308 | | - config.properties(), |
309 | | - () -> checkCurrentMetadataLocation(newMetadataLocation)) |
310 | | - .name()); |
| 306 | + return checkCommitStatus( |
| 307 | + tableName(), |
| 308 | + newMetadataLocation, |
| 309 | + config.properties(), |
| 310 | + () -> checkCurrentMetadataLocation(newMetadataLocation)); |
| 311 | + } |
| 312 | + |
| 313 | + /** |
| 314 | + * Attempt to load the table and see if any current or past metadata location matches the one we |
| 315 | + * were attempting to set. This is used as a last resort when we are dealing with exceptions that |
| 316 | + * may indicate the commit has failed but are not proof that this is the case. Past locations must |
| 317 | + * also be searched on the chance that a second committer was able to successfully commit on top |
| 318 | + * of our commit. When the {@code newMetadataLocation} is not found, the method returns {@link |
| 319 | + * CommitStatus#FAILURE}. |
| 320 | + * |
| 321 | + * @param newMetadataLocation the path of the new commit file |
| 322 | + * @param config metadata to use for configuration |
| 323 | + * @return Commit Status of Success, Failure or Unknown |
| 324 | + */ |
| 325 | + protected CommitStatus checkCommitStatusStrict(String newMetadataLocation, TableMetadata config) { |
| 326 | + return checkCommitStatusStrict( |
| 327 | + tableName(), |
| 328 | + newMetadataLocation, |
| 329 | + config.properties(), |
| 330 | + () -> checkCurrentMetadataLocation(newMetadataLocation)); |
311 | 331 | } |
312 | 332 |
|
313 | 333 | /** |
|
0 commit comments