1
0
Fork 0

Merge pull request #1241 from rqlite/more-store-ready-checks

Check Store is ready in key places
master
Philip O'Toole 1 year ago committed by GitHub
commit 3583d3d973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@
### Implementation changes and bug fixes
- [PR #1239](https://github.com/rqlite/rqlite/pull/1239): Remove erroneous scaling factor from etcd and Consul reporting service.
- [PR #1240](https://github.com/rqlite/rqlite/pull/1240): Add support for controlling and reading Store readiness.
- [PR #1241](https://github.com/rqlite/rqlite/pull/1241): Check Store is ready in key places.
## 7.15.1 (April 29th 2023)
### Implementation changes and bug fixes

@ -34,6 +34,9 @@ var (
// ErrNotOpen is returned when a Store is not open.
ErrNotOpen = errors.New("store not open")
// ErrNotReady is returned when a Store is not ready to accept requests.
ErrNotReady = errors.New("store not ready")
// ErrNotLeader is returned when a node attempts to execute a leader-only
// operation.
ErrNotLeader = errors.New("not leader")
@ -783,6 +786,7 @@ func (s *Store) Stats() (map[string]interface{}, error) {
"node_id": leaderID,
"addr": leaderAddr,
},
"ready": s.Ready(),
"observer": map[string]uint64{
"observed": s.observer.GetNumObserved(),
"dropped": s.observer.GetNumDropped(),
@ -816,6 +820,10 @@ func (s *Store) Execute(ex *command.ExecuteRequest) ([]*command.ExecuteResult, e
if s.raft.State() != raft.Leader {
return nil, ErrNotLeader
}
if !s.Ready() {
return nil, ErrNotReady
}
return s.execute(ex)
}
@ -867,6 +875,10 @@ func (s *Store) Query(qr *command.QueryRequest) ([]*command.QueryRows, error) {
return nil, ErrNotLeader
}
if !s.Ready() {
return nil, ErrNotReady
}
b, compressed, err := s.reqMarshaller.Marshal(qr)
if err != nil {
return nil, err
@ -989,6 +1001,10 @@ func (s *Store) Load(lr *command.LoadRequest) error {
return ErrNotOpen
}
if !s.Ready() {
return ErrNotReady
}
startT := time.Now()
b, err := command.MarshalLoadRequest(lr)

Loading…
Cancel
Save