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

feat(coordinator): fix all chunks ready bug #862

Merged
merged 7 commits into from
Aug 24, 2023

Conversation

georgehao
Copy link
Member

@georgehao georgehao commented Aug 23, 2023

Purpose or design rationale of this PR

Describe your change. Make sure to answer these three questions: What does this PR do? Why does it do it? How does it do it?

UPDATE "batch"
SET "proving_status" = 2, "updated_at" = '2023-08-23 08:33:12.666'
WHERE "index" = (
    SELECT batch.index
    FROM "batch"
    WHERE batch.proving_status = 1
    AND NOT EXISTS (
        SELECT 1
        FROM "chunk"
        WHERE chunk.batch_hash = batch.hash
        AND NOT chunk.proving_status = 4
    )
    AND "batch"."deleted_at" IS NULL
    ORDER BY batch.index ASC
    LIMIT 1
)
AND proving_status = 1
AND "batch"."deleted_at" IS NULL
RETURNING *;

actually, one sql can do it. BUT, this sql is too complex, it's maybe increase the difficulty to maintain.

So still use chunk_proofs_status and cron task check it.

PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

Deployment tag versioning

Has tag in common/version.go been updated?

  • No, this PR doesn't involve a new deployment, git tag, docker image tag
  • Yes

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change
  • Yes

colinlyguo
colinlyguo previously approved these changes Aug 23, 2023
@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #862 (4e36973) into develop (e8ddf99) will decrease coverage by 0.15%.
Report is 1 commits behind head on develop.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop     #862      +/-   ##
===========================================
- Coverage    51.32%   51.17%   -0.15%     
===========================================
  Files           60       60              
  Lines         5561     5577      +16     
===========================================
  Hits          2854     2854              
- Misses        2468     2484      +16     
  Partials       239      239              
Flag Coverage Δ
database 42.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
coordinator/internal/orm/batch.go 0.00% <0.00%> (ø)

0xmountaintop
0xmountaintop previously approved these changes Aug 24, 2023
Copy link
Member

@0xmountaintop 0xmountaintop left a comment

Choose a reason for hiding this comment

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

LGTM just some nitpicks

Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
@0xmountaintop 0xmountaintop merged commit ce5c6e0 into develop Aug 24, 2023
17 checks passed
@0xmountaintop 0xmountaintop deleted the fix/all_chunk_ready_bug branch August 24, 2023 07:20
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.

3 participants