github graphprotocol/graph-node v0.17.0

latest releases: fraction3, fraction2, fraction...
4 years ago

GraphQL query prefetching (#1386)

Previously referred to SQL query combination, this feature speeds up nested queries by a factor of about 10x by batching every GraphQL query level into a single Postgres SQL query. A query like

{
  bands(first: 100) {
    name
    musicians(first: 100) {
      name
    }
}

previously would result in one SQL query for the bands and 100 SQL queries for the musicians of each individual band. With query prefetching, only two SQL queries are executed: one for the bands and one for the musicians of all bands.

This is now enabled by default.

Time-travel queries (#1397)

It is now possible to run queries against the state of a subgraph at an arbitrary block height, and not just the latest block. So far, a query like transactions { id } would always return the data for the latest set of transactions, and rerunning it might return a different result if the subgraph had ingested more transactions in the mean time.

It is now possible to fix the block at which to query by passing an additional block argument to top-level fields:

{
  transactions(block: { number: 7000 }) {
    id
  }
}

will return the transactions as of the block with that number, and

{
  transactions(block: { hash: "0xdeadbeef" }) {
    id
  }
}

will return transactions as of that block hash. To make absolutely sure the query result is reproducible, the form with the hash should be used as which block is designated by number may change if the chain is reorganized (though using number far enough away from the chain head will be fine).

If a query does not explicitly specify a block, we continue to run it against the latest available data, so that the behavior for existing queries does not change.

Indexing performance

Work on improving the indexing performance continues in this release. The following changes have been implemented since v0.16.1.

  • Add indexing metrics using Prometheus (#1338, #1360, #1361, #1362, #1374).
  • Optimize store.set entity validation (#1384).
  • Batch-load entities before applying changes (#1388).

Other changes

GraphQL

  • Catch unknown fields in GraphQL queries (#1339).
  • Log query execution time (#1402).
  • Add query execution time metrics using Prometheus (#1403).

Ethereum

  • Dynamically adjust block range sizes when scanning for triggers to send Ethereum nodes manageable requests (#1370).
  • Fix reorg handling on short chains (#1377).
  • Fix call handlers not being trigger in dynamic data sources (#1382).
  • Limit JSON-RPC retries to avoid getting stuck on reorg'ed blocks (#1396).
  • Ensure Ethereum triggers (blocks, calls, events) are always processed in the correct order (#1413).
  • Add block ingestor metrics using Prometheus (#1401, #1403).

Mappings

  • Reduce frequency of handler timeout checks to speed up indexing (#1353).
  • Log Ethereum transaction hash when a handler fails (#1371).

Store

  • Exit with error when losing the connection to Postgres (#1348). This allows to environments like Kubernetes to restart the nodes and therefore recover from lost Postgres connections.
  • Allow unneeded old blocks to be deleted from the store periodically (#1408).

Misc

  • Add missing ports to docker-compose.yml (#1385, thanks @Amxx!).
  • Make startup asynchronous to avoid getting stuck connecting to Ethereum nodes (#1352, #1372).
  • Detect invalid ETHEREUM_REORG_THRESHOLD values (#1366).
  • Rename graph-datasource-ethereum crate to graph-chain-ethereum (#1368).
  • Document call and block handlers in the manifest spec.
  • Dependency updates: chrono, derive_more, git-testament, jsonrpc-http-server, num-traits, reqwest, serde_derive, serde_json, slog-term, uuid.

Don't miss a new graph-node release

NewReleases is sending notifications on new releases.