feat: Hard delete database and table #26553
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements hard deletion functionality for databases and tables in InfluxDB 3 Core (OSS). Previously, only soft deletion was supported, which marked objects as deleted but did not remove the underlying data or schema objects. This feature enables the complete removal of
.parquet
snapshot files for the deleted tables. The schema will be completely removed after a configurable grace period.Configuration
INFLUXDB3_HARD_DELETE_DEFAULT_DURATION
Catalog::DEFAULT_HARD_DELETE_DURATION
)INFLUXDB3_DELETE_GRACE_PERIOD
Usage Examples
Notes
Architecture
This builds on the existing retention-policy enforcement processing, adding files for the deleted schema. These removed files are added to the next snapshot and removed from object storage.
The
PersistedFiles
structure implements theObjectDeleter
trait:influxdb/influxdb3_write/src/deleter.rs
Lines 15 to 21 in b154c83
Which ensures it is notified when it should delete the database or table. This accounts for individual hard-delete time for each table.
As a result, file deletions only happen if the node is accepting writes and therefore regularly snapshotting, which is the same for retention policy enforcement. It is possible files aren't cleaned up with the current implementation if: