Skip to content

[DX-3451] dynamic wait for sharding-related filters#21778

Merged
Tofel merged 1 commit intodevelopfrom
dx-3451-speed-up-sharding-local-cre
Mar 31, 2026
Merged

[DX-3451] dynamic wait for sharding-related filters#21778
Tofel merged 1 commit intodevelopfrom
dx-3451-speed-up-sharding-local-cre

Conversation

@Tofel
Copy link
Copy Markdown
Contributor

@Tofel Tofel commented Mar 30, 2026

Instead of time.Sleep(60).

Before

Environment setup completed successfully in 151.89 seconds
Environment setup completed successfully in 151.96 seconds

After

Environment setup completed successfully in 92.05 seconds
Environment setup completed successfully in 91.21 seconds

@github-actions
Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@cl-sonarqube-production
Copy link
Copy Markdown

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Mar 30, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@Tofel Tofel marked this pull request as ready for review March 30, 2026 17:23
@Tofel Tofel requested review from a team as code owners March 30, 2026 17:23
Copilot AI review requested due to automatic review settings March 30, 2026 17:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Risk Rating: MEDIUM — introduces new concurrency + DB polling behavior in sharding setup (system-test utility code) and changes SetupSharding runtime requirements.

This PR replaces a fixed sleep with a dynamic wait that polls LogPoller filter registration so sharding setup can proceed as soon as the Ring ConfigPoller filter is available.

Changes:

  • Replaces time.Sleep(60s) + LogPoller health wait with a new polling loop that checks for the Ring OCR2ConfigPoller filter registration across shard leader worker nodes.
  • Adds lightweight Postgres/LogPoller ORM helpers to load filters from each node’s DB.
  • Adds concurrency via errgroup to check multiple worker nodes per tick.

Comment thread system-tests/lib/cre/sharding/sharding.go
Comment thread system-tests/lib/cre/sharding/sharding.go
Comment on lines +312 to +316
func newORM(logger commonlogger.Logger, chainID *big.Int, nodeIndex, externalPort int) (logpoller.ORM, *sqlx.DB, error) {
dsn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", "127.0.0.1", externalPort, postgres.User, postgres.Password, fmt.Sprintf("db_%d", nodeIndex))
db, err := sqlx.Open("postgres", dsn)
if err != nil {
return nil, db, err
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

This code opens a DB with sqlx.Open("postgres", ...), but this package does not register a "postgres" SQL driver (e.g., via a blank import of github.com/lib/pq). Since this is non-test library code, binaries that call SetupSharding may hit sql: unknown driver "postgres". Ensure the driver is registered within the library (or use a driver name that is guaranteed to be registered in the calling binary).

Copilot uses AI. Check for mistakes.
Comment thread system-tests/lib/cre/sharding/sharding.go
Comment thread system-tests/lib/cre/sharding/sharding.go
@Tofel Tofel enabled auto-merge March 31, 2026 08:02
@Tofel Tofel added this pull request to the merge queue Mar 31, 2026
Merged via the queue into develop with commit 2844e79 Mar 31, 2026
131 of 132 checks passed
@Tofel Tofel deleted the dx-3451-speed-up-sharding-local-cre branch March 31, 2026 09:29
prashantkumar1982 pushed a commit that referenced this pull request Apr 2, 2026
dynamic wait for sharding-related filters
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.

4 participants