Skip to content

Commit f0cf232

Browse files
Bump embedded furrow to v0.3.3 (fast store open) (#1962)
* Prove a store written by furrow 0.2.0 keeps working under a newer engine * Add the change entry for the furrow store compatibility test * Bump embedded furrow to v0.3.3 --------- Co-authored-by: agentfield-bot <agentfield-bot@users.noreply.github.com>
1 parent 808c90c commit f0cf232

3 files changed

Lines changed: 103 additions & 8 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
kind: changed
3+
title: The embedded storage engine is furrow 0.3.3, which opens a large store without scanning it
4+
pr: 1962
5+
surface: [engine]
6+
invalidates: []
7+
---
8+
furrow 0.3.3 validates a store's pack checkpoint with one index seek instead of counting every object, opens a settled store without taking the pack lock, and answers `status` without writing. Saving and attaching no longer slow down as the store grows. A compat test seals with furrow 0.2.0, then the embedded engine, then 0.2.0 again on the same store, so existing stores keep working in both directions.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package cellstore
2+
3+
import (
4+
"context"
5+
"os"
6+
"path/filepath"
7+
"testing"
8+
9+
"github.com/Agent-Field/codeaf/internal/cell"
10+
"github.com/Agent-Field/codeaf/internal/furrow"
11+
)
12+
13+
// oldEngineEnv names an older furrow release binary. The store-format tests
14+
// below skip without it: they prove that a store written by that release opens
15+
// and keeps capturing under the embedded engine, and the other way round.
16+
const oldEngineEnv = "CODEAF_FURROW_OLD"
17+
18+
// TestStoreWrittenByAnOlderEngineOpensUnderTheEmbeddedOne seals and captures a
19+
// cell with the old release, then with the embedded engine on the SAME data
20+
// root, then with the old release again. The chain must continue unbroken in
21+
// both directions: a user who upgrades keeps their history, and a codeaf that
22+
// is rolled back still reads what the newer one wrote.
23+
func TestStoreWrittenByAnOlderEngineOpensUnderTheEmbeddedOne(t *testing.T) {
24+
old := os.Getenv(oldEngineEnv)
25+
if old == "" {
26+
t.Skipf("%s not set", oldEngineEnv)
27+
}
28+
current, err := furrow.ResolveOwned()
29+
if err != nil {
30+
t.Skipf("no embedded engine: %v", err)
31+
}
32+
if current == old {
33+
t.Skip("the embedded engine is the old engine")
34+
}
35+
ctx := context.Background()
36+
dataRoot := t.TempDir()
37+
c, err := cell.CreateIn(t.TempDir(), cell.Options{Class: cell.Sandboxed})
38+
if err != nil {
39+
t.Fatal(err)
40+
}
41+
engineOf := func(bin string) Engine {
42+
return Engine{Binary: bin, DataRoot: dataRoot, Transport: Spawn{Binary: bin}}
43+
}
44+
note := filepath.Join(c.Root, "note.txt")
45+
write := func(s string) {
46+
t.Helper()
47+
if err := os.WriteFile(note, []byte(s), 0o600); err != nil {
48+
t.Fatal(err)
49+
}
50+
}
51+
52+
write("written by the old engine")
53+
first, err := engineOf(old).Seal(ctx, c, TurnInfo{})
54+
if err != nil {
55+
t.Fatalf("old engine seal: %v", err)
56+
}
57+
58+
write("written under the new engine")
59+
second, err := engineOf(current).Seal(ctx, c, TurnInfo{})
60+
if err != nil {
61+
t.Fatalf("embedded engine could not seal into the old store: %v", err)
62+
}
63+
if second.Turn.Parent != first.Turn.ID {
64+
t.Fatalf("chain broke across the upgrade: parent %q, want %q", second.Turn.Parent, first.Turn.ID)
65+
}
66+
67+
snap, err := engineOf(current).Capture(ctx, c)
68+
if err != nil || snap == "" {
69+
t.Fatalf("embedded engine capture in the old store: %q, %v", snap, err)
70+
}
71+
write("scribbled over")
72+
if err := engineOf(current).Restore(ctx, c, snap, []string{"note.txt"}); err != nil {
73+
t.Fatalf("embedded engine restore: %v", err)
74+
}
75+
if got, _ := os.ReadFile(note); string(got) != "written under the new engine" {
76+
t.Fatalf("restore gave %q", got)
77+
}
78+
79+
write("written after rolling back")
80+
third, err := engineOf(old).Seal(ctx, c, TurnInfo{})
81+
if err != nil {
82+
t.Fatalf("old engine could not seal into a store the newer engine wrote: %v", err)
83+
}
84+
if third.Turn.Parent != second.Turn.ID {
85+
t.Fatalf("chain broke across the rollback: parent %q, want %q", third.Turn.Parent, second.Turn.ID)
86+
}
87+
}

‎internal/furrowbin/pin.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
22
"repository": "Agent-Field/furrow",
3-
"tag": "v0.2.0",
4-
"version": "0.2.0",
3+
"tag": "v0.3.3",
4+
"version": "0.3.3",
55
"artifacts": {
66
"darwin-amd64": {
77
"asset": "furrow-darwin-amd64",
8-
"sha256": "fc9ead1c78582086d05f859f354fac2ade8b28b43ea54a4e04f9f03a3fb92ed1"
8+
"sha256": "a1b689f8863b578de10caef5d6cf5d09c4de1959b4f6256574e0e748687f36db"
99
},
1010
"darwin-arm64": {
1111
"asset": "furrow-darwin-arm64",
12-
"sha256": "23c713db4544de5e169a902d6d42e581c205d7c85e3605fb28bbf1250bdd0c86"
12+
"sha256": "6599f2e58bd2652610099956756de229ef2762cb4cf378a2c7f3533711e8cef1"
1313
},
1414
"linux-amd64": {
1515
"asset": "furrow-linux-amd64",
16-
"sha256": "be982dc8e991192d338b6daaa4f9a5765e7598eb3664b3dafd2f8e4834c4b508"
16+
"sha256": "7ed29c0de43988c9c550426c8494b8a114c9b15a3a17a160a18d16c47d2eca4f"
1717
},
1818
"linux-arm64": {
1919
"asset": "furrow-linux-arm64",
20-
"sha256": "b9cecb657ee253116ebd7c1969e920d9b95cdd99267b2068e8e78b07277b1e2c"
20+
"sha256": "4cdb22b14f11338ecab250a812bd2d25ff75aa6395eb5d7d6a0ff6c34c6c2acd"
2121
},
2222
"windows-amd64": {
2323
"asset": "furrow-windows-amd64.exe",
24-
"sha256": "327cc31320544e4c24f101cecc71ec7f68feae68921f7bb1ab1a6d165d0e01c7"
24+
"sha256": "52d2223f1eb181cf4a3486bd6dfca906d99238ae92dbbe77c50ec955f91ed3a3"
2525
},
2626
"windows-arm64": {
2727
"asset": "furrow-windows-arm64.exe",
28-
"sha256": "f5435d6d38c87d001a008fd19db399dd8e722ca3044c2f236c3174b0a7827e77"
28+
"sha256": "dc351ae8b48aee76fc70b142623b11a0b90da828000614aa3ced24017b3420f0"
2929
}
3030
}
3131
}

0 commit comments

Comments
 (0)