@@ -481,13 +481,12 @@ func (s *pebbleStore) ApplyMutations(ctx context.Context, mutations []*KVPairMut
481481}
482482
483483func (s * pebbleStore ) Compact (ctx context.Context , minTS uint64 ) error {
484- // Real Compaction in LSM is hard to trigger precisely for MVCC GC.
485- // We can set a CompactionFilter in Options that drops keys with TS < minTS
486- // IF there is a newer version > minTS.
487- // But Options are set at Open.
488- // Updating options dynamically is not fully supported for CompactionFilter in standard Pebble API simply.
489- // However, we can use DeleteRange for VERY old data if we knew the keys.
490- // For this assignment, we will simply log.
484+ // TODO: Implement MVCC garbage collection.
485+ // We should iterate through all keys and remove versions older than minTS,
486+ // keeping at least one version <= minTS for snapshot consistency.
487+ // This is a heavy operation and should be done in the background or using
488+ // a Pebble CompactionFilter if possible.
489+ // For now, we simply log the request.
491490 s .log .Info ("Compact requested" , slog .Uint64 ("minTS" , minTS ))
492491 return nil
493492}
@@ -514,7 +513,7 @@ func (s *pebbleStore) Snapshot() (io.ReadWriter, error) {
514513
515514 buf := & bytes.Buffer {}
516515
517- // Format: [LastCommitTS] [Count] [ KeyLen] [Key] [ValLen] [Val] ...
516+ // Format: [LastCommitTS] [KeyLen] [Key] [ValLen] [Val] ...
518517
519518 // We need to persist s.lastCommitTS too.
520519
0 commit comments