Skip to content

Fix compilation issue on 32 bit machine #4963

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

Merged
merged 1 commit into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions conn/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ import (
"sync/atomic"
"time"

"github.com/dgraph-io/badger/v2/y"
"github.com/dgraph-io/dgo/v2/protos/api"
"github.com/dgraph-io/dgraph/protos/pb"
"github.com/dgraph-io/dgraph/raftwal"
"github.com/dgraph-io/dgraph/x"
"github.com/golang/glog"
"github.com/pkg/errors"
"go.etcd.io/etcd/raft"
"go.etcd.io/etcd/raft/raftpb"
otrace "go.opencensus.io/trace"

"github.com/dgraph-io/badger/v2/y"
"github.com/dgraph-io/dgo/v2/protos/api"
"github.com/dgraph-io/dgraph/protos/pb"
"github.com/dgraph-io/dgraph/raftwal"
"github.com/dgraph-io/dgraph/x"
)

var (
Expand All @@ -48,6 +49,12 @@ var (
type Node struct {
x.SafeMutex

// Applied is used to keep track of the applied RAFT proposals.
// The stages are proposed -> committed (accepted by cluster) ->
// applied (to PL) -> synced (to BadgerDB).
// This needs to be 64 bit aligned for atomics to work on 32 bit machine.
Applied y.WaterMark

joinLock sync.Mutex

// Used to keep track of lin read requests.
Expand All @@ -70,10 +77,6 @@ type Node struct {
Rand *rand.Rand

Proposals proposals
// applied is used to keep track of the applied RAFT proposals.
// The stages are proposed -> committed (accepted by cluster) ->
// applied (to PL) -> synced (to BadgerDB).
Applied y.WaterMark

heartbeatsOut int64
heartbeatsIn int64
Expand Down
1 change: 1 addition & 0 deletions dgraph/cmd/alpha/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ func run() {
AbortOlderThan: abortDur,
StartTime: startTime,
LudicrousMode: Alpha.Conf.GetBool("ludicrous_mode"),
BadgerKeyFile: worker.Config.BadgerKeyFile,
}

setupCustomTokenizers()
Expand Down
6 changes: 3 additions & 3 deletions posting/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v2/options"
bpb "github.com/dgraph-io/badger/v2/pb"
"github.com/dgraph-io/dgraph/ee/enc"
"github.com/dgraph-io/dgraph/protos/pb"
"github.com/dgraph-io/dgraph/schema"
"github.com/dgraph-io/dgraph/tok"
Expand Down Expand Up @@ -546,13 +547,12 @@ func (r *rebuilder) Run(ctx context.Context) error {

dbOpts := badger.DefaultOptions(tmpIndexDir).
WithSyncWrites(false).
WithNumVersionsToKeep(math.MaxInt64).
WithNumVersionsToKeep(math.MaxInt32).
WithLogger(&x.ToGlog{}).
WithCompression(options.None).
WithEventLogging(false).
WithLogRotatesToFlush(10).
WithMaxCacheSize(50) // TODO(Aman): Disable cache altogether

WithEncryptionKey(enc.ReadEncryptionKeyFile(x.WorkerConfig.BadgerKeyFile))
tmpDB, err := badger.OpenManaged(dbOpts)
if err != nil {
return errors.Wrap(err, "error opening temp badger for reindexing")
Expand Down
6 changes: 4 additions & 2 deletions worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ import (
)

type node struct {
// This needs to be 64 bit aligned for atomics to work on 32 bit machine.
pendingSize int64

// embedded struct
*conn.Node

// Fields which are never changed after init.
Expand All @@ -66,8 +70,6 @@ type node struct {
canCampaign bool
elog trace.EventLog

pendingSize int64

ex *executor
}

Expand Down
2 changes: 2 additions & 0 deletions x/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type WorkerOptions struct {
StartTime time.Time
// LudicrousMode is super fast mode with fewer guarantees.
LudicrousMode bool
// BadgerKeyFile is the file containing the key used for encryption. Enterprise only feature.
BadgerKeyFile string
}

// WorkerConfig stores the global instance of the worker package's options.
Expand Down
4 changes: 2 additions & 2 deletions x/x.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ const (
Star = "_STAR_ALL"

// GrpcMaxSize is the maximum possible size for a gRPC message.
// Dgraph uses the maximum size for the most flexibility (4GB - equal
// Dgraph uses the maximum size for the most flexibility (2GB - equal
// to the max grpc frame size). Users will still need to set the max
// message sizes allowable on the client size when dialing.
GrpcMaxSize = 4 << 30
GrpcMaxSize = math.MaxInt32

// PortZeroGrpc is the default gRPC port for zero.
PortZeroGrpc = 5080
Expand Down