From 5f08f2839a5ecb4927aae14551aeff4266b3b3a2 Mon Sep 17 00:00:00 2001 From: shivaji-dgraph Date: Tue, 14 May 2024 13:14:06 +0530 Subject: [PATCH] fix pending query --- tok/hnsw/helper.go | 5 +++-- worker/draft.go | 4 +++- worker/mutation.go | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tok/hnsw/helper.go b/tok/hnsw/helper.go index f42431a9143..033ef40a99d 100644 --- a/tok/hnsw/helper.go +++ b/tok/hnsw/helper.go @@ -433,9 +433,10 @@ func (ph *persistentHNSW[T]) createEntryAndStartNodes( err := ph.getVecFromUid(entry, c, vec) if err != nil || len(*vec) == 0 { // The entry vector has been deleted. We have to create a new entry vector. - entry, err := ph.PickStartNode(ctx, c, vec) + entry, err := ph.calculateNewEntryVec(ctx, c, vec) if err != nil { - return 0, []*index.KeyValue{}, err + // No other node exists, go with the new node that has come + return create_edges(inUuid) } return create_edges(entry) } diff --git a/worker/draft.go b/worker/draft.go index da0d278aee3..a3027024dec 100644 --- a/worker/draft.go +++ b/worker/draft.go @@ -843,7 +843,9 @@ func (n *node) commitOrAbort(pkey uint64, delta *pb.OracleDelta) error { if txn == nil { return } - txn.Update() + if commit != 0 { + txn.Update() + } // We start with 20 ms, so that we end up waiting 5 mins by the end. // If there is any transient issue, it should get fixed within that timeframe. err := x.ExponentialRetry(int(x.Config.MaxRetries), diff --git a/worker/mutation.go b/worker/mutation.go index abae1515dde..7ebd3cb0deb 100644 --- a/worker/mutation.go +++ b/worker/mutation.go @@ -950,7 +950,9 @@ func (w *grpcWorker) proposeAndWait(ctx context.Context, txnCtx *api.TxnContext, node := groups().Node err := node.proposeAndWait(ctx, &pb.Proposal{Mutations: m}) - fillTxnContext(txnCtx, m.StartTs) + if err == nil { + fillTxnContext(txnCtx, m.StartTs) + } return err }