Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo history rewrite #1479

Merged
merged 44 commits into from Aug 30, 2023
Merged

Repo history rewrite #1479

merged 44 commits into from Aug 30, 2023

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented Aug 15, 2023

Removes history from repos, introduces new sync semantics, and provides an upgrade path to repo v3.

Adds a temporary admin com.atproto.temp.upgradeRepoVersion route through which we can upgrade repos at our own pace.

More discussion here: #1410
Blog post with discussion of changes here: https://atproto.com/blog/repo-sync-update


Note for reviewing: I would review this in in the following order

  • repo package
  • pds updates
  • the migration route + tests

@dholms dholms marked this pull request as ready for review August 17, 2023 18:10
lexicons/com/atproto/sync/getRoot.json Outdated Show resolved Hide resolved
lexicons/com/atproto/sync/getRoot.json Outdated Show resolved Hide resolved
packages/repo/src/types.ts Show resolved Hide resolved
Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lookin real nice! It was great to see a lot of the complex bookkeeping fade away here.

lexicons/com/atproto/sync/subscribeRepos.json Outdated Show resolved Hide resolved
lexicons/com/atproto/sync/subscribeRepos.json Show resolved Hide resolved
packages/pds/src/api/com/atproto/sync/listBlobs.ts Outdated Show resolved Hide resolved
packages/repo/src/data-diff.ts Outdated Show resolved Hide resolved
packages/pds/src/sql-repo-storage.ts Outdated Show resolved Hide resolved
packages/pds/src/sql-repo-storage.ts Outdated Show resolved Hide resolved
packages/pds/src/sql-repo-storage.ts Outdated Show resolved Hide resolved
packages/pds/tests/migrations/repo-version-upgrade.test.ts Outdated Show resolved Hide resolved
packages/pds/tests/migrations/repo-version-upgrade.test.ts Outdated Show resolved Hide resolved
Comment on lines 241 to 247
qb
.where('repoRev', '>', cursor.rev)
.orWhere((inner) =>
inner
.where('repoRev', '=', cursor.rev)
.where('cid', '>', cursor.cid.toString()),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would recommend using this pattern to ensure you hit the index: ("repoRev", "cid") > (${cursor.rev}, ${cursor.cid}). Shouldn't really be necessary, but we've seen it miss the index the other way for sure 🙃

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good looks 👍 simpler too

@dholms dholms merged commit ad1fcf1 into main Aug 30, 2023
5 checks passed
@dholms dholms deleted the repo-history-rewrite branch August 30, 2023 00:07
estrattonbailey added a commit that referenced this pull request Aug 30, 2023
* origin:
  @atproto/repo@0.3.0
  @atproto/api@0.6.8
  @atproto/api@0.6.7
  Add preferences helpers to SDK (#1537)
  Repo history rewrite (#1479)
  Fix ambiguous reference to `repoRev` (#1534)
mloar pushed a commit to mloar/atproto that referenced this pull request Sep 26, 2023
* logical changes in repo

* tests

* tweak commit data

* building pds

* patching up some tests

* tidy + more tests

* patch up bsky

* clean up db

* db migration

* small patches

* fix up another test

* reinclude prevs

* api & lex updates

* add back in deprecated routes

* backward compatibility for commit v2

* add upgrade repo version root

* move namespace

* migration test

* patch up a few more tests

* remove deprecated rebase routes

* tweak api

* sprinkle rev around a few more places

* getCurrent -> getLatestCommit

* fix test

* pr feedback & tidy

* fix up block pagination

* tidy again

* add in a tets

* add cursor to listBlobs

* getRepo rev -> since

* clean up proofs test

* dont change getHead

* tweak migrate route

* build branch

* hit index in block range query

* check for dupe record refs

* tidy

* set prev to null

* dont build branch
mloar pushed a commit to mloar/atproto that referenced this pull request Nov 15, 2023
* logical changes in repo

* tests

* tweak commit data

* building pds

* patching up some tests

* tidy + more tests

* patch up bsky

* clean up db

* db migration

* small patches

* fix up another test

* reinclude prevs

* api & lex updates

* add back in deprecated routes

* backward compatibility for commit v2

* add upgrade repo version root

* move namespace

* migration test

* patch up a few more tests

* remove deprecated rebase routes

* tweak api

* sprinkle rev around a few more places

* getCurrent -> getLatestCommit

* fix test

* pr feedback & tidy

* fix up block pagination

* tidy again

* add in a tets

* add cursor to listBlobs

* getRepo rev -> since

* clean up proofs test

* dont change getHead

* tweak migrate route

* build branch

* hit index in block range query

* check for dupe record refs

* tidy

* set prev to null

* dont build branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants