Skip to content

Off-by-one result on "db vacate" with timestamp #6746

@philrz

Description

@philrz

It's been described that when super db vacate is run with its optional timestamp argument, commits >= the provided timestamp are kept and all older commits deleted. But when attempting this in testing it appears one more commit is maintained in the history than I'd expect.

Details

Repro is with super commit 3b779b0.

With a DB service running, we load some data to generate commits, leaving 2-second gaps in between to make it easier to aim at a vacate target via timestamp.

$ super -version
Version: v0.2.0-57-g3b779b0a5

$ super db create -use -q test

$ for num in $(seq 0 3); do
  echo {x:${num}} | super db load -message "committing x:${num} on main" - && sleep 2
done

(12/1) 6B 6B/s
3B8NosvUfczxU0LDDY7rXndC4dE committed
(12/1) 6B 6B/s
3B8NpA2yGjCMlzv2jCYFNbvmDsN committed
(12/1) 6B 6B/s
3B8NpT8gfaBUOb3waGEaX1YBODZ committed
(12/1) 6B 6B/s
3B8NpgOvDHJJwt7ylTk0mW9iVAr committed

At this point, our log shows:

$ super db log
commit 3B8NpgOvDHJJwt7ylTk0mW9iVAr (HEAD -> main)
Author: phil@wpm.local
Date:   2026-03-18T20:48:41Z

    committing x:3 on main

commit 3B8NpT8gfaBUOb3waGEaX1YBODZ
Author: phil@wpm.local
Date:   2026-03-18T20:48:39Z

    committing x:2 on main

commit 3B8NpA2yGjCMlzv2jCYFNbvmDsN
Author: phil@wpm.local
Date:   2026-03-18T20:48:37Z

    committing x:1 on main

commit 3B8NosvUfczxU0LDDY7rXndC4dE
Author: phil@wpm.local
Date:   2026-03-18T20:48:35Z

    committing x:0 on main

Aiming our vacate at a timestamp right in the middle of these, I'd expect the bottom two commits to be dropped, but instead only one is.

$ super db vacate -f 2026-03-18T20:48:38Z
vacated 1 commit

$ super db log
commit 3B8NpgOvDHJJwt7ylTk0mW9iVAr (HEAD -> main)
Author: phil@wpm.local
Date:   2026-03-18T20:48:41Z

    committing x:3 on main

commit 3B8NpT8gfaBUOb3waGEaX1YBODZ
Author: phil@wpm.local
Date:   2026-03-18T20:48:39Z

    committing x:2 on main

commit 3B8NpA2yGjCMlzv2jCYFNbvmDsN
Author: phil@wpm.local
Date:   2026-03-18T20:48:37Z

    committing x:1 on main

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions