From 300a3a0e258d6731f032bc0fc0926ce29031e79e Mon Sep 17 00:00:00 2001 From: parasssh Date: Wed, 2 Sep 2020 10:00:51 -0700 Subject: [PATCH 1/3] sentry nil pointer check --- edgraph/server.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/edgraph/server.go b/edgraph/server.go index 2132807983a..e9e6d1fe948 100644 --- a/edgraph/server.go +++ b/edgraph/server.go @@ -495,8 +495,12 @@ func (s *Server) doMutate(ctx context.Context, qc *queryContext, resp *api.Respo if x.WorkerConfig.LudicrousMode { // Mutations are automatically committed in case of ludicrous mode, so we don't // need to manually commit. - resp.Txn.Keys = resp.Txn.Keys[:0] - resp.Txn.CommitTs = qc.req.StartTs + if resp.Txn != nil { + resp.Txn.Keys = resp.Txn.Keys[:0] + resp.Txn.CommitTs = qc.req.StartTs + } else { + errors.Wrapf(err, "Txn Context is nil") + } return err } From 164dcb845f940f525b182f91f7ef8fab3a5b4138 Mon Sep 17 00:00:00 2001 From: parasssh Date: Wed, 2 Sep 2020 10:11:13 -0700 Subject: [PATCH 2/3] minor --- edgraph/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edgraph/server.go b/edgraph/server.go index e9e6d1fe948..07cf5529985 100644 --- a/edgraph/server.go +++ b/edgraph/server.go @@ -499,7 +499,7 @@ func (s *Server) doMutate(ctx context.Context, qc *queryContext, resp *api.Respo resp.Txn.Keys = resp.Txn.Keys[:0] resp.Txn.CommitTs = qc.req.StartTs } else { - errors.Wrapf(err, "Txn Context is nil") + return errors.Wrapf(err, "Txn Context is nil") } return err } From 9eeda821c256c2d5fab166169db2eb6758f6f232 Mon Sep 17 00:00:00 2001 From: parasssh Date: Wed, 2 Sep 2020 10:13:05 -0700 Subject: [PATCH 3/3] minor --- edgraph/server.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/edgraph/server.go b/edgraph/server.go index 07cf5529985..1e4678972ee 100644 --- a/edgraph/server.go +++ b/edgraph/server.go @@ -495,12 +495,11 @@ func (s *Server) doMutate(ctx context.Context, qc *queryContext, resp *api.Respo if x.WorkerConfig.LudicrousMode { // Mutations are automatically committed in case of ludicrous mode, so we don't // need to manually commit. - if resp.Txn != nil { - resp.Txn.Keys = resp.Txn.Keys[:0] - resp.Txn.CommitTs = qc.req.StartTs - } else { + if resp.Txn == nil { return errors.Wrapf(err, "Txn Context is nil") } + resp.Txn.Keys = resp.Txn.Keys[:0] + resp.Txn.CommitTs = qc.req.StartTs return err }