1
0
Fork 0

Merge pull request #1325 from rqlite/handle-db-stats-error

Detect DB stats error and log
master
Philip O'Toole 1 year ago committed by GitHub
commit 8444c1b748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@
- [PR #1321](https://github.com/rqlite/rqlite/pull/1321): Check for errors in responses during load testing.
- [PR #1323](https://github.com/rqlite/rqlite/pull/1323): Add codec for v2 snapshots.
- [PR #1324](https://github.com/rqlite/rqlite/pull/1324): Close Snapshot after we're finished restoring from it.
- [PR #1325](https://github.com/rqlite/rqlite/pull/1325): Handle getting an error when asking for database stats.
## 7.21.1 (June 26th 2023)
This release changes the mode of SQLite, when rqlite is running in _on-disk_ mode. SQLite now runs in WAL mode, when previously it was in DELETE mode. Testing shows this results in a ~30% increase in write-performance.

@ -515,6 +515,9 @@ func (db *DB) Size() (int64, error) {
if err != nil {
return 0, err
}
if rows[0].Error != "" {
return 0, fmt.Errorf(rows[0].Error)
}
return rows[0].Values[0].Parameters[0].GetI(), nil
}
@ -1298,6 +1301,9 @@ func (db *DB) memStats() (map[string]int64, error) {
if err != nil {
return nil, err
}
if res[0].Error != "" {
return nil, fmt.Errorf(res[0].Error)
}
ms[p] = res[0].Values[0].Parameters[0].GetI()
}
return ms, nil

@ -95,6 +95,7 @@ const (
numJoins = "num_joins"
numIgnoredJoins = "num_ignored_joins"
numRemovedBeforeJoins = "num_removed_before_joins"
numDBStatsErrors = "num_db_stats_errors"
snapshotCreateDuration = "snapshot_create_duration"
snapshotPersistDuration = "snapshot_persist_duration"
snapshotDBSerializedSize = "snapshot_db_serialized_size"
@ -130,6 +131,7 @@ func ResetStats() {
stats.Add(numJoins, 0)
stats.Add(numIgnoredJoins, 0)
stats.Add(numRemovedBeforeJoins, 0)
stats.Add(numDBStatsErrors, 0)
stats.Add(snapshotCreateDuration, 0)
stats.Add(snapshotPersistDuration, 0)
stats.Add(snapshotDBSerializedSize, 0)
@ -846,7 +848,8 @@ func (s *Store) Stats() (map[string]interface{}, error) {
}()
dbStatus, err := s.db.Stats()
if err != nil {
return nil, err
stats.Add(numDBStatsErrors, 1)
s.logger.Printf("failed to get database stats: %s", err.Error())
}
nodes, err := s.Nodes()

Loading…
Cancel
Save