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

bug: pindexer db init fails #4759

Closed
conorsch opened this issue Jul 25, 2024 · 3 comments
Closed

bug: pindexer db init fails #4759

conorsch opened this issue Jul 25, 2024 · 3 comments
Assignees
Labels
A-indexing Area: Relates to event indexing. A-tooling Area: developer tooling for building Penumbra itself C-bug Category: a bug needs-refinement unclear, incomplete, or stub issue that needs work

Comments

@conorsch
Copy link
Contributor

Describe the bug
I'm unable to get pindexer running locally in the dev env.

To Reproduce
Steps to reproduce the behavior:

  1. Use nix dev env https://guide.penumbra.zone/dev/dev-env
  2. cargo run --release --bin pd -- network unsafe-reset-all
  3. just dev
  4. Observe failure in pindexer startup

Expected behavior
I expect that pindexer will start fine in the default dev env. Instead, it fails on startup, with error screenshotted below.

Screenshots
pindexer-startup-error

Additional context
It's possible that the ad-hoc postgres grants in the deployments/compose/process-compose-postgres.yml are no longer correct, or the problem could be in the sql logic within pindexer. Whatever it is, I could use a hand sorting out the correct settings, so I can continue setting up pindexer in other contexts.

@conorsch conorsch added C-bug Category: a bug A-tooling Area: developer tooling for building Penumbra itself A-indexing Area: Relates to event indexing. labels Jul 25, 2024
@github-actions github-actions bot added the needs-refinement unclear, incomplete, or stub issue that needs work label Jul 25, 2024
@conorsch
Copy link
Contributor Author

Unsurprisingly, @aubrika was a huge help here. While debugging locally, I stumbled upon the [sqlfluff] tool, which can be used to lint sql files and find parsing errors:

❯ sqlfluff lint --dialect postgres crates/bin/pindexer/src/dex/dex.sql
== [crates/bin/pindexer/src/dex/dex.sql] FAIL
L:   7 | P:   1 | LT05 | Line is too long (81 > 80). [layout.long_lines]
L:   9 | P:   1 | LT05 | Line is too long (82 > 80). [layout.long_lines]
L:  12 | P:   1 |  PRS | Line 12, Position 1: Found unparsable section: 'CREATE
                       | DOMAIN IF NOT EXISTS Amount AS NU...'
WARNING: Parsing errors found and dialect is set to 'postgres'. Have you configured your dialect correctly?

That's probably worth sticking in CI.

conorsch added a commit that referenced this issue Jul 25, 2024
Not wired up to CI yet, but has proven useful interactively while
debugging #4759.
@ejmg
Copy link
Collaborator

ejmg commented Jul 25, 2024

my PR for cometindex fixes some logic that is connected to this type of bug which IMO falls from the tacit contract on AppView that an implementer's init_chain requires sanitary SQL that makes sure to check/tear down anything that is defined for that specific indexer.

@conorsch
Copy link
Contributor Author

Resolved by #4760 & #4762.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-indexing Area: Relates to event indexing. A-tooling Area: developer tooling for building Penumbra itself C-bug Category: a bug needs-refinement unclear, incomplete, or stub issue that needs work
Projects
None yet
Development

No branches or pull requests

4 participants