From 185f15d64581586719c01096a81aaff7dad4c2f5 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Wed, 30 Mar 2022 13:47:52 -0700 Subject: [PATCH] config: default indexer configuration to null (#8222) After this change, new nodes will not have indexing enabled by default. Test configurations will still use "kv". * Update pending changelog and upgrading notes. * Fix indexer config for the test app. * Update config template and enable indexing for e2e tests. --- CHANGELOG_PENDING.md | 1 + UPGRADING.md | 7 +++++++ config/config.go | 11 ++++------- config/toml.go | 4 ++-- test/app/test.sh | 25 +++++++++++++++++-------- test/docker/config-template.toml | 3 +++ test/e2e/runner/setup.go | 1 + 7 files changed, 35 insertions(+), 17 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index e7aa904e3..cc71a5a5e 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -20,6 +20,7 @@ Special thanks to external contributors on this release: - [config] \#7930 Add new event subscription options and defaults. (@creachadair) - [rpc] \#7982 Add new Events interface and deprecate Subscribe. (@creachadair) - [cli] \#8081 make the reset command safe to use. (@marbar3778) + - [config] \#8222 default indexer configuration to null. (@creachadair) - Apps diff --git a/UPGRADING.md b/UPGRADING.md index 49973ea52..50facec19 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -26,6 +26,13 @@ application concern so be very sure to test the application thoroughly using realistic workloads and the race detector to ensure your applications remains correct. +### Config Changes + +The default configuration for a newly-created node now disables indexing for +ABCI event metadata. Existing node configurations that already have indexing +turned on are not affected. Operators who wish to enable indexing for a new +node, however, must now edit the `config.toml` explicitly. + ### RPC Changes Tendermint v0.36 adds a new RPC event subscription API. The existing event diff --git a/config/config.go b/config/config.go index fd4923cce..42fdba7f7 100644 --- a/config/config.go +++ b/config/config.go @@ -1088,9 +1088,8 @@ type TxIndexConfig struct { // If list contains `null`, meaning no indexer service will be used. // // Options: - // 1) "null" - no indexer services. - // 2) "kv" (default) - the simplest possible indexer, - // backed by key-value storage (defaults to levelDB; see DBBackend). + // 1) "null" (default) - no indexer services. + // 2) "kv" - a simple indexer backed by key-value storage (see DBBackend) // 3) "psql" - the indexer services backed by PostgreSQL. Indexer []string `mapstructure:"indexer"` @@ -1101,14 +1100,12 @@ type TxIndexConfig struct { // DefaultTxIndexConfig returns a default configuration for the transaction indexer. func DefaultTxIndexConfig() *TxIndexConfig { - return &TxIndexConfig{ - Indexer: []string{"kv"}, - } + return &TxIndexConfig{Indexer: []string{"null"}} } // TestTxIndexConfig returns a default configuration for the transaction indexer. func TestTxIndexConfig() *TxIndexConfig { - return DefaultTxIndexConfig() + return &TxIndexConfig{Indexer: []string{"kv"}} } //----------------------------------------------------------------------------- diff --git a/config/toml.go b/config/toml.go index 7ed1aaabf..21ccfa314 100644 --- a/config/toml.go +++ b/config/toml.go @@ -520,8 +520,8 @@ peer-query-maj23-sleep-duration = "{{ .Consensus.PeerQueryMaj23SleepDuration }}" # to decide which txs to index based on configuration set in the application. # # Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). +# 1) "null" (default) - no indexer services. +# 2) "kv" - a simple indexer backed by key-value storage (see DBBackend) # 3) "psql" - the indexer services backed by PostgreSQL. # When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. indexer = [{{ range $i, $e := .TxIndex.Indexer }}{{if $i}}, {{end}}{{ printf "%q" $e}}{{end}}] diff --git a/test/app/test.sh b/test/app/test.sh index 6896ee5f8..dba8a9c43 100755 --- a/test/app/test.sh +++ b/test/app/test.sh @@ -1,5 +1,5 @@ -#! /bin/bash -set -ex +#!/bin/bash +set -exo pipefail #- kvstore over socket, curl @@ -8,9 +8,19 @@ set -ex export PATH="$GOBIN:$PATH" export TMHOME=$HOME/.tendermint_app -function kvstore_over_socket(){ - rm -rf $TMHOME +function init_validator() { + rm -rf -- "$TMHOME" tendermint init validator + + # The default configuration sets a null indexer, but these tests require + # indexing to be enabled. Rewrite the config file to set the "kv" indexer + # before starting up the node. + sed -i'' -e '/indexer = \["null"\]/c\ +indexer = ["kv"]' "$TMHOME/config/config.toml" +} + +function kvstore_over_socket() { + init_validator echo "Starting kvstore_over_socket" abci-cli kvstore > /dev/null & pid_kvstore=$! @@ -25,9 +35,8 @@ function kvstore_over_socket(){ } # start tendermint first -function kvstore_over_socket_reorder(){ - rm -rf $TMHOME - tendermint init validator +function kvstore_over_socket_reorder() { + init_validator echo "Starting kvstore_over_socket_reorder (ie. start tendermint first)" tendermint start --mode validator > tendermint.log & pid_tendermint=$! @@ -42,7 +51,7 @@ function kvstore_over_socket_reorder(){ kill -9 $pid_kvstore $pid_tendermint } -case "$1" in +case "$1" in "kvstore_over_socket") kvstore_over_socket ;; diff --git a/test/docker/config-template.toml b/test/docker/config-template.toml index a90eb7bd5..6ce39c9f8 100644 --- a/test/docker/config-template.toml +++ b/test/docker/config-template.toml @@ -1,2 +1,5 @@ [rpc] laddr = "tcp://0.0.0.0:26657" + +[tx-index] +indexer = ["kv"] diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index 1b7d25bd7..507dc2d04 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -237,6 +237,7 @@ func MakeConfig(node *e2e.Node) (*config.Config, error) { cfg := config.DefaultConfig() cfg.Moniker = node.Name cfg.ProxyApp = AppAddressTCP + cfg.TxIndex = config.TestTxIndexConfig() if node.LogLevel != "" { cfg.LogLevel = node.LogLevel