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

Optimize computing reverse reindexing #4755

Merged
merged 1 commit into from
Feb 17, 2020
Merged

Conversation

mangalaman93
Copy link
Contributor

@mangalaman93 mangalaman93 commented Feb 10, 2020

We used to compute reverse count indexes twice while reindexing.
First, while computing reverse edges, and then later while explicitly
computing reverse count index. Now, we use a different function
while reindexing reverse edges and do not compute the reverse
count indexes.


This change is Reviewable

Docs Preview: Dgraph Preview

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ashish-goswami, @mangalaman93, @manishrjain, and @pawanrawal)


dgraph/cmd/alpha/reindex_test.go, line 140 at r1 (raw file):

  }`
	_, err := mutationWithTs(m1, "application/rdf", false, true, 0)
	require.NoError(t, err)

just for completeness sake, do the query here and verify there's an error due to the lack of an index.


posting/index.go, line 1010 at r1 (raw file):

				// we only need to build reverse index here.
				// We will update the reverse count index separately.

This can be one line.

We used to compute reverse count indexes twice while reindexing.
First, while computing reverse edges, and then later while explicitly
computing reverse count index. Now, we use a different function
while reindexing reverse edges and do not compute the reverse
count indexes.
Copy link
Contributor Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @ashish-goswami, @manishrjain, @martinmr, and @pawanrawal)


dgraph/cmd/alpha/reindex_test.go, line 140 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

just for completeness sake, do the query here and verify there's an error due to the lack of an index.

There are already tests that do this. In this test, I want to make sure that reindexing path as well as mutation both make correct changes to storage.


posting/index.go, line 1010 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…
				// we only need to build reverse index here.
				// We will update the reverse count index separately.

This can be one line.

It's fine, doesn't seem like a big deal to me.

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ashish-goswami, @martinmr, and @pawanrawal)

@mangalaman93 mangalaman93 merged commit 43aa310 into master Feb 17, 2020
@mangalaman93 mangalaman93 deleted the aman/optimization branch February 17, 2020 14:29
danielmai pushed a commit that referenced this pull request Oct 22, 2020
We used to compute reverse count indexes twice while reindexing.
First, while computing reverse edges, and then later while explicitly
computing reverse count index. Now, we use a different function
while reindexing reverse edges and do not compute the reverse
count indexes there any more.
danielmai pushed a commit that referenced this pull request Oct 22, 2020
We used to compute reverse count indexes twice while reindexing.
First, while computing reverse edges, and then later while explicitly
computing reverse count index. Now, we use a different function
while reindexing reverse edges and do not compute the reverse
count indexes there any more.
danielmai added a commit that referenced this pull request Oct 27, 2020
#6748)

Fixes the test OverwriteUidPredicatesReverse added in the previous PR #6746.

When updating a single uid predicate with a reverse index, the existing entry in the
reverse index should be deleted first.

Fixes DGRAPH-1738

(cherry picked from commit 5b70fe8)

* Remove context arguments.

* Optimize computing reverse reindexing (#4755)

We used to compute reverse count indexes twice while reindexing.
First, while computing reverse edges, and then later while explicitly
computing reverse count index. Now, we use a different function
while reindexing reverse edges and do not compute the reverse
count indexes there any more.

* fix(Dgraph): update reverse index when updating single UID predicates. (#5868)

When updating a single uid predicate with a reverse index, the existing entry in the
reverse index should be deleted first.

Fixes DGRAPH-1738

Co-authored-by: Martin Martinez Rivera <martinmr@dgraph.io>
Co-authored-by: Aman Mangal <aman@dgraph.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants