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

test: investigate test failure due to wal log #22679

Merged
merged 22 commits into from
Dec 19, 2024
Merged

test: investigate test failure due to wal log #22679

merged 22 commits into from
Dec 19, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Nov 28, 2024

Description

#22577 took way longer than needed due to some logs added by the dbs.
It makes fail the systemtests on CI only (while passing locally).

This reverts the hack and investigate how to get a better fix (RunWithSingleOutput was added in #22577 but doesn't seem to work super well on CI still)

The more astonishing thing is that #22577 set the default db as goleveldb as well in simapp, so that the upgrade test keeps working, but those tests were still failing... while it is a pebbledb log line: https://github.com/cockroachdb/pebble/blob/21866e882237f27e9cfcc974b7b3031dd7543bda/open.go#L1031C9-L1031C15


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Introduced a new logging mechanism for improved log clarity in the database implementation.
    • Updated default telemetry server address to localhost:7180.
    • Added user feedback for scenarios where no snapshots are found in the snapshot listing command.
  • Bug Fixes

    • Enabled execution of previously skipped snapshot and prune tests, enhancing test coverage.
  • Tests

    • Refactored command execution logic in export tests for improved clarity and maintainability.
    • Updated various test dependencies to ensure compatibility with the latest versions.
    • Added new dependencies for enhanced testing capabilities.

Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces a new logging mechanism for PebbleDB in the store/v2/db/pebbledb.go file. A fatalLogger type is implemented to suppress info logs from PebbleDB, ensuring only fatal logs are recorded. In the system tests, the export_test.go file is modified to improve command execution logic, and snapshots_test.go removes test skipping, allowing previously skipped tests to run. These changes aim to enhance logging control and test coverage without fundamentally altering the existing functionality.

Changes

File Change Summary
store/v2/db/pebbledb.go Added fatalLogger type implementing pebble.Logger interface to suppress info logs
tests/systemtests/export_test.go Refactored command execution using method chaining, removed strings package import
tests/systemtests/snapshots_test.go Removed t.Skip() from TestSnapshots and TestPrune tests
client/v2/go.mod Updated github.com/cosmos/cosmos-db dependency version
go.mod Updated github.com/cosmos/cosmos-db dependency version and added replace directives
simapp/go.mod Updated github.com/cosmos/cosmos-db dependency version
simapp/v2/go.mod Updated github.com/cosmos/cosmos-db dependency version
tests/go.mod Updated github.com/cosmos/cosmos-db dependency version and added new dependencies
x/accounts/defaults/base/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/accounts/defaults/multisig/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/accounts/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/authz/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/bank/go.mod Updated github.com/cosmos/cosmos-db dependency version and added new indirect dependencies
x/circuit/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/consensus/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/distribution/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/epochs/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/evidence/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/feegrant/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/gov/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/group/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/mint/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/nft/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/protocolpool/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/slashing/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/staking/go.mod Updated github.com/cosmos/cosmos-db dependency version
x/upgrade/go.mod Updated github.com/cosmos/cosmos-db dependency version

Possibly related PRs

Suggested reviewers

  • akhilkumarpilli
  • tac0turtle

📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77a1964 and df0748b.

📒 Files selected for processing (1)
  • tests/systemtests/snapshots_test.go (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/systemtests/snapshots_test.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Nov 28, 2024
@julienrbrt julienrbrt marked this pull request as ready for review December 17, 2024 08:10
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
store/v2/db/pebbledb.go (4)

33-33: Consider making log level configurable

While suppressing info logs solves the immediate issue, having a configurable log level would provide more flexibility for debugging.

-		Logger:                   &fatalLogger{},          // pebble info logs are messing up the logs (not a cosmossdk.io/log logger)
+		Logger:                   newPebbleLogger(opts),   // Configure logger based on options

306-308: Document the fatalLogger type

Add documentation explaining the purpose and behavior of this type.

+// fatalLogger implements pebble.Logger interface to control PebbleDB logging.
+// It suppresses info logs while preserving fatal logs to prevent log pollution
+// while ensuring critical errors are still reported.
 type fatalLogger struct {
 	pebble.Logger
 }

310-312: Consider error handling for fatal logs

The current implementation directly forwards fatal logs to the default logger. Consider adding error handling or logging context.

 func (*fatalLogger) Fatalf(format string, args ...interface{}) {
+	// Add store/v2/db context to the log message
+	format = "store/v2/db/pebble: " + format
 	pebble.DefaultLogger.Fatalf(format, args...)
 }

314-314: Add documentation for Infof method

Document why this method intentionally does nothing.

+// Infof implements pebble.Logger interface but suppresses info logs
+// to prevent log pollution during normal operations.
 func (*fatalLogger) Infof(format string, args ...interface{}) {}
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5799c15 and 1db483d.

📒 Files selected for processing (3)
  • store/v2/db/pebbledb.go (2 hunks)
  • tests/systemtests/export_test.go (1 hunks)
  • tests/systemtests/snapshots_test.go (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/systemtests/snapshots_test.go
🧰 Additional context used
📓 Path-based instructions (2)
tests/systemtests/export_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

store/v2/db/pebbledb.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (1)
tests/systemtests/export_test.go (1)

70-73: Consider a more robust solution for handling PebbleDB logs

While the current changes work around the issue by ignoring errors and capturing single output, this might mask potential issues. The comment indicates this is a temporary solution for test stability.

Let's verify if this is the only test affected by PebbleDB logs:

Consider implementing a more systematic approach to handle PebbleDB logs across all tests:

  1. Create a shared test utility for PebbleDB log management
  2. Implement proper log level control at the PebbleDB initialization

Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

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

The changes look good but the snapshot systemtest is still failing on CI
https://github.com/cosmos/cosmos-sdk/actions/runs/12401587454/job/34621294212?pr=22679#step:6:2209

@julienrbrt julienrbrt enabled auto-merge December 19, 2024 13:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
client/snapshot/list.go (1)

27-29: Consider enhancing the "no snapshots" message

While the empty state handling is a good addition, the message could be more informative for users.

Consider this enhancement:

-			cmd.Println("no snapshots found")
+			logger := client.GetLoggerFromCmd(cmd)
+			logger.Info("no snapshots found in the snapshot store")

This change would:

  1. Use structured logging for consistency with other commands
  2. Provide more context about where we looked for snapshots
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1c45da and 77a1964.

📒 Files selected for processing (3)
  • client/snapshot/list.go (1 hunks)
  • server/v2/store/snapshot.go (3 hunks)
  • tests/systemtests/snapshots_test.go (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/systemtests/snapshots_test.go
  • server/v2/store/snapshot.go
🧰 Additional context used
📓 Path-based instructions (1)
client/snapshot/list.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (1)
client/snapshot/list.go (1)

26-26: LGTM: Good use of empty lines for readability

The added empty lines improve code readability by clearly separating error handling, empty state handling, and iteration logic.

Also applies to: 30-30

@julienrbrt julienrbrt mentioned this pull request Dec 19, 2024
12 tasks
@julienrbrt julienrbrt added this pull request to the merge queue Dec 19, 2024
Merged via the queue into main with commit a9c1149 Dec 19, 2024
94 of 95 checks passed
@julienrbrt julienrbrt deleted the julien/wallog branch December 19, 2024 15:11
mergify bot pushed a commit that referenced this pull request Dec 19, 2024
(cherry picked from commit a9c1149)

# Conflicts:
#	server/v2/api/telemetry/config.go
#	server/v2/stf/stf_test.go
#	server/v2/store/commands.go
#	server/v2/store/snapshot.go
#	server/v2/testdata/app.toml
#	store/v2/db/pebbledb.go
#	systemtests/CHANGELOG.md
#	systemtests/system.go
#	systemtests/testnet_init.go
#	tests/go.mod
#	tests/systemtests/go.mod
#	tests/systemtests/go.sum
#	x/accounts/go.mod
#	x/authz/go.mod
#	x/bank/go.mod
#	x/staking/go.mod
julienrbrt added a commit that referenced this pull request Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants