apache / apache/uniffle

[Bug] A more elegant way to delete files is needed

Open
#1,769 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
454
Forks
172
Avg merge
5d 17h
Merged PRs (30d)
5

Description

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

### Search before asking

- [X] I have searched in the [issues](https://github.com/apache/incubator-uniffle/issues?q=is%3Aissue) and found no similar issues.

### Describe the bug

We need a more elegant way to delete files, rather than deleting them from the local disk first and then from the hdfs every time.

### Affects Version(s)

master

### Uniffle Server Log Output

```logtalk
[2024-06-07 21:33:45.064] [checkResource-0] [WARN] ShuffleTaskManager.preAllocatedBufferCheck - Remove expired preAllocatedBuffer[id=8311808] that required by app: application_1703049085550_12962744_1717766212505
[2024-06-07 21:33:45.064] [expiredAppCleaner-0] [INFO] ShuffleTaskManager.checkResourceStatus - Detect expired appId[application_1703049085550_12962744_1717766212505] according to rss.server.app.expired.withoutHeartbeat
[2024-06-07 21:33:45.065] [clearResourceThread] [INFO] ShuffleTaskManager.removeResources - Start remove resource for appId[application_1703049085550_12962744_1717766212505]
[2024-06-07 21:33:45.268] [clearResourceThread] [INFO] HybridStorageManager.removeResources - Start to remove resource of AppPurgeEvent{appId='application_1703049085550_12962744_1717766212505', user='aaa', shuffleIds=[0]}
[2024-06-07 21:33:45.269] [clearResourceThread] [INFO] LocalStorageManager.cleanupStorageSelectionCache - Cleaning the storage selection cache costs: 1(ms) for event: AppPurgeEvent{appId='application_1703049085550_12962744_1717766212505', user='aaa', shuffleIds=[0]}
[2024-06-07 21:33:45.269] [clearResourceThread] [INFO] LocalStorage.removeResources - Start to remove resource of application_1703049085550_12962744_1717766212505/0
[2024-06-07 21:33:45.269] [clearResourceThread] [INFO] LocalStorage.removeResources - Finish remove resource of application_1703049085550_12962744_1717766212505/0, disk size is 0 and 0 shuffle metadata
[2024-06-07 21:33:54.505] [clearResourceThread] [INFO] LocalFileDeleteHandler.delete - Delete shuffle data for appId[application_1703049085550_12962744_1717766212505] with /data1/rssdata/application_1703049085550_12962744_1717766212505 cost 9236 ms
[2024-06-07 21:33:54.505] [clearResourceThread] [INFO] HadoopShuffleDeleteHandler.delete - Try delete shuffle data in Hadoop FS for appId[application_1703049085550_12962744_1717766212505] of user[aaa] with hdfs://xxx/rss/online/application_1703049085550_12962744_1717766212505
[2024-06-07 21:33:54.600] [clearResourceThread] [WARN] HadoopShuffleDeleteHandler.delete - Can't delete shuffle data for appId[application_1703049085550_12962744_1717766212505] with 1 times
java.io.FileNotFoundException: File hdfs://xxx/rss/online/application_1703049085550_12962744_1717766212505 does not exist.
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatusInternal(DistributedFileSystem.java:993)
at org.apache.hadoop.hdfs.DistributedFileSystem.access$800(DistributedFileSystem.java:120)
at org.apache.hadoop.hdfs.DistributedFileSystem$24.doCall(DistributedFileSystem.java:1053)
at org.apache.hadoop.hdfs.DistributedFileSystem$24.doCall(DistributedFileSystem.java:1050)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatus(DistributedFileSystem.java:1060)
at org.apache.uniffle.storage.handler.impl.HadoopShuffleDeleteHandler.delete(HadoopShuffleDeleteHandler.java:101)
at org.apache.uniffle.storage.handler.impl.HadoopShuffleDeleteHandler.delete(HadoopShuffleDeleteHandler.java:61)
at org.apache.uniffle.server.storage.HadoopStorageManager.removeResources(HadoopStorageManager.java:125)
at org.apache.uniffle.server.storage.HybridStorageManager.removeResources(HybridStorageManager.java:162)
at org.apache.uniffle.server.ShuffleTaskManager.removeResources(ShuffleTaskManager.java:775)
at org.apache.uniffle.server.ShuffleTaskManager.lambda$new$0(ShuffleTaskManager.java:183)
at java.lang.Thread.run(Thread.java:750)
[2024-06-07 21:33:55.636] [clearResourceThread] [WARN] HadoopShuffleDeleteHandler.delete - Can't delete shuffle data for appId[application_1703049085550_12962744_1717766212505] with 2 times
java.io.FileNotFoundException: File hdfs://xxx/rss/online/application_1703049085550_12962744_1717766212505 does not exist.
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatusInternal(DistributedFileSystem.java:993)
at org.apache.hadoop.hdfs.DistributedFileSystem.access$800(DistributedFileSystem.java:120)
at org.apache.hadoop.hdfs.DistributedFileSystem$24.doCall(DistributedFileSystem.java:1053)
at org.apache.hadoop.hdfs.DistributedFileSystem$24.doCall(DistributedFileSystem.java:1050)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatus(DistributedFileSystem.java:1060)
at org.apache.uniffle.storage.handler.impl.HadoopShuffleDeleteHandler.delete(HadoopShuffleDeleteHandler.java:101)
at org.apache.uniffle.storage.handler.impl.HadoopShuffleDeleteHandler.delete(HadoopShuffleDeleteHandler.java:61)
at org.apache.uniffle.server.storage.HadoopStorageManager.removeResources(HadoopStorageManager.java:125)
at org.apache.uniffle.server.storage.HybridStorageManager.removeResources(HybridStorageManager.java:162)
at org.apache.uniffle.server.ShuffleTaskManager.removeResources(ShuffleTaskManager.java:775)
at org.apache.uniffle.server.ShuffleTaskManager.lambda$new$0(ShuffleTaskManager.java:183)
at java.lang.Thread.run(Thread.java:750)
[2024-06-07 21:33:56.672] [clearResourceThread] [WARN] HadoopShuffleDeleteHandler.delete - Can't delete shuffle data for appId[application_1703049085550_12962744_1717766212505] with 3 times
java.io.FileNotFoundException: File hdfs://xxx/rss/online/application_1703049085550_12962744_1717766212505 does not exist.
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatusInternal(DistributedFileSystem.java:993)
at org.apache.hadoop.hdfs.DistributedFileSystem.access$800(DistributedFileSystem.java:120)
at org.apache.hadoop.hdfs.DistributedFileSystem$24.doCall(DistributedFileSystem.java:1053)
at org.apache.hadoop.hdfs.DistributedFileSystem$24.doCall(DistributedFileSystem.java:1050)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatus(DistributedFileSystem.java:1060)
at org.apache.uniffle.storage.handler.impl.HadoopShuffleDeleteHandler.delete(HadoopShuffleDeleteHandler.java:101)
at org.apache.uniffle.storage.handler.impl.HadoopShuffleDeleteHandler.delete(HadoopShuffleDeleteHandler.java:61)
at org.apache.uniffle.server.storage.HadoopStorageManager.removeResources(HadoopStorageManager.java:125)
at org.apache.uniffle.server.storage.HybridStorageManager.removeResources(HybridStorageManager.java:162)
at org.apache.uniffle.server.ShuffleTaskManager.removeResources(ShuffleTaskManager.java:775)
at org.apache.uniffle.server.ShuffleTaskManager.lambda$new$0(ShuffleTaskManager.java:183)
at java.lang.Thread.run(Thread.java:750)
```

### Uniffle Engine Log Output

_No response_

### Uniffle Server Configurations

_No response_

### Uniffle Engine Configurations

_No response_

### Additional context

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start at HadoopShuffleDeleteHandler.delete, especially the failing call at line 101, then trace its callers in HadoopStorageManager.java, HybridStorageManager.java, and ShuffleTaskManager.java. Review the cleanup ordering and any existing storage-handler tests. Done should mean the deletion flow avoids the reported redundant local/HDFS work and handles an already-missing HDFS path without repeated failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.