[DX-3451] dynamic wait for sharding-related filters#21778
Conversation
|
✅ No conflicts with other open PRs targeting |
|
There was a problem hiding this comment.
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
errgroupto check multiple worker nodes per tick.
| 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 |
There was a problem hiding this comment.
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).
dynamic wait for sharding-related filters




Instead of
time.Sleep(60).Before
After