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

Querying docs with just a cid (no docID) panics #3214

Closed
AndrewSisley opened this issue Nov 6, 2024 · 0 comments · Fixed by #3256
Closed

Querying docs with just a cid (no docID) panics #3214

AndrewSisley opened this issue Nov 6, 2024 · 0 comments · Fixed by #3256
Assignees
Labels
area/query Related to the query component bug Something isn't working
Milestone

Comments

@AndrewSisley
Copy link
Contributor

AndrewSisley commented Nov 6, 2024

Documented by TestQuerySimpleWithCid

E.g.:

Request: `query {
	Users (
			cid: "bafyreib7afkd5hepl45wdtwwpai433bhnbd3ps5m2rv3masctda7b6mmxe"
		) {
		name
	}
}`,

When fixing, also test what happens when a collection-level cid is provided, as that is currently untested.

panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0

goroutine 15 [running]:
testing.tRunner.func1.2({0x493f480, 0xc002480150})
/home/andy/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
/home/andy/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1634 +0x377
panic({0x493f480?, 0xc002480150?})
/home/andy/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:770 +0x132
github.com/sourcenetwork/defradb/internal/planner.(*selectNode).initSource(0xc0008b5ad0)
/home/andy/Projects/Source/defradb/internal/planner/select.go:270 +0x496
github.com/sourcenetwork/defradb/internal/planner.(*Planner).Select(0xc001736900, 0xc001f904d0)
/home/andy/Projects/Source/defradb/internal/planner/select.go:508 +0x105
github.com/sourcenetwork/defradb/internal/planner.(*Planner).Operation(0xc001736900, 0xc000f37360)
/home/andy/Projects/Source/defradb/internal/planner/operation.go:139 +0x145
github.com/sourcenetwork/defradb/internal/planner.(*Planner).MakePlan(0xc001736900, 0x0?)
/home/andy/Projects/Source/defradb/internal/planner/planner.go:603 +0x65
github.com/sourcenetwork/defradb/internal/planner.(*Planner).RunRequest(0xc001736900, {0x582fbb0, 0xc001ab1020}, 0xc000f37310)
/home/andy/Projects/Source/defradb/internal/planner/planner.go:520 +0x65
github.com/sourcenetwork/defradb/internal/db.(*db).execRequest(0xc001ca8900, {0x582fbb0, 0xc001ab1020}, {0x4dc80c9, 0x80}, 0xc000013ef0)
/home/andy/Projects/Source/defradb/internal/db/request.go:53 +0x65a
github.com/sourcenetwork/defradb/internal/db.(*db).ExecRequest(0xc001ca8900, {0x582fbb0?, 0xc001ab0f90?}, {0x4dc80c9, 0x80}, {0x0, 0x0, 0x8423ce0?})
/home/andy/Projects/Source/defradb/internal/db/store.go:38 +0x25c
github.com/sourcenetwork/defradb/tests/integration.executeRequest(0xc0008f38c8, {{0x0, 0x0}, {0x0, {0x0, 0x0}}, {0x0, 0x0}, {0x0, {0x0, ...}}, ...})
/home/andy/Projects/Source/defradb/tests/integration/utils.go:1853 +0x58c
github.com/sourcenetwork/defradb/tests/integration.performAction(0xc0008f38c8, 0x0?, {0x4a19f00, 0xc000eb2460})
/home/andy/Projects/Source/defradb/tests/integration/utils.go:391 +0xaa5
github.com/sourcenetwork/defradb/tests/integration.executeTestCase({_, }, {, }, {, _, _}, {{0x4c8f62b, 0x1f}, {0xc002040540, ...}, ...}, ...)
/home/andy/Projects/Source/defradb/tests/integration/utils.go:266 +0x1038
github.com/sourcenetwork/defradb/tests/integration.ExecuteTestCase({0x5888eb0, _}, {{0x4c8f62b, 0x1f}, {0xc002040540, 0x3, 0x3}, {0x0, {0x0, 0x0, ...}}, ...})
/home/andy/Projects/Source/defradb/tests/integration/utils.go:214 +0x7e5
github.com/sourcenetwork/defradb/tests/integration/query/simple.TestQuerySimpleWithCid(0xc0020349c0)
/home/andy/Projects/Source/defradb/tests/integration/query/simple/with_cid_test.go:78 +0x38d
testing.tRunner(0xc0020349c0, 0x505ad98)
/home/andy/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 1
/home/andy/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1742 +0x390
FAIL github.com/sourcenetwork/defradb/tests/integration/query/simple 0.110s

@AndrewSisley AndrewSisley added area/query Related to the query component bug Something isn't working labels Nov 6, 2024
AndrewSisley added a commit that referenced this issue Nov 8, 2024
## Relevant issue(s)

Resolves #3038

## Description

Adds support for branchable collections.

Does not add support for syncing the collection level commits via the
P2P system (broken out, lots of people working in the space, significant
changes required, I'm not so familiar with that part of the code so will
take longer). This does mean that the somewhat surprising (to me at
least) implementation of `Collection.Merge` is currently untested.

Commits are queriable via the `commits` GQL queries.

Time travel queries do not work due to an existing bug:
#3214 - once that bug is
fixed I expect there to be some more work (definitely testing) in order
to get it to work with branchable collections.

This is a breaking change due to the moving/namespacing of the existing
document headstore keys.
@AndrewSisley AndrewSisley self-assigned this Nov 18, 2024
@AndrewSisley AndrewSisley added this to the DefraDB v0.15 milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/query Related to the query component bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant