Skip to content

DROP TABLE with PURGE via Trino + Polaris does not delete table files #3695

Closed

Description

@andrii29

Describe the bug

We ran into an issue when trying to delete an Iceberg table and its data using Polaris (1.3.0) through Trino while using polaris.features.DROP_WITH_PURGE_ENABLED: "true".

trino> DROP TABLE iceberg.test.inventory2;

2026-02-06 12:50:12,012 INFO  [io.qua.htt.access-log] [51d05ab5-88b1-4613-b6ac-590c73238304_0000000000000000020,POLARIS] [,,,] (executor-thread-2) 10.250.16.13 - quickstart_user [06/Feb/2026:12:50:12 +0000] "DELETE /api/catalog/v1/quickstart_catalog/namespaces/test/tables/inventory2?purgeRequested=true HTTP/1.1" 204 -
2026-02-06 12:50:12,021 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [51d05ab5-88b1-4613-b6ac-590c73238304_0000000000000000020,POLARIS] [3c132ae93e2c6eeb215e74fc5afa23e3,,743b134f54e02736,true] (executor-thread-3) Handling task entity id 3919859537221867440
2026-02-06 12:50:12,031 INFO  [org.apa.pol.ser.tas.TableCleanupTaskHandler] [51d05ab5-88b1-4613-b6ac-590c73238304_0000000000000000020,POLARIS] [3c132ae93e2c6eeb215e74fc5afa23e3,,743b134f54e02736,true] (executor-thread-3) tableIdentifier=test.inventory2 metadataLocation=s3://bucket123/test/inventory2-9cd21972747a422a8219ea2267b49c22/metadata/00000-a142d83b-4738-48c3-9c80-e992628bbcbb.metadata.json Handling table metadata cleanup task
2026-02-06 12:50:13,034 WARN  [org.apa.pol.ser.tas.TaskExecutorImpl] [,] [,,,] (executor-thread-3) Failed to handle task entity id 3919859537221867440: java.util.concurrent.CompletionException: jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=org.apache.polaris.service.task.TaskFileIOSupplier, id=7kBDtfomB8MiW4C8Cl5bNPGxnxg]
        - you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807)
        at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
        at org.jboss.threads.EnhancedViewExecutor$EnhancedViewExecutorRunnable.run(EnhancedViewExecutor.java:496)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:645)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1586)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=org.apache.polaris.service.task.TaskFileIOSupplier, id=7kBDtfomB8MiW4C8Cl5bNPGxnxg]
        - you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
        at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:76)
        at io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:32)
        at org.apache.polaris.service.task.TaskFileIOSupplier_ClientProxy.arc$delegate(Unknown Source)
        at org.apache.polaris.service.task.TaskFileIOSupplier_ClientProxy.apply(Unknown Source)
        at org.apache.polaris.service.task.TableCleanupTaskHandler.handleTask(TableCleanupTaskHandler.java:96)
        at org.apache.polaris.service.task.TaskExecutorImpl.handleTask(TaskExecutorImpl.java:172)
        at org.apache.polaris.service.task.TaskExecutorImpl.handleTaskWithTracing(TaskExecutorImpl.java:209)
        at org.apache.polaris.service.task.TaskExecutorImpl.lambda$tryHandleTask$0(TaskExecutorImpl.java:135)
        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
        ... 10 more

polaris docker compose

polaris:
    image: apache/polaris:1.3.0-incubating
    environment:
      JAVA_DEBUG: true
      JAVA_DEBUG_PORT: "*:5005"
      AWS_REGION: us-west-2
      AWS_ACCESS_KEY_ID: ${MINIO_ROOT_USER}
      AWS_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD}
      POLARIS_BOOTSTRAP_CREDENTIALS: POLARIS,${ROOT_CLIENT_ID},${ROOT_CLIENT_SECRET}
      polaris.realm-context.realms: ${POLARIS_REALM}
      polaris.authentication.type: mixed
      quarkus.otel.sdk.disabled: "true"
      polaris.features.DROP_WITH_PURGE_ENABLED: "true"
      polaris.features.CLEANUP_ON_CATALOG_DROP: "true"
      polaris.features.STORAGE_CREDENTIAL_DURATION_SECONDS: "36000"
      POLARIS_PERSISTENCE_TYPE: relational-jdbc
      QUARKUS_DATASOURCE_DB_KIND: postgresql
      QUARKUS_DATASOURCE_USERNAME: ${POSTGRES_USER}
      QUARKUS_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}
      QUARKUS_DATASOURCE_JDBC_URL: jdbc:[postgresql://postgres:5432/${POSTGRES_DB}](postgresql://postgres:5432/$%7BPOSTGRES_DB%7D)

To Reproduce

  1. Clone repo https://github.com/andrii29/trino-polaris-delete-purge-issue/tree/main
  2. Check README.md file

Actual Behavior

Table data in MinIO is present.

Expected Behavior

Whole table data in MinIO is deleted.

Additional context

https://apache-polaris.slack.com/archives/C084XDM50CB/p1770383328954309

System information

OS: Linux
Polaris Catalog Version: 1.3.0
Object storage & setup: Minio

Activity

  1. added
    bug
    on Feb 7, 2026
  2. dimas-b commented on Feb 9, 2026

    @dimas-b
    Contributor

    This should be fixed by #3210 (part of the upcoming 1.4.0 release)

  3. dimas-b commented on Feb 9, 2026

    @dimas-b
    Contributor

    @andrii29 : Would you be able to verify the fix from a manual image build from main?

  4. andrii29 commented on Feb 9, 2026

    @andrii29
    ContributorAuthor

    @dimas-b It works, thank you!

    polaris-1  | 2026-02-09 20:20:28,415 INFO  [io.qua.htt.access-log] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [,,,] (executor-thread-4) 172.11.0.4 - quickstart_user [09/Feb/2026:20:20:28 +0000] "DELETE /api/catalog/v1/quickstart_catalog/namespaces/test/tables/orders?purgeRequested=true HTTP/1.1" 204 -
    polaris-1  | 2026-02-09 20:20:28,421 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,,25a072ff5ed5e531,true] (executor-thread-1) Handling task entity id 11
    polaris-1  | 2026-02-09 20:20:28,428 INFO  [org.apa.pol.ser.tas.TableCleanupTaskHandler] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,,25a072ff5ed5e531,true] (executor-thread-1) tableIdentifier=test.orders metadataLocation=s3://bucket123/test/orders-47e190d0060748ada609fade0a116d43/metadata/00000-d95f4d82-ba15-4f95-8df9-9d93974ecb6e.metadata.json Handling table metadata cleanup task
    polaris-1  | 2026-02-09 20:20:28,429 INFO  [org.apa.ice.CatalogUtil] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,,25a072ff5ed5e531,true] (executor-thread-1) Loading custom FileIO implementation: org.apache.iceberg.aws.s3.S3FileIO
    polaris-1  | 2026-02-09 20:20:28,452 INFO  [org.apa.ice.InternalData] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,,25a072ff5ed5e531,true] (executor-thread-1) Unable to register Parquet for metadata files: Cannot find method: register
    polaris-1  | 2026-02-09 20:20:28,547 INFO  [org.apa.pol.ser.tas.TableCleanupTaskHandler] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,,25a072ff5ed5e531,true] (executor-thread-1) tableIdentifier=test.orders metadataLocation=s3://bucket123/test/orders-47e190d0060748ada609fade0a116d43/metadata/00000-d95f4d82-ba15-4f95-8df9-9d93974ecb6e.metadata.json taskCount=2 Successfully queued tasks to delete manifests, previous metadata, and statistics files - deleting table metadata file
    polaris-1  | 2026-02-09 20:20:28,548 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,25a072ff5ed5e531,269588a22209d852,true] (executor-thread-4) Handling task entity id 13
    polaris-1  | 2026-02-09 20:20:28,549 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,25a072ff5ed5e531,752663f907bfdc84,true] (executor-thread-3) Handling task entity id 14
    polaris-1  | 2026-02-09 20:20:28,551 INFO  [org.apa.ice.CatalogUtil] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,25a072ff5ed5e531,269588a22209d852,true] (executor-thread-4) Loading custom FileIO implementation: org.apache.iceberg.aws.s3.S3FileIO
    polaris-1  | 2026-02-09 20:20:28,551 INFO  [org.apa.ice.CatalogUtil] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,25a072ff5ed5e531,752663f907bfdc84,true] (executor-thread-3) Loading custom FileIO implementation: org.apache.iceberg.aws.s3.S3FileIO
    polaris-1  | 2026-02-09 20:20:28,560 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,,25a072ff5ed5e531,true] (executor-thread-1) taskEntityId=11 handlerClass=class org.apache.polaris.service.task.TableCleanupTaskHandler Task successfully handled
    polaris-1  | 2026-02-09 20:20:28,581 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,25a072ff5ed5e531,752663f907bfdc84,true] (executor-thread-3) taskEntityId=14 handlerClass=class org.apache.polaris.service.task.BatchFileCleanupTaskHandler Task successfully handled
    polaris-1  | 2026-02-09 20:20:28,611 INFO  [org.apa.pol.ser.tas.ManifestFileCleanupTaskHandler] [,] [,,,] () manifestFile=s3://bucket123/test/orders-47e190d0060748ada609fade0a116d43/metadata/430a145d-d355-4070-a82e-3ffb909fb55e-m0.avro All data files in manifest deleted - deleting manifest
    polaris-1  | 2026-02-09 20:20:28,616 INFO  [org.apa.pol.ser.tas.TaskExecutorImpl] [90f652ec-385b-4589-be9b-043159b1cfe3_0000000000000000039,POLARIS] [5c673cc82a63858ebe8f701f24d93470,25a072ff5ed5e531,269588a22209d852,true] (executor-thread-4) taskEntityId=13 handlerClass=class org.apache.polaris.service.task.ManifestFileCleanupTaskHandler Task successfully handled 
    
  5. dimas-b commented on Feb 9, 2026

    @dimas-b
    Contributor

    Thanks for confirming, @andrii29 ! I'm going to mark this issue as fixed in 1.4.0

  6. added this to the 1.4.0 milestone on Feb 9, 2026
  7. vitaliikalmykov commented on Apr 24, 2026

    @vitaliikalmykov

    Hello. Unfortunately it does not work for tables ~14GB size
    2026-04-24 18:02:55,258 WARN [org.apa.ice.uti.Tasks] [b311283f-413b-40a1-959c-5faf57c1e858_0000000000000001370,POLARIS] [,,,] (executor-thread-258) Retrying task after failure: sleepTimeMs=400 Unable to execute HTTP request: Timeout waiting for connection from pool (SDK Attempt Count: 6): software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Timeout waiting for connection from pool (SDK Attempt Count: 6)

  8. dimas-b commented on May 12, 2026

    @dimas-b
    Contributor

    @vitaliikalmykov : Timeout waiting for connection from pool looks like a different issue to me 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions