-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BCFR-900] Add id column as PRIMARY KEY for evm.logs & evm.log_poller…
…_blocks (#14451) * Add id column as PRIMARY KEY for evm.logs & evm.log_poller_blocks Also: - Add UNIQUE INDEXes to replace previous primary keys (still necessary, both for optimizing queries and for enforcing uniqueness constraints) - Replace all SELECT *'s with helper functions for selecting all columns - Refactor nestedBlockQuery into withConfs, and make a bit more use of it * Clean up db indexes Some of the columns in these indexes (such as created_at) are no longer used. Others were not optimized for the queries we need. * Fix 2 unrelated bugs I noticed * Update ExpiredLogs query to use id column * Update test for fromBlock >= :block_number Previously it was using fromBlock > :block_number which is inconsistent with the other fromBlocks in queries * Increase staggering of initial pruning runs * Update go version 1.22.5 -> 1.22.7 * Update DeleteBlocksBefore query to use block_number index instead of LIMIT * Split off SelectUnmatchedLogs from DeleteExpiredLogs * Rename Id -> ID for linter * Add helper function for tickers * Stagger initial unmatched logs prune * Reorganize sql migration script, adding comments to clarify Also, adds a missing CREATE INDEX line that was left out of the Goose Down section: CREATE INDEX idx_evm_log_poller_blocks_order_by_block ON evm_log_poller_blocks (evm_chain_id, block_number DESC); And removes an extraneous DROP line that was in the Goose Up section: DROP INDEX IF EXISTS evm.idx_logs_chain_address_event_block_logindex; * Remove log_index from idx_logs_chain_block_logindex to save some disk space * add WHERE evm_chain_id and handle sql.ErrNoRows * Fix lint
- Loading branch information
1 parent
4b97702
commit e96210b
Showing
14 changed files
with
482 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
golang 1.22.5 | ||
golang 1.22.7 | ||
mockery 2.43.2 | ||
nodejs 20.13.1 | ||
pnpm 9.4.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.