~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

harness: the upgrade run on 0.5.0's data, its spaces carried

Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:harness/upgrade-0.5.0
.changeset/spaces-carried.mdnew+7−0
@@ -0,0 +1,7 @@
---
default: patch
---
# Spaces are carried across upgrades from 0.2.0 on
A server upgraded on a data directory written by 0.2.0 or any later release keeps its spaces: their records, members and history answer as they did before. Only 0.1.0's spaces, written before every account's log began with the spaces mark, are let go when the account is first loaded, together with any blob that only those spaces held. The spec and guides used to say spaces were never carried across versions. They now describe what the server does.
crates/pds-server/src/checkpoint/unmarked.rs+3−2
@@ -1,5 +1,6 @@
//! Spaces state this server does not carry: spaces are an alpha, and none
//! of an earlier version's is kept (`spec/STORE.md`, "Upgrades").
//! Spaces state before the mark, which this server does not carry: spaces
//! are an alpha, so an earlier version's is let go; from the mark on it is
//! carried (`spec/STORE.md`, "Upgrades").
//!
//! An account's spaces state is this version's where it is **marked**: in
//! a table that does not say it is unmarked, and in its log from the mark
crates/pds-server/src/store.rs+1−1
@@ -128,7 +128,7 @@
//! this version, of the next generation, as its store is first loaded
//! (`checkpoint::load`).
//!
//! **Spaces are not carried across versions** (`spec/STORE.md`,
//! **Spaces are carried from the mark on** (`spec/STORE.md`,
//! "Upgrades"): an account's spaces state is this server's from the mark
//! its log begins with on, and what is found before it, in a log or a
//! table an earlier version wrote, is let go as its store is first loaded,
docs/guide/operating.md+3−4
@@ -119,10 +119,9 @@ a millisecond or more
Stop the server, put the new binary or image in place, and start it on the
same data directory. The server starts on a data directory the last
release wrote, whether it was shut down or killed, and carries on from it.
Spaces are the exception. They're an alpha, so they aren't carried across
versions, and the server starts with none of the spaces the previous
release kept. It may refuse a data directory a later version wrote and
exit 1, but it never serves part of one
Its spaces carry on too when 0.2.0 or a later release wrote it; the spaces
0.1.0 kept are let go on the first start. It may refuse a data directory a
later version wrote and exit 1, but it never serves part of one
([STORE.md](../../spec/STORE.md#upgrades)). If a release from before the
firehose's index wrote the data directory, the first start reads every
account's files once for the earlier events, and takes that much longer to
harness/checks/upgrade.mjs+12−11
@@ -37,8 +37,6 @@ const SP = 'com.atproto.space.'
const MS = 'com.atproto.memberspace.'
/// A PNG of one pixel, for an avatar.
const PNG = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==', 'base64')
/// The reads of spaces, which 0.1.0 wrote and no later version carries.
const SPACE_READS = / (listSpaces|getSpace|listMembers|space listRecords|space listRepoOps|space getLatestCommit)$/
const sha = (bytes) => createHash('sha256').update(bytes).digest('hex')
const admin = () => `Basic ${Buffer.from(`admin:${server.env.PDS_ADMIN_PASSWORD}`).toString('base64')}`
@@ -151,6 +149,16 @@ async function readAll(accounts) {
await read(`${a.name} checkAccountStatus`, () => call('com.atproto.server.checkAccountStatus', { token }))
await read(`${a.name} getPreferences`, () => call('app.bsky.actor.getPreferences', { token }))
await read(`${a.name} listAppPasswords`, () => call('com.atproto.server.listAppPasswords', { token }))
// Its space, carried as the rest is (spec/STORE.md, "How it is checked").
if (a.space) {
const space = a.space
await read(`${a.name} listSpaces`, () => call(`${SP}listSpaces`, { token }))
await read(`${a.name} getSpace`, () => call(`${SP}getSpace`, { params: { space }, token }))
await read(`${a.name} listMembers`, () => call(`${MS}listMembers`, { params: { space }, token }))
await read(`${a.name} space listRecords`, () => call(`${SP}listRecords`, { params: { space, repo: did, collection: SC }, token }))
await read(`${a.name} space listRepoOps`, () => call(`${SP}listRepoOps`, { params: { space, repo: did }, token }))
await read(`${a.name} space getLatestCommit`, () => call(`${SP}getLatestCommit`, { params: { space, repo: did }, token }))
}
}
const events = await firehose()
reads.firehose = { status: 200, body: events.map(({ t, seq, sha }) => ({ t, seq, sha })) }
@@ -286,22 +294,15 @@ export async function upgradeRun() {
const at = { data: `${dir}, written by ${version}` }
await startWith(pinned, at)
const got = await readAll(accounts)
// Spaces are not carried across versions: the previous version's
// answers of them stand for nothing now (spec/STORE.md, "Upgrades").
const kept = Object.keys(want).filter((key) => !SPACE_READS.test(key))
for (const key of kept) {
for (const key of Object.keys(want)) {
if (!isDeepStrictEqual(got[key], want[key])) await fail(cand, `${key}, on the previous version's data`, at, want[key], got[key] ?? 'not read')
count(`read as before: ${key.replace(/^\w+ /, '').replace(/ baf\w+$/, '')}`, true)
}
for (const key of Object.keys(got)) if (!kept.includes(key)) await fail(cand, 'reads, on the previous version\'s data', at, 'only what the previous version answered', key)
for (const key of Object.keys(got)) if (!(key in want)) await fail(cand, 'reads, on the previous version\'s data', at, 'only what the previous version answered', key)
// A write carries on from the last: a later rev, the next event.
const alice = accounts[0]
const session = (await call('com.atproto.server.createSession', { body: { identifier: alice.handle, password: alice.password } })).body
const spaces = await call(`${SP}listSpaces`, { token: session.accessJwt })
const space = await call(`${SP}getSpace`, { params: { space: alice.space }, token: session.accessJwt })
if (spaces.status !== 200 || !isDeepStrictEqual(spaces.body, { spaces: [] }) || space.status !== 400 || space.body?.error !== 'SpaceNotFound') await fail(cand, 'spaces, on the previous version\'s data', at, { listSpaces: { spaces: [] }, getSpace: '400 SpaceNotFound' }, { listSpaces: spaces.body, getSpace: { status: space.status, error: space.body?.error } })
count('spaces not carried across versions', true)
const before = want[`${alice.name} getLatestCommit`].body.rev
const wrote = await call('com.atproto.repo.createRecord', { body: { repo: alice.did, collection: NOTE, record: { $type: NOTE, text: `after the upgrade ${i}` } }, token: session.accessJwt })
if (wrote.status !== 200 || !(wrote.body.commit?.rev > before)) await fail(cand, 'createRecord, on the previous version\'s data', at, `a commit of a rev after ${before}`, wrote.body)
harness/upgrade/clean/repos/did:plc:4m7l34jxnawg2u2gd6z5bvsl/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:rz62tnyjhzinoodtxl7bauif/blobs/bafkreicjo6iji7kgmz3azy4phqaoquwhd7nwnsxijg5or2pn4njhdhqvqe → harness/upgrade/clean/repos/did:plc:dlatpwyghczagas2fvr6jjgk/blobs/bafkreicjo6iji7kgmz3azy4phqaoquwhd7nwnsxijg5or2pn4njhdhqvqerenamed+0−0
Moved without changes.
harness/upgrade/clean/repos/did:plc:dlatpwyghczagas2fvr6jjgk/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:f2ljtdvstwqazoo6oqsidgoj/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:hmqkn7kypbzm2ynkcouvw4tx/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:kon7a5j3wfhnjq6mj674v5lz/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:o2kjkytp27kn3bdgjmeecpm2/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:rz62tnyjhzinoodtxl7bauif/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/clean/repos/did:plc:srd3gekvbbkmp6wiczb4vr5m/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/clean/accounts.0.log+0−0
A binary file, not shown.
harness/upgrade/clean/clean-shutdown+4−0
@@ -0,0 +1,4 @@
durable
dir 1000011 258457733 1794953769.822807070
repos 1000011 258457762 1794953766.541899415
mark 258457800
harness/upgrade/clean/events.0.lognew+0−0
A binary file, not shown.
harness/upgrade/clean/events.checkpointnew+0−0
A binary file, not shown.
harness/upgrade/clean/jwt.key+1−2
@@ -1,2 +1 @@
��mA�1� [�c��Ƈc,���
�(�X�hVV*n
\ No newline at end of file
��oԧ/V#l��Fe/�n�"����O�d��G
\ No newline at end of file
harness/upgrade/clean/locknew+0−0
No changes to the content.
harness/upgrade/clean/oauth.key+1−1
@@ -1 +1 @@
1t$�U�&� }Ƹ�t�T2�T�&�1�-o�q�&3
\ No newline at end of file
��NwU���(~}�]7�`,��x��ՠ� �}�
\ No newline at end of file
harness/upgrade/killed/journal/2.lognew+1−0
@@ -0,0 +1 @@
PDSJNL01
\ No newline at end of file
harness/upgrade/killed/repos/did:plc:4m7l34jxnawg2u2gd6z5bvsl/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:rz62tnyjhzinoodtxl7bauif/blobs/bafkreicjo6iji7kgmz3azy4phqaoquwhd7nwnsxijg5or2pn4njhdhqvqe → harness/upgrade/killed/repos/did:plc:dlatpwyghczagas2fvr6jjgk/blobs/bafkreicjo6iji7kgmz3azy4phqaoquwhd7nwnsxijg5or2pn4njhdhqvqerenamed+0−0
Moved without changes.
harness/upgrade/killed/repos/did:plc:dlatpwyghczagas2fvr6jjgk/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:f2ljtdvstwqazoo6oqsidgoj/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:hmqkn7kypbzm2ynkcouvw4tx/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:kon7a5j3wfhnjq6mj674v5lz/repo.0.lognew+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:o2kjkytp27kn3bdgjmeecpm2/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:rz62tnyjhzinoodtxl7bauif/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/killed/repos/did:plc:srd3gekvbbkmp6wiczb4vr5m/repo.0.logdeleted+0−0
A binary file, not shown.
harness/upgrade/killed/accounts.0.log+0−0
A binary file, not shown.
harness/upgrade/killed/events.0.lognew+0−0
A binary file, not shown.
harness/upgrade/killed/events.checkpointnew+0−0
A binary file, not shown.
harness/upgrade/killed/jwt.key+1−2
@@ -1,2 +1 @@
��mA�1� [�c��Ƈc,���
�(�X�hVV*n
\ No newline at end of file
��oԧ/V#l��Fe/�n�"����O�d��G
\ No newline at end of file
harness/upgrade/killed/locknew+0−0
No changes to the content.
harness/upgrade/killed/oauth.key+1−1
harness/upgrade/accounts.json+6−6
harness/upgrade/env.json+3−3
harness/upgrade/plc.json+35−35
harness/upgrade/reads.json+239−218
457 lines changed: not loaded until asked for.
harness/upgrade/version.json+1−1
spec/STORE.md+22−11