Skip to content

Commit 451d2c2

Browse files
committed
ice-rest-catalog/etcd: Fix delete-table failing when table metadata files are missing/corrupted
1 parent bc1ae82 commit 451d2c2

File tree

1 file changed

+11
-0
lines changed
  • ice-rest-catalog/src/main/java/com/altinity/ice/rest/catalog/internal/etcd

1 file changed

+11
-0
lines changed

ice-rest-catalog/src/main/java/com/altinity/ice/rest/catalog/internal/etcd/EtcdCatalog.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,17 @@ public List<TableIdentifier> listTables(Namespace namespace) {
354354
.toList();
355355
}
356356

357+
/**
358+
* {@link org.apache.iceberg.catalog.Catalog#tableExists(TableIdentifier)} override that doesn't
359+
* throw when table metadata files are missing/corrupted, allowing {@link
360+
* #dropTable(TableIdentifier, boolean)} to succeed.
361+
*/
362+
@Override
363+
public boolean tableExists(TableIdentifier identifier) {
364+
ByteSequence key = byteSeq(tableKey(identifier));
365+
return unwrap(kv.get(key, GetOption.builder().withCountOnly(true).build())).getCount() > 0;
366+
}
367+
357368
private String tableKey(Namespace namespace) {
358369
return tablePrefix() + namespaceToPath(namespace);
359370
}

0 commit comments

Comments
 (0)