SetOrphanGCConfig overrides the default sweep interval (24h) and grace period (30d). Pass 0 for either to keep the package default. Must be called before StartOrphanGC.
(interval, grace time.Duration)
| 543 | // grace period (30d). Pass 0 for either to keep the package default. |
| 544 | // Must be called before StartOrphanGC. |
| 545 | func (s *Server) SetOrphanGCConfig(interval, grace time.Duration) { |
| 546 | s.orphanGC.mu.Lock() |
| 547 | defer s.orphanGC.mu.Unlock() |
| 548 | if interval > 0 { |
| 549 | s.orphanGC.interval = interval |
| 550 | } |
| 551 | if grace > 0 { |
| 552 | // A grace shorter than a copy transaction lets the sweep claim a |
| 553 | // soft-deleted source row the copy has already planned from, and |
| 554 | // reclaim its blob before the clone commits. Floor it at the window |
| 555 | // the reference-stamp protocol already accepts for slow writers |
| 556 | // (TASK-4280). |
| 557 | if grace < orphanGCRefStaleWindow { |
| 558 | slog.Warn("orphan GC: configured grace is below the minimum and was raised", |
| 559 | "configured", grace.String(), "effective", orphanGCRefStaleWindow.String()) |
| 560 | grace = orphanGCRefStaleWindow |
| 561 | } |
| 562 | s.orphanGC.grace = grace |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | // StartOrphanGC kicks off the periodic sweep loop. Idempotent — |
| 567 | // calling twice is a no-op (existing loop continues, second call |