rqlite: readyz/freshness do not consider raft index
What version are you running? 8.19.0
Are you using Docker or Kubernetes to run your system? Neither: running rqlited directly.
Are you running a single node or a cluster? Single voter + read-only
What did you do?
- Launched a voter node:
./rqlite-v8.19.0-linux-amd64/rqlited -node-id 1 data1 - Imported a large (~10GB) SQLite database with
.bootin rqlite CLI - Launched a read-only node:
./rqlite-v8.19.0-linux-amd64/rqlited -raft-non-voter=true -http-addr=localhost:4011 -raft-addr=localhost:4012 -join=localhost:4002 data2 - Queried
curl -G 'localhost:4011/readyz?noleader'which returned[+]node ok - Queried
curl -G 'localhost:4011/readyz'which returned[+]node ok [+]leader ok [+]store ok - Queried
curl -G 'localhost:4011/db/query?level=none&freshness=1s' --data-urlencode 'q=SELECT * FROM table LIMIT 5'which returned{"results":[{"error":"no such table: table"}]}
Logs of interest on the read-only node:
[rqlited] 2024/02/06 00:25:38 node HTTP API available at http://localhost:4011
[rqlited] 2024/02/06 00:25:38 connect using the command-line tool via 'rqlite -H localhost -p 4011'
[raft] 2024/02/06 00:25:39 [WARN] failed to get previous log: previous-index=10 last-index=0 error="log not found"
[store] 2024/02/06 00:28:27 initiating node restore on node ID localhost:4012
[store] 2024/02/06 00:28:58 successfully opened database at /home/derouin/rqlite/data2/db.sqlite due to restore
[store] 2024/02/06 00:28:58 node restored in 31.508336751s
- I expected
/readyzto be able to consider the staleness of its raft log, either by default or with a parameter. In this case, it should not say “node ok” until the data was available locally. - I expected the SELECT query with
level=none&freshness=1sto return an error due to staleness. It seems likefreshnessis based on the last time the node contacted the leader, but I think the test should also look at the raft index.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 93 (62 by maintainers)
Commits related to this issue
- Update _index.md https://github.com/rqlite/rqlite/issues/1672 — committed to rqlite/rqlite.io by otoolep 3 years ago
- Store is "not ready" during a Restore from Snapshot https://github.com/rqlite/rqlite/issues/1672 — committed to rqlite/rqlite by otoolep 3 years ago
@aderouineau – thanks again for your help with this issue. With #1689 merged, I believe I’ve done as much as I can do here. If you have more ideas, let’ me know. I tested
/readyz?syncand it works as I hoped.