1
0
Fork 0

Merge pull request #1258 from rqlite/unified-stale-read-check

Add stale-read check to Store.Request()
master
Philip O'Toole 1 year ago committed by GitHub
commit e5b9a3d5be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -965,6 +965,10 @@ func (s *Store) Request(eqr *command.ExecuteQueryRequest) ([]*command.ExecuteQue
}
if !s.RequiresLeader(eqr) {
if eqr.Level == command.ExecuteQueryRequest_QUERY_REQUEST_LEVEL_NONE && eqr.Freshness > 0 &&
time.Since(s.raft.LastContact()).Nanoseconds() > eqr.Freshness {
return nil, ErrStaleRead
}
if eqr.Request.Transaction {
// Transaction requested during query, but not going through consensus. This means
// we need to block any database serialization during the query.

Loading…
Cancel
Save