Skip to content

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:

  1. Rows per v1 table, for the money study (row 2) and the reconcile to compare against. On #184.
  2. v1's rentals with deduction_stopped set, by status. D67 maps them onto paused, and zuki reviews the counts before cutover. On #155.
  3. 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.

  • BE-DP-07 is done: ../opleet-private/counts-copy.txt exists.
  • docker ps --filter name=v1copy lists the copy as Up, and you are at the root of your clone.

BE-DP-07 wrote them. This prints them with the total first.

Terminal window
cat ../opleet-private/counts-copy.txt
Terminal window
docker exec -i v1copy psql -U postgres -d postgres -v ON_ERROR_STOP=1 < tools/migration/v1-copy/deduction-stopped.sql

It reads every text and jsonb column, so it may take a minute.

Terminal window
docker exec -i v1copy psql -U postgres -d postgres -v ON_ERROR_STOP=1 < tools/migration/v1-copy/file-links.sql
  • 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 FUNCTION and DO, then a table with source (where the flag was found, such as onboarding.deduction_stopped or onboarding.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 TABLE and DO, then a table with source (a table and column), rows_with_links, then how many links are public, signed, other, bare and inline, and a total line last. TL-DP-02 found one bucket, mop-files, private, with 53,843 files. If links point at it, public links 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.

  • Block 2 or 3: function regexp_count does not exist or syntax error at or near "(": the copy isn't Postgres 17. Check docker exec v1copy postgres --version, then BE-DP-06's Undo and its blocks again with postgres: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):

Terminal window
docker rm -f v1copy
rm ../opleet-private/v1_public.dump ../opleet-private/counts-copy.txt ../opleet-private/counts-v1_live.txt
ls -A ../opleet-private

The 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.