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

During startup, don't upsert initial schema if it already exists. #3374

Merged
merged 5 commits into from May 20, 2019

Conversation

@martinmr
Copy link
Member

commented May 3, 2019

Currently, there are lots of schema insertions during startup. This
change optimizes the insertion of the schema for the initial/reserved
predicates by only doing it if the predicate is not currently being
served by any group.

Tested by starting and stoping a container and looking at the logs.
Without this change, a lot of logs about schema changes are printed
after the stopped container is restarted. With the change, the amount of
logs is greatly reduced.


This change is Reviewable

Currently, there are lots of schema insertions during startup. This
change optimizes the insertion of the schema for the initial/reserved
predicates by only doing it if the predicate is not currently being
served by any group.

Tested by starting and stoping a container and looking at the logs.
Without this change, a lot of logs about schema changes are printed
after the stopped container is restarted. With the change, the amount of
logs is greatly reduced.
@martinmr martinmr requested review from manishrjain and dgraph-io/team as code owners May 3, 2019
worker/groups.go Outdated Show resolved Hide resolved
Copy link
Member Author

left a comment

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @golangcibot and @manishrjain)


worker/groups.go, line 187 at r1 (raw file):

Previously, golangcibot (Bot from GolangCI) wrote…

File is not goimports-ed (from goimports)

Done.

@gitlw
gitlw approved these changes May 7, 2019
Copy link
Contributor

left a comment

:lgtm:

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @golangcibot and @manishrjain)

Copy link
Member

left a comment

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @golangcibot and @martinmr)


worker/groups.go, line 193 at r2 (raw file):

		} else {
			// The schema for this predicate has already been proposed.
			continue

Add glog.V(1).Infof() here.

Copy link
Member Author

left a comment

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @golangcibot and @manishrjain)


worker/groups.go, line 193 at r2 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

Add glog.V(1).Infof() here.

Done.

@martinmr martinmr merged commit c92176a into master May 20, 2019
4 of 5 checks passed
4 of 5 checks passed
code-review/reviewable 1 file, 2 discussions left (golangcibot, manishrjain)
Details
Blockade (dgraph) TeamCity build finished
Details
CI (dgraph) TeamCity build finished
Details
GolangCI No issues found!
Details
license/cla Contributor License Agreement is signed.
Details
@martinmr martinmr deleted the martinmr/optimize-schema-upsert branch May 20, 2019
dna2github added a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
…raph-io#3374)

* During startup, don't upsert initial schema if it already exists.

Currently, there are lots of schema insertions during startup. This
change optimizes the insertion of the schema for the initial/reserved
predicates by only doing it if the predicate is not currently being
served by any group or the definition in storage is different from the
proposed schema.

Tested by starting and stoping a container and looking at the logs.
Without this change, a lot of logs about schema changes are printed
after the stopped container is restarted. With the change, the amount of
logs is greatly reduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.