Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

searcher: Consolidate FetchTar and FetchTarPaths #64268

Merged
merged 5 commits into from
Aug 8, 2024

Conversation

eseliger
Copy link
Member

@eseliger eseliger commented Aug 5, 2024

There was a todo comment that said we want to consolidate them but didn't yet to keep another diff smaller - so now we're doing that.

Test plan: Integration tests for search still pass.

@cla-bot cla-bot bot added the cla-signed label Aug 5, 2024
@github-actions github-actions bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels Aug 5, 2024
This was referenced Aug 5, 2024
Copy link
Member Author

eseliger commented Aug 5, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @eseliger and the rest of your teammates on Graphite Graphite

@eseliger eseliger marked this pull request as ready for review August 5, 2024 10:27
@eseliger eseliger requested a review from a team August 5, 2024 10:27
Comment on lines +471 to +474
func fetchTarFromGithub(ctx context.Context, repo api.RepoName, commit api.CommitID, paths []string) (io.ReadCloser, error) {
r, err := fetchTarFromGithubWithPaths(ctx, repo, commit, paths)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will need to run the benchmarks in this package to ensure you don't regress this behaviour.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm :(

➜  sourcegraph git:(main) go test -bench=. ./cmd/searcher/internal/search/...
--- FAIL: BenchmarkColumnHelper
    chunk_test.go:374: column is not offset even though data is ASCII
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10623f684]

goroutine 5275 [running]:
github.com/sourcegraph/sourcegraph/cmd/searcher/internal/search.(*Store).fetch(0x108d98f00, {0x1070a2400, 0x1400221a570}, {0x1064c1142, 0x14}, {0x106554df7, 0x28}, 0x14002102100, {0x0, 0x0, ...})
        /Users/erik/Code/sourcegraph/sourcegraph/cmd/searcher/internal/search/store.go:272 +0x464
github.com/sourcegraph/sourcegraph/cmd/searcher/internal/search.(*Store).PrepareZip.func2.1({0x1070a2400?, 0x1400221a570?})
        /Users/erik/Code/sourcegraph/sourcegraph/cmd/searcher/internal/search/store.go:189 +0x5c
github.com/sourcegraph/sourcegraph/internal/diskcache.(*store).Open.func1({0x1070a2400?, 0x1400221a570?}, {0x140028bc4e0, 0x60})
        /Users/erik/Code/sourcegraph/sourcegraph/internal/diskcache/cache.go:113 +0x34
github.com/sourcegraph/sourcegraph/internal/diskcache.doFetch({0x1070a2400, 0x1400221a570}, {0x140028bc300, 0x5b}, 0x1400224a1c0, {0x1070af9c0, 0x1400298c410})
        /Users/erik/Code/sourcegraph/sourcegraph/internal/diskcache/cache.go:257 +0x30c
github.com/sourcegraph/sourcegraph/internal/diskcache.(*store).OpenWithPath.func2()
        /Users/erik/Code/sourcegraph/sourcegraph/internal/diskcache/cache.go:185 +0x218
created by github.com/sourcegraph/sourcegraph/internal/diskcache.(*store).OpenWithPath in goroutine 5274
        /Users/erik/Code/sourcegraph/sourcegraph/internal/diskcache/cache.go:172 +0x798
exit status 2
FAIL    github.com/sourcegraph/sourcegraph/cmd/searcher/internal/search 3.441s
FAIL

Seems like it's borked on main and that fetchTarFromGithubWithPaths never properly respected paths..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eseliger eseliger force-pushed the es/08-04-choremovecmdfrontendbackendtointernal branch from 827cf1f to fdaccd5 Compare August 5, 2024 14:50
@eseliger eseliger force-pushed the es/08-05-searcherconsolidatefetchtarandfetchtarpaths branch from 3e22471 to f410ad5 Compare August 5, 2024 14:51
@eseliger eseliger force-pushed the es/08-04-choremovecmdfrontendbackendtointernal branch from fdaccd5 to dd453a0 Compare August 6, 2024 10:50
@eseliger eseliger force-pushed the es/08-05-searcherconsolidatefetchtarandfetchtarpaths branch from f410ad5 to 7a13632 Compare August 6, 2024 10:51
@eseliger eseliger force-pushed the es/08-04-choremovecmdfrontendbackendtointernal branch from dd453a0 to bb34348 Compare August 6, 2024 11:31
@eseliger eseliger force-pushed the es/08-05-searcherconsolidatefetchtarandfetchtarpaths branch from 7a13632 to a5583c1 Compare August 6, 2024 11:32
This PR makes the calls to create the OIDC provider explicit, so that we don't need to implicitly need to call a Refresh method, even if we might end up not needing the `p.oidc`.
This is a start toward being able to create providers on the fly cheaply vs having a globally managed list of providers in memory.

Test plan: Auth with SAMS locally still works.
This PR fixes a few more imports from /internal/ packages using /cmd/... contents.

Test plan: Mainly moved code around and CI still passes.
These functions are not required to be called outside of frontend, so there's no need to reexport them. Instead, we consolidate the signout cookie logic in the session package.

Test plan: Just moved some code around, go compiler doesn't complain.
To prevent cross-cmd imports in the future, moving the backend package into internal.

Test plan: Just moved a package around, Go compiler doesn't complain and CI still passes.
There was a todo comment that said we want to consolidate them but didn't yet to keep another diff smaller - so now we're doing that.

Test plan: Integration tests for search still pass.
@eseliger eseliger force-pushed the es/08-04-choremovecmdfrontendbackendtointernal branch from bb34348 to 0a78295 Compare August 7, 2024 08:10
@eseliger eseliger force-pushed the es/08-05-searcherconsolidatefetchtarandfetchtarpaths branch from a5583c1 to e719eb4 Compare August 7, 2024 08:10
Copy link
Member Author

eseliger commented Aug 8, 2024

Merge activity

@eseliger eseliger changed the base branch from es/08-04-choremovecmdfrontendbackendtointernal to graphite-base/64268 August 8, 2024 08:42
@eseliger eseliger changed the base branch from graphite-base/64268 to main August 8, 2024 09:03
@eseliger eseliger merged commit a3f23a5 into main Aug 8, 2024
17 checks passed
@eseliger eseliger deleted the es/08-05-searcherconsolidatefetchtarandfetchtarpaths branch August 8, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants