@@ -71,11 +71,11 @@ type applierV3 interface {
7171 // delegates the actual execution to the applyFunc method.
7272 Apply (r * pb.InternalRaftRequest , shouldApplyV3 membership.ShouldApplyV3 , applyFunc applyFunc ) * Result
7373
74- Put (p * pb.PutRequest ) (* pb.PutResponse , * traceutil. Trace , error )
75- Range (r * pb.RangeRequest ) (* pb.RangeResponse , * traceutil. Trace , error )
76- DeleteRange (dr * pb.DeleteRangeRequest ) (* pb.DeleteRangeResponse , * traceutil. Trace , error )
77- Txn (rt * pb.TxnRequest ) (* pb.TxnResponse , * traceutil. Trace , error )
78- Compaction (compaction * pb.CompactionRequest ) (* pb.CompactionResponse , <- chan struct {}, * traceutil. Trace , error )
74+ Put (ctx context. Context , p * pb.PutRequest ) (* pb.PutResponse , error )
75+ Range (ctx context. Context , r * pb.RangeRequest ) (* pb.RangeResponse , error )
76+ DeleteRange (ctx context. Context , dr * pb.DeleteRangeRequest ) (* pb.DeleteRangeResponse , error )
77+ Txn (ctx context. Context , rt * pb.TxnRequest ) (* pb.TxnResponse , error )
78+ Compaction (ctx context. Context , compaction * pb.CompactionRequest ) (* pb.CompactionResponse , <- chan struct {}, error )
7979
8080 LeaseGrant (lc * pb.LeaseGrantRequest ) (* pb.LeaseGrantResponse , error )
8181 LeaseRevoke (lc * pb.LeaseRevokeRequest ) (* pb.LeaseRevokeResponse , error )
@@ -142,37 +142,37 @@ func (a *applierV3backend) Apply(r *pb.InternalRaftRequest, shouldApplyV3 member
142142 return applyFunc (r , shouldApplyV3 )
143143}
144144
145- func (a * applierV3backend ) Put (p * pb.PutRequest ) (resp * pb.PutResponse , trace * traceutil. Trace , err error ) {
146- return mvcctxn .Put (context . TODO () , a .options .Logger , a .options .Lessor , a .options .KV , p )
145+ func (a * applierV3backend ) Put (ctx context. Context , p * pb.PutRequest ) (resp * pb.PutResponse , err error ) {
146+ return mvcctxn .Put (ctx , a .options .Logger , a .options .Lessor , a .options .KV , p )
147147}
148148
149- func (a * applierV3backend ) DeleteRange (dr * pb.DeleteRangeRequest ) (* pb.DeleteRangeResponse , * traceutil. Trace , error ) {
150- return mvcctxn .DeleteRange (context . TODO () , a .options .Logger , a .options .KV , dr )
149+ func (a * applierV3backend ) DeleteRange (ctx context. Context , dr * pb.DeleteRangeRequest ) (* pb.DeleteRangeResponse , error ) {
150+ return mvcctxn .DeleteRange (ctx , a .options .Logger , a .options .KV , dr )
151151}
152152
153- func (a * applierV3backend ) Range (r * pb.RangeRequest ) (* pb.RangeResponse , * traceutil. Trace , error ) {
154- return mvcctxn .Range (context . TODO () , a .options .Logger , a .options .KV , r )
153+ func (a * applierV3backend ) Range (ctx context. Context , r * pb.RangeRequest ) (* pb.RangeResponse , error ) {
154+ return mvcctxn .Range (ctx , a .options .Logger , a .options .KV , r )
155155}
156156
157- func (a * applierV3backend ) Txn (rt * pb.TxnRequest ) (* pb.TxnResponse , * traceutil. Trace , error ) {
158- return mvcctxn .Txn (context . TODO () , a .options .Logger , rt , a .options .TxnModeWriteWithSharedBuffer , a .options .KV , a .options .Lessor )
157+ func (a * applierV3backend ) Txn (ctx context. Context , rt * pb.TxnRequest ) (* pb.TxnResponse , error ) {
158+ return mvcctxn .Txn (ctx , a .options .Logger , rt , a .options .TxnModeWriteWithSharedBuffer , a .options .KV , a .options .Lessor )
159159}
160160
161- func (a * applierV3backend ) Compaction (compaction * pb.CompactionRequest ) (* pb.CompactionResponse , <- chan struct {}, * traceutil. Trace , error ) {
161+ func (a * applierV3backend ) Compaction (ctx context. Context , compaction * pb.CompactionRequest ) (* pb.CompactionResponse , <- chan struct {}, error ) {
162162 resp := & pb.CompactionResponse {}
163163 resp .Header = & pb.ResponseHeader {}
164- ctx , trace := traceutil .EnsureTrace (context . TODO () , a .options .Logger , "compact" ,
164+ ctx , trace := traceutil .EnsureTrace (ctx , a .options .Logger , "compact" ,
165165 traceutil.Field {Key : "revision" , Value : compaction .Revision },
166166 )
167167
168168 ch , err := a .options .KV .Compact (trace , compaction .Revision )
169169 if err != nil {
170- return nil , ch , nil , err
170+ return nil , ch , err
171171 }
172172 // get the current revision. which key to get is not important.
173173 rr , _ := a .options .KV .Range (ctx , []byte ("compaction" ), nil , mvcc.RangeOptions {})
174174 resp .Header .Revision = rr .Rev
175- return resp , ch , trace , err
175+ return resp , ch , err
176176}
177177
178178func (a * applierV3backend ) LeaseGrant (lc * pb.LeaseGrantRequest ) (* pb.LeaseGrantResponse , error ) {
@@ -239,15 +239,15 @@ type applierV3Capped struct {
239239// with Puts so that the number of keys in the store is capped.
240240func newApplierV3Capped (base applierV3 ) applierV3 { return & applierV3Capped {applierV3 : base } }
241241
242- func (a * applierV3Capped ) Put (_ * pb.PutRequest ) (* pb.PutResponse , * traceutil. Trace , error ) {
243- return nil , nil , errors .ErrNoSpace
242+ func (a * applierV3Capped ) Put (_ context. Context , _ * pb.PutRequest ) (* pb.PutResponse , error ) {
243+ return nil , errors .ErrNoSpace
244244}
245245
246- func (a * applierV3Capped ) Txn (r * pb.TxnRequest ) (* pb.TxnResponse , * traceutil. Trace , error ) {
246+ func (a * applierV3Capped ) Txn (ctx context. Context , r * pb.TxnRequest ) (* pb.TxnResponse , error ) {
247247 if a .q .Cost (r ) > 0 {
248- return nil , nil , errors .ErrNoSpace
248+ return nil , errors .ErrNoSpace
249249 }
250- return a .applierV3 .Txn (r )
250+ return a .applierV3 .Txn (ctx , r )
251251}
252252
253253func (a * applierV3Capped ) LeaseGrant (_ * pb.LeaseGrantRequest ) (* pb.LeaseGrantResponse , error ) {
@@ -431,22 +431,22 @@ func newQuotaApplierV3(lg *zap.Logger, quotaBackendBytesCfg int64, be backend.Ba
431431 return & quotaApplierV3 {app , serverstorage .NewBackendQuota (lg , quotaBackendBytesCfg , be , "v3-applier" )}
432432}
433433
434- func (a * quotaApplierV3 ) Put (p * pb.PutRequest ) (* pb.PutResponse , * traceutil. Trace , error ) {
434+ func (a * quotaApplierV3 ) Put (ctx context. Context , p * pb.PutRequest ) (* pb.PutResponse , error ) {
435435 ok := a .q .Available (p )
436- resp , trace , err := a .applierV3 .Put (p )
436+ resp , err := a .applierV3 .Put (ctx , p )
437437 if err == nil && ! ok {
438438 err = errors .ErrNoSpace
439439 }
440- return resp , trace , err
440+ return resp , err
441441}
442442
443- func (a * quotaApplierV3 ) Txn (rt * pb.TxnRequest ) (* pb.TxnResponse , * traceutil. Trace , error ) {
443+ func (a * quotaApplierV3 ) Txn (ctx context. Context , rt * pb.TxnRequest ) (* pb.TxnResponse , error ) {
444444 ok := a .q .Available (rt )
445- resp , trace , err := a .applierV3 .Txn (rt )
445+ resp , err := a .applierV3 .Txn (ctx , rt )
446446 if err == nil && ! ok {
447447 err = errors .ErrNoSpace
448448 }
449- return resp , trace , err
449+ return resp , err
450450}
451451
452452func (a * quotaApplierV3 ) LeaseGrant (lc * pb.LeaseGrantRequest ) (* pb.LeaseGrantResponse , error ) {
0 commit comments