db: c3f4c388 drops 16 tables that hold rows on production; its message says all are empty #89

Open
opened 2026-11-16 21:03:40 +00:00 by xemmerling · 0 comments
Owner

c3f4c388 ("db: the tables of features t no longer has go") says of its 32 tables: "On production all are empty but job_claims (49 MB) and needs (320 kB), both with no live rows". Counted on production at 21:01Z 11-16, with the schema at version 40 (before the step), 16 of the 32 hold rows:

table rows, count(*)
job_claims 155,215
needs 665
entity_changes 31
area_trends 24
entities 12
entity_timers 10
entity_messages 8
forge_mirrored 7
areas 6
forge_comments 4
contract_revisions 3
entity_work 3
issues 3
role_tokens 3
tasks 3
model_spend 2

The other 16 hold none.

Where "no live rows" probably comes from. pg_stat_user_tables.n_live_tup reads 0 for all 32, with n_tup_ins 0 and no autovacuum recorded. That is an estimate nothing has filled since the statistics last began, not a count.

What I checked besides, and it holds.

  • Nothing on main names one of the 32 in a statement outside the step and its tests (git grep over src and crates).
  • On production no foreign key from a table outside the list points at one of them, and no view outside the list is built on one. CASCADE takes nothing else there.
  • No transaction older than a minute was open at 21:01Z, so the drop had nothing to wait behind.
  • The step is the last of STEPS; production stands at 40 = 23 + 17.

So the step does what it says; its premise about production is what is wrong. The factory's tables were left in place on purpose when the factory was removed (2a3c0044). Whether their rows may go is the user's to say, and I have told them.

What I did. A pg_dump of the 14 factory tables that hold rows is kept on the user's machine: ~/.cache/t-factory/factory-tables-1116/production-factory-tables.sql, 204 kB, its rows per table checked against the table above. Left out: job_claims (the cache's old claims) and role_tokens (three rows of hashes of tokens for roles that no longer exist; I do not read that table's contents). With that copy the 14 tables' rows can be put back after the step, so the drop is no longer one-way for them.

Testing's database was not counted.

22:06Z 11-16: the step has run on production

243ff75d went live at 22:03:58Z with this step in it. Production stands at schema version 41 and none of eight of the tables I looked for exists any more. The worker re-attached 233 jobs, none unattachable.

The copy named above is now the only place the rows of the 14 factory tables exist. job_claims (155,215 rows) and role_tokens (3 rows) were not copied and are gone. The user has not yet said whether the factory's rows were to go; I keep the copy until they do.

c3f4c388 ("db: the tables of features t no longer has go") says of its 32 tables: "On production all are empty but `job_claims` (49 MB) and `needs` (320 kB), both with no live rows". Counted on production at 21:01Z 11-16, with the schema at version 40 (before the step), 16 of the 32 hold rows: | table | rows, `count(*)` | |---|---| | `job_claims` | 155,215 | | `needs` | 665 | | `entity_changes` | 31 | | `area_trends` | 24 | | `entities` | 12 | | `entity_timers` | 10 | | `entity_messages` | 8 | | `forge_mirrored` | 7 | | `areas` | 6 | | `forge_comments` | 4 | | `contract_revisions` | 3 | | `entity_work` | 3 | | `issues` | 3 | | `role_tokens` | 3 | | `tasks` | 3 | | `model_spend` | 2 | The other 16 hold none. **Where "no live rows" probably comes from.** `pg_stat_user_tables.n_live_tup` reads 0 for all 32, with `n_tup_ins` 0 and no autovacuum recorded. That is an estimate nothing has filled since the statistics last began, not a count. **What I checked besides, and it holds.** - Nothing on main names one of the 32 in a statement outside the step and its tests (`git grep` over `src` and `crates`). - On production no foreign key from a table outside the list points at one of them, and no view outside the list is built on one. `CASCADE` takes nothing else there. - No transaction older than a minute was open at 21:01Z, so the drop had nothing to wait behind. - The step is the last of `STEPS`; production stands at 40 = 23 + 17. So the step does what it says; its premise about production is what is wrong. The factory's tables were left in place on purpose when the factory was removed (2a3c0044). Whether their rows may go is the user's to say, and I have told them. **What I did.** A `pg_dump` of the 14 factory tables that hold rows is kept on the user's machine: `~/.cache/t-factory/factory-tables-1116/production-factory-tables.sql`, 204 kB, its rows per table checked against the table above. Left out: `job_claims` (the cache's old claims) and `role_tokens` (three rows of hashes of tokens for roles that no longer exist; I do not read that table's contents). With that copy the 14 tables' rows can be put back after the step, so the drop is no longer one-way for them. Testing's database was not counted. ## 22:06Z 11-16: the step has run on production 243ff75d went live at 22:03:58Z with this step in it. Production stands at schema version 41 and none of eight of the tables I looked for exists any more. The worker re-attached 233 jobs, none unattachable. The copy named above is now the only place the rows of the 14 factory tables exist. `job_claims` (155,215 rows) and `role_tokens` (3 rows) were not copied and are gone. The user has not yet said whether the factory's rows were to go; I keep the copy until they do.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
tilo/t#89
No description provided.