Skip to content

(Requires Audit) PLEX-2473 LogPoller switch to batch inserts (Part 2)#356

Open
dhaidashenko wants to merge 4 commits intofeature/PLEX-2473-fix-reorg-handing-on-replayfrom
feature/PLEX-2473-lp-batch-insert-blocks
Open

(Requires Audit) PLEX-2473 LogPoller switch to batch inserts (Part 2)#356
dhaidashenko wants to merge 4 commits intofeature/PLEX-2473-fix-reorg-handing-on-replayfrom
feature/PLEX-2473-lp-batch-insert-blocks

Conversation

@dhaidashenko
Copy link
Contributor

@dhaidashenko dhaidashenko commented Feb 13, 2026

Insert blocks and logs in batches to reduce DB IO usage.

Depends on: #355

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

⚠️ API Diff Results - Breaking changes detected

📦 Module: github-com-smartcontractkit-chainlink-evm

🔴 Breaking Changes (4)

pkg/logpoller.(*DSORM) (1)
  • InsertLogsWithBlock — 🗑️ Removed
pkg/logpoller.(*ObservedORM) (1)
  • InsertLogsWithBlock — 🗑️ Removed
pkg/logpoller.ORM (2)
  • InsertLogsWithBlock — 🗑️ Removed

  • InsertLogsWithBlocks — ➕ Added


📄 View full apidiff report

@dhaidashenko dhaidashenko changed the title PLEX-2473 LogPoller switch to batch inserts PLEX-2473 LogPoller switch to batch inserts (Part 2) Feb 13, 2026
@dhaidashenko dhaidashenko changed the title PLEX-2473 LogPoller switch to batch inserts (Part 2) (Pending Audit) PLEX-2473 LogPoller switch to batch inserts (Part 2) Feb 13, 2026
@dhaidashenko dhaidashenko changed the title (Pending Audit) PLEX-2473 LogPoller switch to batch inserts (Part 2) (Requires Audit) PLEX-2473 LogPoller switch to batch inserts (Part 2) Feb 13, 2026
@dhaidashenko dhaidashenko marked this pull request as ready for review February 13, 2026 16:33
@dhaidashenko dhaidashenko requested a review from a team as a code owner February 13, 2026 16:33
return batchInsert(ctx, tx, q, logs, 4000)
}

func batchInsert[T any](ctx context.Context, ds sqlutil.DataSource, query string, objs []T, batchSize int) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

unused parameter batchSize

// Resume from the latest block saved.
return fmt.Errorf("failed to get current block: %w", err)

blocks, logs, err := lp.getUnfinalizedLogs(ctx, currentBlock, latestBlockNumber, safeBlockNumber, latestFinalizedBlockNumber, isReplay)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should there be some batching as well? If a node is far behind, can this be potential OOM risk?

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.

3 participants