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

[GraphQL/MovePackage] Paginate by version #17697

Open
wants to merge 1 commit into
base: amnn/gql-pkg-cp-page
Choose a base branch
from

Conversation

amnn
Copy link
Contributor

@amnn amnn commented May 13, 2024

Description

Introduce two new queries: Query.packageVersions and MovePackage.versions for iterating over all the different versions of a given package.

This kind of query is useful for understanding package history.

These were introduced as a separate query, instead of having a single query for iterating over packages that could optionally take a checkpoint bounds or version bounds because of how system packages interact with the packages table:

Because system packages are updated in-place, they only have one row in the packages table. This makes sense for paginating packages in bulk (e.g. by checkpoint) where the primary aim is to get a snapshot of the packages available at a certain point in time, but doesn't work for answering package version queries for system packages, and it prevents us from creating a combined query. A combined query would also allow someone to create a filter that bounds checkpoints and versions, but doesn't bound the package itself (or would require us to prevent that combination), which is complicated to implement efficiently and not particularly useful.

Test plan

New E2E tests:

sui$ cargo nextest run -p sui-graphql-e2e-tests \
  --features pg_integration                     \
  -- packages/versioning

& Testing against a read replica to make sure system package tests work well, and performance is reasonable.

Stack


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL: Introduces Query.packageVersions and MovePackage.versions for paginating over the versions of a particular package.
  • CLI:
  • Rust SDK:

@amnn amnn requested review from manolisliolios and a team May 13, 2024 15:47
@amnn amnn self-assigned this May 13, 2024
Copy link

vercel bot commented May 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2024 10:19am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 10:19am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 10:19am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 10:19am

Copy link
Contributor

@wlmyng wlmyng left a comment

Choose a reason for hiding this comment

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

reasoning for keeping this and paginate by checkpoint separate makes sense to me. also neat trick on the system package versioning by joining to objects_history table

## Description

Introduce two new queries: `Query.packageVersions` and
`MovePackage.versions` for iterating over all the different versions
of a given package.

This kind of query is useful for understanding package history.

These were introduced as a separate query, instead of having a single
query for iterating over packages that could optionally take a
checkpoint bounds or version bounds because of how system packages
interact with the `packages` table:

Because system packages are updated in-place, they only have one row
in the `packages` table. This makes sense for paginating packages in
bulk (e.g. by checkpoint) where the primary aim is to get a snapshot
of the packages available at a certain point in time, but doesn't work
for answering package version queries for system packages, and it
prevents us from creating a combined query. A combined query would
also allow someone to create a filter that bounds checkpoints and
versions, but doesn't bound the package itself (or would require us to
prevent that combination), which is complicated to implement
efficiently and not particularly useful.

## Test plan

New E2E tests:

```
sui$ cargo nextest run -p sui-graphql-e2e-tests \
  --features pg_integration                     \
  -- packages/versioning
```

+ Testing against a read replica to make sure system package tests
work well, and performance is reasonable.
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

2 participants