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: compilation on 32bit #8895

Merged
merged 2 commits into from
Jul 13, 2023
Merged

fix: compilation on 32bit #8895

merged 2 commits into from
Jul 13, 2023

Conversation

wmillers
Copy link
Contributor

@wmillers wmillers commented Jul 5, 2023

Fix compilation on 32bit machine

@CLAassistant
Copy link

CLAassistant commented Jul 5, 2023

CLA assistant check
All committers have signed the CLA.

@dgraph-bot dgraph-bot added area/core internal mechanisms go Pull requests that update Go code labels Jul 5, 2023
@mangalaman93
Copy link
Contributor

@wmillers Thanks for the PR. Two questions: 1. why are you using a 32 bit machine still? 2. Why does this create problems on a 32 bit machine?

@wmillers
Copy link
Contributor Author

wmillers commented Jul 6, 2023

@mangalaman93

  1. I need to run dgraph on a 32-bit system as part of my program.
  2. When passing constants that exceed the range of int on a 32-bit system during compilation, the following error occurs:
# github.com/dgraph-io/dgraph/xidmap
..\xidmap\trie.go:38:49: cannot use math.MaxUint32 (untyped int constant 4294967295) as int value in argument to z.NewBuffer(32 << 20, "Trie").WithMaxSize (overflows)
# github.com/dgraph-io/dgraph/worker
..\worker\restore_reduce.go:39:23: cannot use 2 << 30 (untyped int constant 2147483648) as int value in constant declaration (overflows)
..\worker\queue.go:305:42: cannot use math.MaxUint32 (untyped int constant 4294967295) as int value in argument to t.rng.Intn (overflows)

The WithMaxSize function (so as Intn) expects an argument of type int, and on a 32-bit system, the maximum allowed value is 2 << 30 - 1, which is math.MaxInt32.

@mangalaman93
Copy link
Contributor

@mangalaman93

1. I need to run dgraph on a 32-bit system as part of my program.

2. When passing constants that exceed the range of int on a 32-bit system during compilation, the following error occurs:
# github.com/dgraph-io/dgraph/xidmap
..\xidmap\trie.go:38:49: cannot use math.MaxUint32 (untyped int constant 4294967295) as int value in argument to z.NewBuffer(32 << 20, "Trie").WithMaxSize (overflows)
# github.com/dgraph-io/dgraph/worker
..\worker\restore_reduce.go:39:23: cannot use 2 << 30 (untyped int constant 2147483648) as int value in constant declaration (overflows)
..\worker\queue.go:305:42: cannot use math.MaxUint32 (untyped int constant 4294967295) as int value in argument to t.rng.Intn (overflows)

The WithMaxSize function (so as Intn) expects an argument of type int, and on a 32-bit system, the maximum allowed value is 2 << 30 - 1, which is math.MaxInt32.

Make sense. I am still wondering what machine you are planning to run that is still 32 bit. In any case, just one suggestion to this PR and we would be happy to merge it. Thanks for answering the questions.

worker/queue.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sanjayk-github-dev sanjayk-github-dev left a comment

Choose a reason for hiding this comment

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

LGTM

@mangalaman93 mangalaman93 merged commit 0cea60d into dgraph-io:main Jul 13, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core internal mechanisms go Pull requests that update Go code
Development

Successfully merging this pull request may close these issues.

5 participants