BE-DP-08 · The counts the data phase needs from the copy
ID BE-DP-08 · Level L0 · Pack Pack R1 · The v1 copy · Run order row 1, after BE-DP-07, last · Issue #184
Three sets of counts from the copy are on their issues, for the steps that wait for them:
- Rows per v1 table, for the money study (row 2) and the reconcile to compare against. On #184.
- v1's rentals with deduction_stopped set, by status. D67 maps them onto
paused, and zuki reviews the counts before cutover. On #155. - v1's file links, by form: public, signed, other storage links, bare paths and files still inline. The photo copy parses the bucket and path from them (D60, D68). On #184.
v1's layout isn't written down, so the scripts find the flag and the links wherever they are, and print where they found them: a table and a column, never a value. Everything here is a count (D15). The scripts read the copy and change nothing in it.
Before
Section titled “Before”- BE-DP-07 is done:
../opleet-private/counts-copy.txtexists. docker ps --filter name=v1copylists the copy as Up, and you are at the root of your clone.
1 · Rows per table
Section titled “1 · Rows per table”BE-DP-07 wrote them. This prints them with the total first.
cat ../opleet-private/counts-copy.txt2 · deduction_stopped by status
Section titled “2 · deduction_stopped by status”docker exec -i v1copy psql -U postgres -d postgres -v ON_ERROR_STOP=1 < tools/migration/v1-copy/deduction-stopped.sql3 · File links by form
Section titled “3 · File links by form”It reads every text and jsonb column, so it may take a minute.
docker exec -i v1copy psql -U postgres -d postgres -v ON_ERROR_STOP=1 < tools/migration/v1-copy/file-links.sqlExpect
Section titled “Expect”- Block 1:
(total: N tables) M, with BE-DP-06's N, then one line per table: its name and its rows. - Block 2:
CREATE TABLE,CREATE FUNCTIONandDO, then a table withsource(where the flag was found, such asonboarding.deduction_stoppedoronboarding.data -> deduction_stopped),status, then three counts: rows with it set, rows with it there but not set, and rows where it is empty.(0 rows)means v1 has no such flag under that name: say so on #155. - Block 3:
CREATE TABLEandDO, then a table withsource(a table and column),rows_with_links, then how many links arepublic,signed,other,bareandinline, and atotalline last. TL-DP-02 found one bucket,mop-files, private, with 53,843 files. If links point at it,publiclinks won't download by their URL, and the copy takes the signed-in way of D68.
Post the three results:
- On #184: block 1, and block 3's table. Then this issue's "Done when" is met.
- On #155: block 2's table, as D67 asks.
Table and column names, statuses and counts only. If a status reads like a person's name or a number from a document, leave that row out and say you did.
If it fails
Section titled “If it fails”- Block 2 or 3:
function regexp_count does not existorsyntax error at or near "(": the copy isn't Postgres 17. Checkdocker exec v1copy postgres --version, then BE-DP-06's Undo and its blocks again withpostgres:17. - Block 2 or 3: another
ERROR: post it on #184. It names a table and a column, never a row. - Block 3 runs for more than ten minutes: let it finish; v1 is a few hundred MB at most. If it is stuck on one table,
docker exec v1copy psql -U postgres -c "select now() - query_start, left(query, 80) from pg_stat_activity where state = 'active'"shows which. The first 80 characters name the table, not a value.
Nothing to undo: these scripts read only. Their tables are temporary and go when the session ends.
When the data phase no longer needs the copy, and before cutover in any case, delete it with your private files (D15):
docker rm -f v1copyrm ../opleet-private/v1_public.dump ../opleet-private/counts-copy.txt ../opleet-private/counts-v1_live.txtls -A ../opleet-privateThe last line should print nothing. If it lists a file you put there yourself, decide about it separately.
Log each run as a comment on #184 (blocks 1 and 3) and #155 (block 2), with the date.