par2_files, fragments and probe_cache with the chunks (CHUNK_TABLESPACE)
~20 GB of the NVMe, read by key only; the catalog was at its cap and history paused. Moved on homelab by hand (3 min, writers stopped; the cap raised to 100); the migration does the same on a new deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
377decaf3d
commit
c65282ec5d
1 file changed
+32
@@ -0,0 +1,32 @@
|
|||||||
|
import { BaseSchema } from '@adonisjs/lucid/schema'
|
||||||
|
import env from '#start/env'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* par2_files, fragments and probe_cache, with their indexes, in CHUNK_TABLESPACE (the HDD): ~20 GB of the NVMe at
|
||||||
|
* 42M releases, read by key only (the merger, the fragment merger, the prober). The catalog was at its
|
||||||
|
* CATALOG_MAX_NVME_GB cap and history paused (LOG.md 2026-10-14 (55)). Homelab was moved by hand first (3 min,
|
||||||
|
* with the writers stopped); a no-op where they're there already.
|
||||||
|
*/
|
||||||
|
const TABLES = ['par2_files', 'fragments', 'probe_cache']
|
||||||
|
|
||||||
|
export default class extends BaseSchema {
|
||||||
|
async up() {
|
||||||
|
const tablespace = env.get('CHUNK_TABLESPACE')
|
||||||
|
if (!tablespace) return
|
||||||
|
this.defer(async (db) => {
|
||||||
|
for (const table of TABLES) {
|
||||||
|
const { rows } = await db.rawQuery(
|
||||||
|
`SELECT c.relname, c.relkind FROM pg_class c LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace
|
||||||
|
WHERE (c.relname = ? OR c.oid IN (SELECT indexrelid FROM pg_index WHERE indrelid = ?::regclass))
|
||||||
|
AND coalesce(t.spcname, 'pg_default') <> ?`,
|
||||||
|
[table, table, tablespace]
|
||||||
|
)
|
||||||
|
for (const { relname, relkind } of rows) {
|
||||||
|
await db.rawQuery(`ALTER ${relkind === 'i' ? 'INDEX' : 'TABLE'} ${relname} SET TABLESPACE ${tablespace}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async down() {}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user