perf: Remove more telemetry ops, update docs (#10334)
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description Followup from #10077 Closes: #XXXX <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
parent
50e146d764
commit
0f5af6670a
@ -68,7 +68,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* `MkConsKeyOutput`
|
||||
* `MkValKeyOutput`
|
||||
* `MkAccKeyOutput`
|
||||
* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077) Remove telemetry on `GasKV` and `CacheKV` store Get/Set operations, significantly improving their performance.
|
||||
* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077),[\#10334](https://github.com/cosmos/cosmos-sdk/pull/10334) Remove telemetry on `GasKV` and `CacheKV` store operations, significantly improving their performance.
|
||||
* [\#10022](https://github.com/cosmos/cosmos-sdk/pull/10022) `AuthKeeper` interface in `x/auth` now includes a function `HasAccount`.
|
||||
* [\#9759](https://github.com/cosmos/cosmos-sdk/pull/9759) `NewAccountKeeeper` in `x/auth` now takes an additional `bech32Prefix` argument that represents `sdk.Bech32MainPrefix`.
|
||||
* [\#9628](https://github.com/cosmos/cosmos-sdk/pull/9628) Rename `x/{mod}/legacy` to `x/{mod}/migrations`.
|
||||
|
||||
@ -131,14 +131,6 @@ The following examples expose too much cardinality and may not even prove to be
|
||||
| `store_iavl_delete` | Duration of an IAVL `Store#Delete` call | ms | summary |
|
||||
| `store_iavl_commit` | Duration of an IAVL `Store#Commit` call | ms | summary |
|
||||
| `store_iavl_query` | Duration of an IAVL `Store#Query` call | ms | summary |
|
||||
| `store_gaskv_get` | Duration of a GasKV `Store#Get` call | ms | summary |
|
||||
| `store_gaskv_set` | Duration of a GasKV `Store#Set` call | ms | summary |
|
||||
| `store_gaskv_has` | Duration of a GasKV `Store#Has` call | ms | summary |
|
||||
| `store_gaskv_delete` | Duration of a GasKV `Store#Delete` call | ms | summary |
|
||||
| `store_cachekv_get` | Duration of a CacheKV `Store#Get` call | ms | summary |
|
||||
| `store_cachekv_set` | Duration of a CacheKV `Store#Set` call | ms | summary |
|
||||
| `store_cachekv_write` | Duration of a CacheKV `Store#Write` call | ms | summary |
|
||||
| `store_cachekv_delete` | Duration of a CacheKV `Store#Delete` call | ms | summary |
|
||||
|
||||
## Next {hide}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"io"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
@ -13,7 +12,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/store/listenkv"
|
||||
"github.com/cosmos/cosmos-sdk/store/tracekv"
|
||||
"github.com/cosmos/cosmos-sdk/store/types"
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
"github.com/cosmos/cosmos-sdk/types/kv"
|
||||
)
|
||||
|
||||
@ -91,7 +89,6 @@ func (store *Store) Has(key []byte) bool {
|
||||
func (store *Store) Delete(key []byte) {
|
||||
store.mtx.Lock()
|
||||
defer store.mtx.Unlock()
|
||||
defer telemetry.MeasureSince(time.Now(), "store", "cachekv", "delete")
|
||||
|
||||
types.AssertValidKey(key)
|
||||
store.setCacheValue(key, nil, true, true)
|
||||
@ -101,7 +98,6 @@ func (store *Store) Delete(key []byte) {
|
||||
func (store *Store) Write() {
|
||||
store.mtx.Lock()
|
||||
defer store.mtx.Unlock()
|
||||
defer telemetry.MeasureSince(time.Now(), "store", "cachekv", "write")
|
||||
|
||||
// We need a copy of all of the keys.
|
||||
// Not the best, but probably not a bottleneck depending.
|
||||
|
||||
@ -2,10 +2,8 @@ package gaskv
|
||||
|
||||
import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/types"
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
)
|
||||
|
||||
var _ types.KVStore = &Store{}
|
||||
@ -58,14 +56,12 @@ func (gs *Store) Set(key []byte, value []byte) {
|
||||
|
||||
// Implements KVStore.
|
||||
func (gs *Store) Has(key []byte) bool {
|
||||
defer telemetry.MeasureSince(time.Now(), "store", "gaskv", "has")
|
||||
gs.gasMeter.ConsumeGas(gs.gasConfig.HasCost, types.GasHasDesc)
|
||||
return gs.parent.Has(key)
|
||||
}
|
||||
|
||||
// Implements KVStore.
|
||||
func (gs *Store) Delete(key []byte) {
|
||||
defer telemetry.MeasureSince(time.Now(), "store", "gaskv", "delete")
|
||||
// charge gas to prevent certain attack vectors even though space is being freed
|
||||
gs.gasMeter.ConsumeGas(gs.gasConfig.DeleteCost, types.GasDeleteDesc)
|
||||
gs.parent.Delete(key)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user