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(api, rawdb): batch clean skipped txs traces #501

Closed
wants to merge 2 commits into from

Conversation

0xmountaintop
Copy link

@0xmountaintop 0xmountaintop commented Sep 4, 2023

1. Purpose or design rationale of this PR

After #500 we may store traces in DB, and we would like to clean them someday, because the trace size is nonnegligible.

2. 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

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

@0xmountaintop 0xmountaintop force-pushed the reset_skipped_traces branch 2 times, most recently from 85caaeb to 5be70d9 Compare September 4, 2023 10:42
@0xmountaintop 0xmountaintop marked this pull request as ready for review September 4, 2023 10:59
core/rawdb/accessors_skipped_txs.go Outdated Show resolved Hide resolved
Comment on lines 161 to 186
mu.Lock()
defer mu.Unlock()
Copy link

Choose a reason for hiding this comment

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

No need to lock, the other method only locks because all invocations to WriteSkippedTransaction (with a capital W) share a single counter.

Copy link
Author

Choose a reason for hiding this comment

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

fixed in 1b7db00

eth/api.go Outdated Show resolved Hide resolved
eth/api.go Show resolved Hide resolved
Base automatically changed from store/skipped_traces to develop September 5, 2023 03:03
@@ -197,6 +197,11 @@ func WriteSkippedTransaction(db ethdb.Database, tx *types.Transaction, traces *t
}
}

func ResetSkippedTransactionTracesByHash(db ethdb.Database, txHash common.Hash) {
stx := ReadSkippedTransaction(db, txHash)
Copy link

Choose a reason for hiding this comment

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

Suggested change
stx := ReadSkippedTransaction(db, txHash)
stx := ReadSkippedTransaction(db, txHash)
if stx == nil {
return
}

Sorry, forgot about the nil case

Copy link

Choose a reason for hiding this comment

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

Return error can be better can let the caller know stx value is empty.

Copy link
Author

@0xmountaintop 0xmountaintop Sep 18, 2023

Choose a reason for hiding this comment

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

fixed in 108ddc8

eth/api.go Outdated
return hashes, nil
}

// ResetSkippedTransactionTracesByHash reset a specified skipped tx's traces stored in db.
Copy link

Choose a reason for hiding this comment

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

Suggested change
// ResetSkippedTransactionTracesByHash reset a specified skipped tx's traces stored in db.
// ResetSkippedTransactionTracesByHash resets a specified skipped tx's traces stored in db.

Copy link
Author

@0xmountaintop 0xmountaintop Sep 18, 2023

Choose a reason for hiding this comment

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

fixed in 108ddc8

@0xmountaintop 0xmountaintop changed the title batch clean skipped txs traces feat(api, rawdb): batch clean skipped txs traces Sep 18, 2023
colinlyguo
colinlyguo previously approved these changes Sep 20, 2023
@0xmountaintop 0xmountaintop force-pushed the reset_skipped_traces branch 3 times, most recently from 1bb1c04 to 10092a4 Compare February 26, 2024 05:57
@0xmountaintop 0xmountaintop deleted the reset_skipped_traces branch August 14, 2024 06:49
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.

5 participants