-
Notifications
You must be signed in to change notification settings - Fork 221
Garbage Collection
Older versions of data in TiKV are not deleted by default. You need to actively trigger the Garbage Collection process (also known as GC) to recycle old version data according to the needs of your application.
Triggering can be done by periodically starting the GC process using a cron job or other task schedule system (you can check the example worker), or by periodically calling the client.GC
function within a service. Whenever possible, keep only one active GC task in the cluster to avoid unnecessary overhead.
The key parameter to GC is safepoint
, which is a timestamp. TiKV keeps the last version before safepoint for each key when recycling data (unless the last record is delete
). You can decide the retention time of historical data according to your application needs and calculate the cooresponding safepoint
. The method of calculation can be referred to Timestamps.
Feel free to help improving! Minor changes are warmly welcomed. Just simply click edit!
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Contents
- Client-Go Wiki
- Compatibility
- API V2
- Transactional API
- RawKV API
- Configurations
- Utilities