The prober writes it every flush and the merger looks inner stems up in it, so it no longer belongs with the write-once payloads on the HDD. Moved on homelab by hand (prober and merger stopped); the migration is a no-op there and moves it on a new deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
import { BaseSchema } from '@adonisjs/lucid/schema'
|
||
|
||
/**
|
||
* release_inspections in the catalog's tablespace (default_tablespace: nvme
|
||
* on homelab), not CHUNK_TABLESPACE: the prober writes it every flush and
|
||
* the merger looks stems up in it (release_inspections_inner_stem_idx), so it
|
||
* isn't only read per release any more (migration 1700). Its flushes took
|
||
* 35–83 s a minute with the table on the HDD (LOG.md 2026-10-13 (43)).
|
||
* Homelab was moved by hand first; here a no-op when it's there already, or
|
||
* without a default tablespace (tests).
|
||
*/
|
||
export default class extends BaseSchema {
|
||
async up() {
|
||
this.defer(async (db) => {
|
||
const { rows } = await db.rawQuery(
|
||
`SELECT current_setting('default_tablespace') AS target,
|
||
(SELECT t.spcname FROM pg_class c LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace WHERE c.relname = 'release_inspections') AS current`
|
||
)
|
||
const { target, current } = rows[0]
|
||
if (!target || current === target) return
|
||
await db.rawQuery(`ALTER TABLE release_inspections SET TABLESPACE ${target}`)
|
||
await db.rawQuery(`ALTER INDEX release_inspections_pkey SET TABLESPACE ${target}`)
|
||
})
|
||
}
|
||
|
||
async down() {}
|
||
}
|