diff --git a/CHANGELOG.md b/CHANGELOG.md index bc058daf..92307431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 6.2.0 (unreleased) +## 6.2.0 (August 18th 2021) ### New features - [PR #851](https://github.com/rqlite/rqlite/pull/851), [PR #855](https://github.com/rqlite/rqlite/pull/855): rqlite CLI properly supports PRAGMA directives. - [PR #853](https://github.com/rqlite/rqlite/pull/853): Support enabling Foreign Key constraints via command-line options. @@ -7,6 +7,7 @@ ### Implementation changes and bug fixes - [PR #857](https://github.com/rqlite/rqlite/pull/857): Use Protobufs as core data model. - [PR #858](https://github.com/rqlite/rqlite/pull/858): Create dedicated client for talking to a cluster service. +- [PR #862](https://github.com/rqlite/rqlite/pull/862): Add detailed SQLite memory statistics to status output. ## 6.1.0 (August 5th 2021) This release makes significant changes to SQLite database connection handling, resulting in proper support for high-performance concurrent reads of in-memory databases (an in-memory SQLite database is the default option for rqlite). diff --git a/appveyor.yml b/appveyor.yml index 9f03a3e2..cf1b4794 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,7 @@ build_script: - go version - go get ./... - go build -i ./... - - go test -v ./... + - go test ./... after_build: - 7z a rqlite-latest-win64.zip %GOPATH%\bin\rq*.exe diff --git a/db/db.go b/db/db.go index 7809e3bf..71294ed3 100644 --- a/db/db.go +++ b/db/db.go @@ -260,6 +260,10 @@ func (db *DB) Stats() (map[string]interface{}, error) { if err != nil { return nil, err } + memStats, err := db.memStats() + if err != nil { + return nil, err + } connPoolStats := map[string]interface{}{ "ro": db.ConnectionPoolStats(db.roDB), "rw": db.ConnectionPoolStats(db.rwDB), @@ -271,6 +275,7 @@ func (db *DB) Stats() (map[string]interface{}, error) { stats := map[string]interface{}{ "version": DBVersion, "compile_options": copts, + "mem_stats": memStats, "db_size": dbSz, "rw_dsn": string(db.rwDSN), "ro_dsn": db.roDSN, @@ -742,6 +747,26 @@ func (db *DB) Dump(w io.Writer) error { return nil } +func (db *DB) memStats() (map[string]int64, error) { + ms := make(map[string]int64) + for _, p := range []string{ + "max_page_count", + "page_count", + "page_size", + "hard_heap_limit", + "soft_heap_limit", + "cache_size", + "freelist_count", + } { + res, err := db.QueryStringStmt(fmt.Sprintf("PRAGMA %s", p)) + if err != nil { + return nil, err + } + ms[p] = res[0].Values[0].Parameters[0].GetI() + } + return ms, nil +} + func copyDatabase(dst *DB, src *DB) error { dstConn, err := dst.rwDB.Conn(context.Background()) if err != nil { diff --git a/vagrant_setup.sh b/vagrant_setup.sh index c315bb9c..e0cec356 100755 --- a/vagrant_setup.sh +++ b/vagrant_setup.sh @@ -9,8 +9,8 @@ apt-get install -y curl git bison make mercurial # Go bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) source ~/.gvm/scripts/gvm -gvm install go1.14 -gvm use go1.14 +gvm install go1.16 +gvm use go1.16 # rqlite mkdir -p rqlite