tka: improve logging for Compact and Commit operations

Log whenever we:

* Commit an AUM which was previously soft-deleted (which we don't expect
  to happen in practice, and may indicate an issue with our sync code)
* Purge AUMs during a Compact operation.
* Successfully commit AUMs as part of a bootstrap or sync operation.

All three logs mention `tka` for easy of discoverability.

Updates tailscale/corp#39455

Change-Id: I2b07bb0ef075877f40ec34b80bb668be59e1cdc3
Signed-off-by: Alex Chan <alexc@tailscale.com>
This commit is contained in:
Alex Chan
2026-04-01 15:49:06 +01:00
committed by Alex Chan
parent ec0b23a21f
commit b25920dfc0
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -597,6 +597,9 @@ func (c *FS) CommitVerifiedAUMs(updates []AUM) error {
for i, aum := range updates {
h := aum.Hash()
err := c.commit(h, func(info *fsHashInfo) {
if info.PurgedUnix > 0 {
log.Printf("tka: CommitVerifiedAUMs: committing previously-deleted AUM %s", h.String())
}
info.PurgedUnix = 0 // just in-case it was set for some reason
info.AUM = &aum
})
@@ -973,5 +976,8 @@ func Compact(storage CompactableChonk, head AUMHash, opts CompactionOptions) (la
if err := storage.SetLastActiveAncestor(lastActiveAncestor); err != nil {
return AUMHash{}, err
}
if len(toDelete) > 0 {
log.Printf("tka compaction: purging %d AUM(s) [%q]", len(toDelete), toDelete)
}
return lastActiveAncestor, storage.PurgeAUMs(toDelete)
}