apache / apache/paimon

[Bug] branch external file can not be delete when drop table

Open
#5,870 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
3.4k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
396

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.

### Paimon version

paimon master branch, commit id: 9ec10007bc33e9849dcdaa42b724d5d05bd7bcc3

### Compute Engine

flink 1.17

### Minimal reproduce step

1. set branch table external data-file.external-paths: "/tmp/a"
2. write data
3. set external data-file.external-paths: "/tmp/b"
4. write data
5. delete table

### What doesn't meet your expectations?

`public void dropTable(Identifier identifier, boolean ignoreIfNotExists)
throws TableNotExistException {
checkNotBranch(identifier, "dropTable");
checkNotSystemTable(identifier, "dropTable");

List externalPaths = new ArrayList<>();
try {
Table table = getTable(identifier);
if (table instanceof FileStoreTable) {
FileStoreTable fileStoreTable = (FileStoreTable) table;
externalPaths =
fileStoreTable.schemaManager().listAll().stream()
.map(
schema ->
schema.toSchema()
.options()
.get(DATA_FILE_EXTERNAL_PATHS.key()))
.filter(Objects::nonNull)
.flatMap(externalPath -> Arrays.stream(externalPath.split(",")))
.map(Path::new)
.distinct()
.collect(Collectors.toList());
}
} catch (TableNotExistException e) {
if (ignoreIfNotExists) {
return;
}
throw new TableNotExistException(identifier);
}

dropTableImpl(identifier, externalPaths);
}`
branch table external path may be not delete

### Anything else?

delete branch file

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the dropTable(Identifier, boolean) entry point and inspect how branch table schemas expose external data-file.external-paths before dropTableImpl runs. Reproduce the two external paths, then verify that dropping the branch table deletes files from both /tmp/a and /tmp/b; add or update coverage in the relevant table-drop tests if the repository contains them.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.