justinmclean opened a new issue, #10168:
URL: https://github.com/apache/gravitino/issues/10168
### What would you like to be improved?
JobManager.fetchFileFromUri currently reports success for file: URIs by
creating a symlink in the staging directory, even when the source path does not
exist. This creates a dangling symlink and returns a seemingly valid staged
path, causing failures later when the file is consumed instead of failing at
fetch time.
### How should we improve?
For the file: branch, validate the source path before creating the symlink
(at minimum, check it exists; optionally verify it is a regular file). If
validation fails, throw an exception immediately with a clear message. This
ensures fetch behavior is accurate and prevents runtime failures caused by
invalid staged artifacts.
Here's a unit test to help:
```
@Test
public void testFetchFileFromUriWithMissingLocalFileShouldFail() throws
IOException {
File stagingDir = new File(testStagingDir);
Assertions.assertTrue(stagingDir.mkdirs() || stagingDir.exists());
Path missingFilePath =
Path.of(System.getProperty("java.io.tmpdir"), "missing-job-file-" +
UUID.randomUUID());
String uri = missingFilePath.toUri().toString();
Assertions.assertThrows(
RuntimeException.class, () -> JobManager.fetchFileFromUri(uri,
stagingDir, 1000));
}
```
--
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]