check / check (push) Failing after 3m28s
Vendor .golangci.yml byte-identical from sneak/prompts at cc440118 and move the Dockerfile lint phase to golangci-lint v2.14.0 by the digest REPO_POLICIES.md names. Fix the code to that config with flags, help text, output files, SQL and the order of steps unchanged; long functions are split into named steps. Judgement call: the extraction transaction is now rolled back on every early return; the old deferred rollback missed most failures and could dereference a nil transaction. Wording change: the reversed-range error reads "--from is after --to (--from X, --to Y)", since err113 requires a wrapped sentinel. Ten //nolint directives (gosec, unqueryvet), each with its reason. Model: opus-5-5
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Package bsdaily extracts single days of firehose data from the latest
|
|
// daily ZFS snapshot into zstd-compressed SQL dumps.
|
|
package bsdaily
|
|
|
|
import "regexp"
|
|
|
|
// Paths, file names and tuning for a run. They are set for one
|
|
// production host; see the README.
|
|
const (
|
|
SnapshotBase = "/srv/berlin.sneak.fs.blueskyarchive/.zfs/snapshot"
|
|
TmpBase = "/srv/storage/tmp"
|
|
DailiesBase = "/srv/berlin.sneak.fs.bluesky-dailies"
|
|
DBFilename = "firehose.db"
|
|
WALFilename = "firehose.db-wal"
|
|
SHMFilename = "firehose.db-shm"
|
|
|
|
// Disk space requirements
|
|
bytesPerGB = 1024 * 1024 * 1024
|
|
MinTmpFreeGB = 500
|
|
MinDailiesFreeGB = 20
|
|
MinTmpFreeBytes = MinTmpFreeGB * bytesPerGB
|
|
MinDailiesFreeBytes = MinDailiesFreeGB * bytesPerGB
|
|
|
|
// SQLite cache size in KB (200MB)
|
|
sqliteCacheSizeKB = 200000
|
|
|
|
// Compression level for zstd
|
|
zstdCompressionLevel = 15
|
|
|
|
// Verification sample lines
|
|
verificationHeadLines = 20
|
|
)
|
|
|
|
var snapshotPattern = regexp.MustCompile(
|
|
`^zfs-auto-snap_daily-(\d{4}-\d{2}-\d{2})-\d{4}$`)
|