Skip to content

Commit

Permalink
fix(flag): fix bulk loader flag and remove flag parsing from critical…
Browse files Browse the repository at this point in the history
… path (#7679)
  • Loading branch information
NamanJain8 authored and aman-bansal committed Apr 8, 2021
1 parent 26faedc commit eda10f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions dgraph/cmd/alpha/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ func run() {
HmacSecret: opts.HmacSecret,
Audit: opts.Audit != nil,
Badger: badger,
MaxRetries: badger.GetInt64("max-retries"),
}
x.WorkerConfig.Parse(Alpha.Conf)

Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var Bulk x.SubCommand
var defaultOutDir = "./out"

const BulkBadgerDefaults = "compression=snappy; goroutines=8;" +
" cache_mb=64; cache_percentage=70,30;"
" cache-mb=64; cache-percentage=70,30;"

func init() {
Bulk.Cmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ func (n *node) commitOrAbort(pkey uint64, delta *pb.OracleDelta) error {
return
}
txn.Update()
err := x.RetryUntilSuccess(int(x.WorkerConfig.Badger.GetInt64("max-retries")),
err := x.RetryUntilSuccess(int(x.WorkerConfig.MaxRetries),
10*time.Millisecond, func() error {
err := txn.CommitToDisk(writer, commit)
if err == badger.ErrBannedKey {
Expand Down
3 changes: 3 additions & 0 deletions x/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ type WorkerOptions struct {
HmacSecret Sensitive
// AbortOlderThan tells Dgraph to discard transactions that are older than this duration.
AbortOlderThan time.Duration
// MaxRetries indicates the number of retries Dgraph do to prevent locking the worker in a
// failed state.
MaxRetries int64
// ProposedGroupId will be used if there's a file in the p directory called group_id with the
// proposed group ID for this server.
ProposedGroupId uint32
Expand Down

0 comments on commit eda10f7

Please sign in to comment.