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

AssertFail in badger file on db close #1672

Closed
AndrewSisley opened this issue Jul 20, 2023 · 0 comments · Fixed by #1685
Closed

AssertFail in badger file on db close #1672

AndrewSisley opened this issue Jul 20, 2023 · 0 comments · Fixed by #1685
Assignees
Labels
area/testing Related to any test or testing suite bug Something isn't working
Milestone

Comments

@AndrewSisley
Copy link
Contributor

AndrewSisley commented Jul 20, 2023

Has started happening in the change detector recently, happens in TestQueryOneToOneWithGroupRelatedIDFromSecondary most (but not all) of the time. Removing the last query removes the assert fail.

Might be a badger bug, as they seem to have had issues in the past: dgraph-io/badger#1350

If the request in the test is modified:

This fails:

Request: `query {
	Book {
		name
	}
}`,

This works:

Request: `query {
	Author {
		name
	}
}`,
  • Removing either one of the Author create actions removes/hides the problem.
  • Removing lines 874-891 (where secondary id creation is handled) from collection.go has no impact.
  • Removing the Lens fetcher has no impact.
  • Updating to badger v4.1.0 has no impact
  • Exiting before calling fetcher.FetchNextDoc in scan node removes the error, suggesting that fetcher.Init and fetcher.Start are not relevant in this issue.
  • Exiting immediately after the FetchNext call in FetchNextDoc has no impact, suggesting FetchNext is responsible
  • Removing the filter stuff from FetchNext has no impact, suggesting it's irrelevance
  • Returning an error anywhere within the last 4 lines of fetcher.nextKey removes the assert failure
  • Calling nextKV 8 times results in the failure, calling it 7 times does not. The key on the 8th value is /1/v/bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6/v
  • Calling df.kvResultsIter.NextSync() in nextKVRaw a 9th time results in the problem, regardless of whether the value is ignored or not
@AndrewSisley AndrewSisley added bug Something isn't working area/testing Related to any test or testing suite labels Jul 20, 2023
@AndrewSisley AndrewSisley added this to the DefraDB v0.6 milestone Jul 20, 2023
@AndrewSisley AndrewSisley self-assigned this Jul 20, 2023
This was referenced Jul 20, 2023
fredcarle pushed a commit that referenced this issue Jul 20, 2023
## Relevant issue(s)

Because of #1672 

## Description

Disables test `TestQueryOneToOneWithGroupRelatedIDFromSecondary` so
other PRs can be merged before the release.
AndrewSisley added a commit that referenced this issue Jul 22, 2023
## Relevant issue(s)

Resolves #1672

## Description

Fixes invalid datastore state where somehow the iterator is not closed
properly, even though Close is called. I am guessing that something is
getting GC'd before it can be closed, as closing it immediately after
use appears to remove the issue.

Bug discovered testing with badger-file, but I cannot be sure where the
GC'd object is, and so it could be within the ipfs code, which could
mean other datastore implementations were exposed to this.

Fix is commit `Close iterator on spanDone` *only*, the others are small
improvements to the codebase I found along the way.
shahzadlone pushed a commit to shahzadlone/defradb that referenced this issue Feb 23, 2024
## Relevant issue(s)

Because of sourcenetwork#1672 

## Description

Disables test `TestQueryOneToOneWithGroupRelatedIDFromSecondary` so
other PRs can be merged before the release.
shahzadlone pushed a commit to shahzadlone/defradb that referenced this issue Feb 23, 2024
## Relevant issue(s)

Resolves sourcenetwork#1672

## Description

Fixes invalid datastore state where somehow the iterator is not closed
properly, even though Close is called. I am guessing that something is
getting GC'd before it can be closed, as closing it immediately after
use appears to remove the issue.

Bug discovered testing with badger-file, but I cannot be sure where the
GC'd object is, and so it could be within the ipfs code, which could
mean other datastore implementations were exposed to this.

Fix is commit `Close iterator on spanDone` *only*, the others are small
improvements to the codebase I found along the way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Related to any test or testing suite bug Something isn't working
Projects
None yet
1 participant