when the user searches for a tx (hash=X)
This PR fixes error handling for performing a txindex search.
TxIndex.Get returns
(txresult, nil) if the transaction is found.
(nil, nil) if the transaction is not found.
(nil, error) if error is occurred.
Therefore, if res is not nil, I think TxIndex.Search should return (txresult, nil).
Previously, however, this was not a problem because errors.Wrap returns nil if its first argument err is nil.
## Issue
Why this pr:
When restarting chain node, sometimes we lost tx index about recent(around 80)blocks, and some client complains that they can't find the tx by RPC call(tx_search) when the tx do exist in the block.
I try to partially fix this issue in a simple way by writing the index data in a sync way.
There is no performance difference under 1K TPS according to our test.
It is still possible that lost index data after restarting the node, but only 2 block data will lost at most.
I try to totally fix this in https://github.com/tendermint/tendermint/pull/3847/files, but this one is simple and can solve most part of the issue. Please review first, thks.
## Comments
Anton:
BEFORE:
BenchmarkTxIndex1-2 100000 12434 ns/op
BenchmarkTxIndex500-2 300 5151564 ns/op
BenchmarkTxIndex1000-2 100 15053910 ns/op
BenchmarkTxIndex2000-2 100 18238892 ns/op
BenchmarkTxIndex10000-2 20 124287930 ns/op
AFTER:
BenchmarkTxIndex1-2 2000 795431 ns/op
BenchmarkTxIndex500-2 200 6385124 ns/op
BenchmarkTxIndex1000-2 100 11388219 ns/op
BenchmarkTxIndex2000-2 100 20514873 ns/op
BenchmarkTxIndex10000-2 20 107456004 ns/op
Performance drop is pretty steep, but I think it's the right thing to do UNTIL we have a WAL.
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
There's no debug statement in Read func, so should be OK remove this one too.
* crypto: expose MaxAunts for documentation purposes
* types: update godoc for new maxes
* docs: make hard-coded limits more explicit
* wal: add todo to clarify max size
* shorten lines in test
* cs: panic only when WAL#WriteSync fails
- modify WAL#Write and WAL#WriteSync to return an error
* fix test
* types: validate Part#Proof
add ValidateBasic to crypto/merkle/SimpleProof
* cs: limit max bit array size and block parts count
* cs: test new limits
* cs: only assert important stuff
* update changelog and bump version to 0.32.7
* fixes after Ethan's review
* align max wal msg and max consensus msg sizes
* fix tests
* fix test
* add change log for 31.11
Some linting/cleanup missed from the initial events refactor
Don't panic; instead, return false, error when matching breaks unexpectedly
Strip non-numeric chars from values when attempting to match against query values
Have the server log during send upon error
* cleanup/lint Query#Conditions and do not panic
* cleanup/lint Query#Matches and do not panic
* cleanup/lint matchValue and do not panic
* rever to panic in Query#Conditions
* linting
* strip alpha chars when attempting to match
* add pending log entries
* Update libs/pubsub/query/query.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* build: update variable names
* update matchValue to return an error
* update Query#Matches to return an error
* update TestMatches
* log error in send
* Fix tests
* Fix TestEmptyQueryMatchesAnything
* fix linting
* Update libs/pubsub/query/query.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update libs/pubsub/query/query.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update libs/pubsub/query/query.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update libs/pubsub/query/query.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update libs/pubsub/query/query.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update libs/pubsub/pubsub.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* add missing errors pkg import
* update Query#Conditions to return an error
* update query pkg unit tests
* update TxIndex#Search
* update pending changelog
* Fix long line errors in abci, crypto, and libs packages
* Fix long lines in p2p and rpc packages
* Fix long lines in abci, state, and tools packages
* Fix long lines in behaviour and blockchain packages
* Fix long lines in cmd and config packages
* Begin fixing long lines in consensus package
* Finish fixing long lines in consensus package
* Add lll exclusion for lines containing URLs
* Fix long lines in crypto package
* Fix long lines in evidence package
* Fix long lines in mempool and node packages
* Fix long lines in libs package
* Fix long lines in lite package
* Fix new long line in node package
* Fix long lines in p2p package
* Ignore gocritic warning
* Fix long lines in privval package
* Fix long lines in rpc package
* Fix long lines in scripts package
* Fix long lines in state package
* Fix long lines in tools package
* Fix long lines in types package
* Enable lll linter
* Include sender when logging rejected txns
* Log as peerID to be consistent with other log messages
* Updated CHANGELOG_PENDING
* Handle nil source
* Updated PR link in CHANGELOG_PENDING
* Renamed TxInfo.SenderAddress and peerAddress til PeerFullID
* Renamed PeerFullID to PeerP2PID
* Forgot to rename a couple of references
* Add processor prototype
* Change processor API
+ expose a simple `handle` function which mutates internal state
* processor tests
* fix gofmt and ohter golangci issues
* scopelint var on range scope
* add check for short block received
* fix formatting
* small test reorg
* ignore unused for now
* ci fix changes
* go.mod revert
* New lint version upgrade
- linter was upgraded
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* enable-a;; is deprecated
* minor change
* another try
* some more changes
* some more changes
* reenable prealloc
* add version till bot is fixed
* docs theme
* vuepress-theme-cosmos
* version bump
* changes to docs
* more code changes
* sidebar order fix
* moar changes
* fixed dev sessions title
* fixed dev sessions title, again
* specs should show up in sidebar
* contents cards
* version bump
* sidebar, rpc
* version bump
* custom footer and super naive search
* version
* minor change to vuepress
* move swagger file
* pre and post scripts
* build
* changed docs build process
* added deployment config
* updated versions file and added deployment filters
* Add stale bot
- added stale bot to only pull requests for now
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* change code owner from xla to tess
* Remove traces oaf `github.com/tendermint/abci`
- removed abci dockerfile as it was still referencing `github.com/tendermint/abci`
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* nor change to install of abci
* use abci-cli instead of tendermint node
* remove traces of Dockerfile.develop
also use latest Go in Dockerfile.testing
* update docker readme
* remove wrapping because it will look awful on docker hub
* Quick clean up of docs
- removed a few files that have been deprecated and/or relocated
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* cleanup a few docs