Skip to content

Commit 44613cf

Browse files
# This is a combination of 2 commits.
# This is the 1st commit message: Disable notes cache by default This backend has perf issues on large repos with many merges, so we disable it for now until the issue is fixed. The commit message #2 will be skipped: # f
1 parent 1d3bdcf commit 44613cf

File tree

9 files changed

+29
-39
lines changed

9 files changed

+29
-39
lines changed

josh-cli/src/bin/josh-filter.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ fn make_app() -> clap::Command {
8686
.help("Don't load cache")
8787
.short('n'),
8888
)
89+
.arg(
90+
clap::Arg::new("notes-cache")
91+
.action(clap::ArgAction::SetTrue)
92+
.help("Enables notes based cache")
93+
.long("notes-cache"),
94+
)
8995
.arg(
9096
clap::Arg::new("pack")
9197
.action(clap::ArgAction::SetTrue)
@@ -196,11 +202,16 @@ fn run_filter(args: Vec<String>) -> josh_core::JoshResult<i32> {
196202
josh_core::cache::sled_load(&repo_path)?;
197203
}
198204

199-
let cache = std::sync::Arc::new(
200-
josh_core::cache::CacheStack::new()
201-
.with_backend(josh_core::cache::SledCacheBackend::default())
202-
.with_backend(josh_core::cache::NotesCacheBackend::new(&repo_path)?),
203-
);
205+
let cache = std::sync::Arc::new({
206+
let cache = josh_core::cache::CacheStack::new()
207+
.with_backend(josh_core::cache::SledCacheBackend::default());
208+
209+
if args.get_flag("notes-cache") {
210+
cache.with_backend(josh_core::cache::NotesCacheBackend::new(&repo_path)?)
211+
} else {
212+
cache
213+
}
214+
});
204215

205216
let mut transaction =
206217
josh_core::cache::TransactionContext::from_env(cache.clone())?.open(None)?;

josh-cli/src/bin/josh.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,13 @@ fn run_command(cli: &Cli) -> anyhow::Result<()> {
325325

326326
let cache = std::sync::Arc::new(
327327
josh_core::cache::CacheStack::new()
328-
.with_backend(josh_core::cache::SledCacheBackend::default())
329-
.with_backend(
330-
josh_core::cache::NotesCacheBackend::new(&repo_path)
331-
.map_err(from_josh_err)
332-
.context("Failed to create NotesCacheBackend")?,
333-
),
328+
.with_backend(josh_core::cache::SledCacheBackend::default()),
329+
// FIXME: NotesCacheBackend seems to have perf issues, so disable it for now
330+
//.with_backend(
331+
// josh_core::cache::NotesCacheBackend::new(&repo_path)
332+
// .map_err(from_josh_err)
333+
// .context("Failed to create NotesCacheBackend")?,
334+
//),
334335
);
335336

336337
// Create transaction using the known repo path

tests/cli/clone-main-branch.t

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ Test josh clone with main branch as default
111111
| |-- feature-branch
112112
| `-- main
113113
|-- josh
114-
| |-- 24
115-
| | `-- 0
116-
| | |-- 9d5b5e98dceaf62470a7569949757c9643632621
117-
| | `-- bf567e0faf634a663d6cef48145a035e1974ab1d
118114
| `-- remotes
119115
| `-- origin
120116
| |-- feature-branch
@@ -133,6 +129,6 @@ Test josh clone with main branch as default
133129
| `-- main
134130
`-- tags
135131

136-
14 directories, 12 files
132+
12 directories, 10 files
137133

138134
$ cd ..

tests/cli/clone.t

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151
|-- heads
5252
| `-- master
5353
|-- josh
54-
| |-- 24
55-
| | `-- 0
56-
| | |-- 9d5b5e98dceaf62470a7569949757c9643632621
57-
| | `-- bf567e0faf634a663d6cef48145a035e1974ab1d
5854
| `-- remotes
5955
| `-- origin
6056
| |-- feature
@@ -73,7 +69,7 @@
7369
| `-- master
7470
`-- tags
7571

76-
14 directories, 11 files
72+
12 directories, 9 files
7773

7874
$ tree
7975
.

tests/cli/empty-filter.t

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ Test josh clone with filter that results in empty tree for some branches
166166
| |-- master
167167
| `-- mixed-branch
168168
|-- josh
169-
| |-- 24
170-
| | `-- 0
171-
| | |-- 9d5b5e98dceaf62470a7569949757c9643632621
172-
| | `-- bf567e0faf634a663d6cef48145a035e1974ab1d
173169
| `-- remotes
174170
| `-- origin
175171
| |-- content-branch
@@ -192,6 +188,6 @@ Test josh clone with filter that results in empty tree for some branches
192188
| `-- mixed-branch
193189
`-- tags
194190

195-
14 directories, 17 files
191+
12 directories, 15 files
196192

197193
$ cd ..

tests/cli/push_stacked.t

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ Push with stacked changes (should create multiple refs)
6565
$ git ls-remote .
6666
da80e49d24d110866ce2ec7a5c21112696fd165b\tHEAD (esc)
6767
da80e49d24d110866ce2ec7a5c21112696fd165b\trefs/heads/master (esc)
68-
725a17751b9dc03b1696fb894d0643c5b6f0397d\trefs/josh/24/0/9d5b5e98dceaf62470a7569949757c9643632621 (esc)
69-
030ef005644909d7f6320dcd99684a36860fb7d9\trefs/josh/24/0/bf567e0faf634a663d6cef48145a035e1974ab1d (esc)
7068
6ed6c1ca90cb15fe4edf8d133f0e2e44562aa77d\trefs/josh/remotes/origin/master (esc)
7169
da80e49d24d110866ce2ec7a5c21112696fd165b\trefs/namespaces/josh-origin/HEAD (esc)
7270
5f2928c89c4dcc7f5a8c59ef65734a83620cefee\trefs/namespaces/josh-origin/refs/heads/master (esc)
@@ -88,8 +86,6 @@ Push with stacked changes (should create multiple refs)
8886
$ git ls-remote .
8987
da80e49d24d110866ce2ec7a5c21112696fd165b\tHEAD (esc)
9088
da80e49d24d110866ce2ec7a5c21112696fd165b\trefs/heads/master (esc)
91-
725a17751b9dc03b1696fb894d0643c5b6f0397d\trefs/josh/24/0/9d5b5e98dceaf62470a7569949757c9643632621 (esc)
92-
030ef005644909d7f6320dcd99684a36860fb7d9\trefs/josh/24/0/bf567e0faf634a663d6cef48145a035e1974ab1d (esc)
9389
6ed6c1ca90cb15fe4edf8d133f0e2e44562aa77d\trefs/josh/remotes/origin/master (esc)
9490
da80e49d24d110866ce2ec7a5c21112696fd165b\trefs/namespaces/josh-origin/HEAD (esc)
9591
5f2928c89c4dcc7f5a8c59ef65734a83620cefee\trefs/namespaces/josh-origin/refs/heads/master (esc)

tests/cli/push_stacked_split.t

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ Test that we can fetch the split refs back
144144
* | Change-Id: 1234 (origin/@changes/master/josh@example.com/1234) 43d6fcc9e7a81452d7343c78c0102f76027717fb
145145
|/
146146
* add file1 (origin/master, origin/HEAD) 5f2928c89c4dcc7f5a8c59ef65734a83620cefee
147-
* Notes added by 'git_note_create' from libgit2 725a17751b9dc03b1696fb894d0643c5b6f0397d
148-
* Notes added by 'git_note_create' from libgit2 030ef005644909d7f6320dcd99684a36860fb7d9
149147

150148
Test normal push still works
151149

tests/filter/cmdline.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434
$ git commit -m "initial" --allow-empty 1> /dev/null
3535

36-
$ josh-filter -s c=:/sub1 --update refs/josh/filter/libs/master libs/master
36+
$ josh-filter --notes-cache -s c=:/sub1 --update refs/josh/filter/libs/master libs/master
3737
21a904a6f350cb1f8ea4dc6fe9bd4e3b4cc4840b
3838
[2] :/sub1
3939
[2] :prefix=c
4040
[4] sequence_number
4141
$ git log --graph --pretty=%s josh/filter/libs/master
4242
* add file2
4343
* add file1
44-
$ josh-filter -s a/b=:/sub2 --update refs/josh/filter/libs/foo libs/foo
44+
$ josh-filter --notes-cache -s a/b=:/sub2 --update refs/josh/filter/libs/foo libs/foo
4545
933f26e096e3452793bcbb82e8d927d7820340fb
4646
[1] :prefix=a
4747
[1] :prefix=b

tests/filter/file.t

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@
5454
.git/refs/
5555
|-- heads
5656
| `-- master
57-
|-- josh
58-
| `-- 24
59-
| `-- 0
60-
| `-- fc16bb70cbbc24982dac74e19c853a8fc91a2aed
6157
`-- tags
6258

63-
6 directories, 2 files
59+
3 directories, 1 file
6460

0 commit comments

Comments
 (0)