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

fix(version): bump up dgraph version in source #8499

Closed
wants to merge 3 commits into from

Conversation

joshua-goldstein
Copy link
Contributor

@joshua-goldstein joshua-goldstein commented Dec 9, 2022

Problem

Dgraph version is hard coded in source. Currently it is still at 2103. This should be bumped up to the latest version. Thanks to @MichelDiz for noticing this issue.

Solution

Added todo's because we probably should not be hard coding this into source. We already pass the version in via ldflags, we could potentially use this instead.

@github-actions github-actions bot added the area/integrations Related to integrations with other projects. label Dec 9, 2022
@skrdgraph
Copy link
Contributor

Looks like some our backup worker code uses x.DgraphVersion .. good catch!

@coveralls
Copy link

coveralls commented Dec 9, 2022

Coverage Status

Coverage increased (+26.7%) to 64.016% when pulling e1b39e6 on joshua/dg-version into 70b8bd0 on main.

@@ -140,7 +140,8 @@ const (
"X-CSRF-Token, X-Auth-Token, X-Requested-With"
DgraphCostHeader = "Dgraph-TouchedUids"

DgraphVersion = 2103
// TODO: we should use ldflag in init.go (currently not exported) to set this version
DgraphVersion = 2200
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add this to the "Doing a Release" doc, basically just making sure this value is correct when the release is cut. But yeah, I agree in principle that it really should be pulling from the environment.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 ^ would it be possible to pull this info from the environment at build time instead?

@MichelDiz
Copy link
Contributor

Do we already know how we use this variable? My theory is that we use this in the "upgrade" subprogram.

@matthewmcneely
Copy link
Contributor

Actually this PR is not needed. The -X build tag in the Makefile here sets this variable at build time. @skrdgraph, I'm assuming the release pipeline still sets env DGRAPH_VERSION as expected.

Maybe a comment could be added just above to let future readers know that it's set at build time and/or set the value to sometime like 0? @skrdgraph, feel free to close this PR once you're satisfied the new release pipeline is setting up DGRAPH_VERSION correctly.

@skrdgraph
Copy link
Contributor

Actually this PR is not needed. The -X build tag in the Makefile here sets this variable at build time. @skrdgraph, I'm assuming the release pipeline still sets env DGRAPH_VERSION as expected.

Maybe a comment could be added just above to let future readers know that it's set at build time and/or set the value to sometime like 0? @skrdgraph, feel free to close this PR once you're satisfied the new release pipeline is setting up DGRAPH_VERSION correctly.

yeah ^ that makes sense.

In the release pipeline we obtain the version like this and this gets passed to the build step like this

I know that the dgraph version on the generated binary shows what we pass in the release pipeline. But regarding this PR, there was something more to this - @MichelDiz & @joshua-goldstein - we are voting to close this ... unless you remember how this came up ....

@MichelDiz
Copy link
Contributor

MichelDiz commented Jan 4, 2023

Guys, I think this is necessary. See

dgraph/x/x.go

Line 143 in 6f7a6d2

ManifestVersion = 2105

It was renamed to Manifest version. So this is related to internal files. In the case to Backup files.

The backward compatibility of the backup's manifest was broken by #7810, although the tool was added (#7815) that enables smooth migration of manifest.
This PR makes backup backward compatible, by updating the manifest(in-memory) after reading.

See the PR #7825

@MichelDiz
Copy link
Contributor

@matthewmcneely as far I undestood in the PRs related to this var. The -X build tag is irrelevant to this. It is related to backups and upgrades. So I think this variable needs attentio everytime we have a big change in the code that migh be breaking. Manually attention I mean. As its use has not been documented, we need to understand and document it.

@joshua-goldstein
Copy link
Contributor Author

joshua-goldstein commented Jan 4, 2023

@matthewmcneely @skrdgraph Please take a look at my inline comment in the PR. There is a file x/init.go that contains the strings that are set by ldflags. See here. But this version is not being used by the backup code. Backup code uses the hardcoded variable in x.go (see here). Only the capitalization differentiates the two variables.

@joshua-goldstein
Copy link
Contributor Author

joshua-goldstein commented Jan 4, 2023

Guys, I think this is necessary. See

dgraph/x/x.go

Line 143 in 6f7a6d2

ManifestVersion = 2105

It was renamed to Manifest version. So this is related to internal files. In the case to Backup files.

The backward compatibility of the backup's manifest was broken by #7810, although the tool was added (#7815) that enables smooth migration of manifest.
This PR makes backup backward compatible, by updating the manifest(in-memory) after reading.

See the PR #7825

@MichelDiz This is a good catch, I wasn't aware this was renamed at some point... Looks like that PR was merged into slash so presumably this will come up as we merge commits from slash into main.

@matthewmcneely
Copy link
Contributor

It was renamed to Manifest version. So this is related to internal files. In the case to Backup files.

@MichelDiz I think this tool (ee/updatemanifest) was removed, right?

@MichelDiz
Copy link
Contributor

@matthewmcneely Not sure, I never saw that tool. The backup and upgrades feels like isolated codes(subcommands) that wasn't well documented for future maintenance.

@matthewmcneely
Copy link
Contributor

Not sure, I never saw that tool. The backup and upgrades feels like isolated codes(subcommands) that wasn't well documented for future maintenance.

OK, but what I can verify is that the on the main branch with the current Makefile, that variable x.DgraphVersion is set by whatever is in the -X build flag.

@MichelDiz
Copy link
Contributor

MichelDiz commented Jan 5, 2023

@matthewmcneely correct, but it is a different variable. This one DgraphVersion is an exported variable, the one you're mentioning is in init.go which is private variable. That private one is set via -ldflags. If they are different, must be a reason for this.

@matthewmcneely
Copy link
Contributor

@matthewmcneely correct, but it is a different variable. This one DgraphVersion is an exported variable, the one you're mentioning is in init.go which is private variable. That private one is set via -ldflags. If they are different, must be a reason for this.

Ah right, sorry. So I guess the question remains, should this variable be set by an ldflag and not hardcoded? From what I can see, it's only used by worker/backup_ee.go::ProcessBackupRequest. Which I'm assuming we'd want that function to actually have a correct (current) version when it creates the backup Manifest.

@mangalaman93 mangalaman93 deleted the joshua/dg-version branch March 1, 2023 07:44
@skrdgraph
Copy link
Contributor

This was changed to ManifestVersion, this solves the current naming issues.

Please leave a comment while closing existing PRs / Issues (just for clarifications).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
22.0.2 area/integrations Related to integrations with other projects. v23.0.0-beta
Development

Successfully merging this pull request may close these issues.

6 participants