Skip to content

Commit

Permalink
Fix inconsistent etcd read
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud authored and brandond committed Sep 16, 2021
1 parent 39523fd commit df45a2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ func (s *store) List(ctx context.Context, key string, opts storage.ListOptions,
// indicate to the client which resource version was returned
if returnedRV == 0 {
returnedRV = getResp.Header.Revision
// if returnedRV was not set previously then WithRev option was not either, so set here in case
// hasMore is true and we do a subsequent Get. If we don't set this the next Get may give
// back inconsistent data because we are Get-ing the latest data and not at a specific revision
options = append(options, clientv3.WithRev(returnedRV))
}

// no more results remain or we didn't request paging
Expand Down

0 comments on commit df45a2c

Please sign in to comment.