lakekeeper: Table data cleanup performance degrades with high table churn rate
Describe the bug It seems that when a lot of tables are created and deleted, and among those are tables that might take several minutes to delete, with DELETION PROFILE = HARD, data purge progress is slowed down to the point it looks like it is not happening.
To Reproduce
Consistently create and drop tables with varying size, from 1000 to 1000000 rows, to achieve building in tabular_purges and task tables, where majority of tasks in task table have status pending.
Expected behavior Table drop is either hard or soft deletion is executed either immediately (hard), or according to set time (soft).
System Information:
- Deployment Type: Lakekeeper 0.8.1, Postgres 15.10 (Aurora), Helm on EKS 1.29
- Lakekeeper Version: 0.8.1 (Helm 0.5.0)
- Authentication Provider: EntraID
- Authorization Provider: None
Additional context I have no trace-level logs, only info - and it says purge task is queued (warehouse id and bucket location removed from logs):
{"timestamp":"2025-04-15T17:23:36.226440Z","level":"INFO","message":"Queuing expiration for '...' of type: 'Table' under warehouse: '...'","target":"iceberg_catalog::implementations::postgres::task_queues::tabular_purge_queue","filename":"crates/iceberg-catalog/src/implementations/postgres/task_queues/tabular_purge_queue.rs","line_number":104,"span":{"__arg1":"TabularPurgeInput { tabular_id: ..., warehouse_ident: WarehouseIdent(..), tabular_type: Table, parent_id: None, tabular_location: \"s3://.../.../test_partitioned-c80f0182844b4e87a705a3e482433110\" }","name":"enqueue"},"spans":[{"method":"DELETE","request_id":"6d6b76b7ea04328cfb5cc50d182758c8","uri":"/catalog/v1/.../namespaces/sap_afs/tables/test_partitioned?purgeRequested=true","version":"HTTP/1.1","name":"request"},{"task":"TabularPurgeInput { tabular_id: ..., warehouse_ident: WarehouseIdent(...), tabular_type: Table, parent_id: None, tabular_location: \"s3://.../test_partitioned-c80f0182844b4e87a705a3e482433110\" }","name":"queue_tabular_purge"},{"__arg1":"TabularPurgeInput { tabular_id: 01963a76-aee2-7192-a333-0354d0d35eaa, warehouse_ident: WarehouseIdent(...), tabular_type: Table, parent_id: None, tabular_location: \"s3:/...test_partitioned-c80f0182844b4e87a705a3e482433110\" }","name":"enqueue"}]}
{"timestamp":"2025-04-15T17:23:36.227896Z","level":"INFO","message":"Queued purge task: Record { task_id: 01963a7a-4ea2-7f51-b42b-d03fedb9e45b }","target":"iceberg_catalog::implementations::postgres::task_queues::tabular_purge_queue","filename":"crates/iceberg-catalog/src/implementations/postgres/task_queues/tabular_purge_queue.rs","line_number":152,"span":{"__arg1":"TabularPurgeInput { tabular_id:..., warehouse_ident: WarehouseIdent(...), tabular_type: Table, parent_id: None, tabular_location: \"s3://.../test_partitioned-c80f0182844b4e87a705a3e482433110\" }","name":"enqueue"},"spans":[{"method":"DELETE","request_id":"6d6b76b7ea04328cfb5cc50d182758c8","uri":"/catalog/v1/.../namespaces/sap_afs/tables/test_partitioned?purgeRequested=true","version":"HTTP/1.1","name":"request"},{"task":"TabularPurgeInput { tabular_id: ..., warehouse_ident: WarehouseIdent(...), tabular_type: Table, parent_id: None, tabular_location: \"s3://.../test_partitioned-c80f0182844b4e87a705a3e482433110\" }","name":"queue_tabular_purge"},{"__arg1":"TabularPurgeInput { tabular_id: ..., warehouse_ident: WarehouseIdent(...), tabular_type: Table, parent_id: None, tabular_location: \"s3://.../test_partitioned-c80f0182844b4e87a705a3e482433110\" }","name":"enqueue"}]}
Deletion profile: Hard
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (18 by maintainers)
We have a major refactoring of the Task queues planned for 0.9 or 0.10 which will also come with a UI that shows pending & running tasks there, including the option to cancel / retry those. We need this for table maintenance anyway, and it’ll also improve the visibility of our two current queues (purge & expiration) significantly.
You can currently already decrease the poll interval via environment variables, but if you can wait until tomorrow, that would be better 😃
https://docs.lakekeeper.io/docs/nightly/configuration/#task-queues
I also noted a wait after the loop - completely wrong place. Performance is going to be largely improved in the next patch release coming tomorrow or so.
Currently we have a 10s gap between task polls by default - it should only wait 10 seconds if the queue was empty.
hmm. I just realised that this is not related to partitioning. I tried any table and data is not removed once the table is dropped. Will upgrade now and try again.
No, soft-delete is disabled and there is nothing in deleted tab. Non-partitioned tables are instantly removed, and as you can see from logs, purge task is queued immediately, but then nothing happens. Interesting to know that enabling soft-deletes fixes it, but should work without them as well 🙂