1
0
Fork 0

Ensure table is created before shutting down

master
Philip O'Toole 8 months ago
parent c536bc9694
commit 2b3e829fc8

@ -14,6 +14,32 @@ import (
"github.com/rqlite/rqlite/v8/aws"
)
// stats captures stats for the Uploader service.
var stats *expvar.Map
var (
gzipMagic = []byte{0x1f, 0x8b, 0x08}
)
const (
numDownloadsOK = "num_downloads_ok"
numDownloadsFail = "num_downloads_fail"
numDownloadBytes = "download_bytes"
)
func init() {
stats = expvar.NewMap("downloader")
ResetStats()
}
// ResetStats resets the expvar stats for this module. Mostly for test purposes.
func ResetStats() {
stats.Init()
stats.Add(numDownloadsOK, 0)
stats.Add(numDownloadsFail, 0)
stats.Add(numDownloadBytes, 0)
}
// DownloadFile downloads the auto-restore file from the given URL, and returns the path to
// the downloaded file. If the download fails, and the config is marked as continue-on-failure, then
// the error is returned, but errOK is set to true. If the download fails, and the file is not
@ -64,32 +90,6 @@ type StorageClient interface {
fmt.Stringer
}
// stats captures stats for the Uploader service.
var stats *expvar.Map
var (
gzipMagic = []byte{0x1f, 0x8b, 0x08}
)
const (
numDownloadsOK = "num_downloads_ok"
numDownloadsFail = "num_downloads_fail"
numDownloadBytes = "download_bytes"
)
func init() {
stats = expvar.NewMap("downloader")
ResetStats()
}
// ResetStats resets the expvar stats for this module. Mostly for test purposes.
func ResetStats() {
stats.Init()
stats.Add(numDownloadsOK, 0)
stats.Add(numDownloadsFail, 0)
stats.Add(numDownloadBytes, 0)
}
type Downloader struct {
storageClient StorageClient
logger *log.Logger

@ -150,6 +150,8 @@ class TestAutoRestoreS3(unittest.TestCase):
n0.start()
n0.wait_for_ready()
n0.execute('CREATE TABLE bar (id INTEGER NOT NULL PRIMARY KEY, name TEXT)')
j = n1.query('SELECT * FROM bar', level='strong')
self.assertEqual(j, d_("{'results': [{'types': ['integer', 'text'], 'columns': ['id', 'name']}]}"))
n0.stop()
# Create a new node, using the directory from the previous node, but check

Loading…
Cancel
Save