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

indexer: DB reset to handle incomplete migration history #19019 #19020

Conversation

gegaowp
Copy link
Contributor

@gegaowp gegaowp commented Aug 16, 2024

Description

#19019

Test plan

#19019


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:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Aug 16, 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 Aug 16, 2024 8:13pm

Copy link

vercel bot commented Aug 16, 2024

@gegaowp is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

…19019)

## Description 

previous fix did not work well when migration run history in
__diesel_schema_migrations table is not complete.

I also considered dropping the database as we usually do locally, but a
connection cannot drop the database in its own connection and ended up
having errors of
```
cannot drop the currently open database
```

thus this pr drops all tables, functions and procedures explicitly for
PG and tables for MySQL as we now only have tables in MySQL.

## Test plan 

1. diesel reset on latest main
2. cherry-pick this pr to 1.31 and 1.30, run cmd below and make sure
that DB are indeed reset
```
DB_POOL_SIZE=10 cargo run --bin sui-indexer -- --db-url =DB_URL --reset-db
```

---

## 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: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
@gegaowp gegaowp merged commit 87e1047 into MystenLabs:releases/sui-v1.31.0-release Aug 16, 2024
41 of 44 checks passed
@gegaowp gegaowp deleted the reset-db-fix-again-1-31 branch August 16, 2024 21:34
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.

2 participants