A cap on the catalog's NVMe size: above it only the tail and the stored ranges
After reset 24 the catalog grew ~3.7 GB an hour (77 GB, root 31 GB free, 600k history ranges to go). CATALOG_MAX_NVME_GB (as voyager 1's BACKFILL_MAX_NVME_GB): once the default tablespace is over it, leases and the prefetcher take priority < 0 only (the tail, the stored ranges); measured once a minute. Off when unset; 90 on homelab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eddbe2863f
commit
256fb24c46
6 files changed
+74
-2
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import db from '@adonisjs/lucid/services/db'
|
||||
import logger from '@adonisjs/core/services/logger'
|
||||
import coordinatorConfig from '#config/coordinator'
|
||||
|
||||
/** How often the catalog's size is measured (pg_tablespace_size walks its files). */
|
||||
const CHECK_MS = 60_000
|
||||
|
||||
/**
|
||||
* The catalog's room on the NVMe (CATALOG_MAX_NVME_GB, like voyager 1's
|
||||
* BACKFILL_MAX_NVME_GB): once its tablespace (the database's
|
||||
* default_tablespace) is over the cap, only the tail and the stored ranges
|
||||
* (priority below 0) are leased and prefetched, and history waits. After
|
||||
* reset 24 the catalog grew ~3.7 GB an hour, root down to 31 GB free with
|
||||
* 600k history ranges to go (LOG.md 2026-10-14 (53)). Off when unset.
|
||||
*/
|
||||
class CatalogSpace {
|
||||
private checkedAt = 0
|
||||
private over = false
|
||||
|
||||
async full(): Promise<boolean> {
|
||||
const cap = coordinatorConfig.catalogMaxNvmeGb
|
||||
if (!cap) return false
|
||||
if (Date.now() - this.checkedAt < CHECK_MS) return this.over
|
||||
this.checkedAt = Date.now()
|
||||
const { rows } = await db.rawQuery(
|
||||
`SELECT pg_tablespace_size(coalesce(nullif(current_setting('default_tablespace'), ''), 'pg_default')) AS bytes`
|
||||
)
|
||||
const bytes = Number(rows[0].bytes)
|
||||
const was = this.over
|
||||
this.over = bytes > cap * 1e9
|
||||
if (this.over !== was) {
|
||||
logger.info(`Catalog ${(bytes / 1e9).toFixed(1)} GB of ${cap}: history ${this.over ? 'paused (tail and stored ranges only)' : 'resumed'}.`)
|
||||
}
|
||||
return this.over
|
||||
}
|
||||
}
|
||||
|
||||
export default new CatalogSpace()
|
||||
Reference in new issue
Block a user